diff --git a/api-specs.json b/api-specs.json index 0c55cc6838b44..178c752c776ec 100644 --- a/api-specs.json +++ b/api-specs.json @@ -1,4 +1,8 @@ { + "apimanagement/resource-manager": { + "source": "specification/apimanagement/resource-manager/readme.md", + "args": "--multiapi --fluent" + }, "applicationinsights/resource-manager": { "source": "specification/applicationinsights/resource-manager/readme.md", "args": "--multiapi --fluent" diff --git a/apimanagement/resource-manager/v2019_01_01/pom.xml b/apimanagement/resource-manager/v2019_01_01/pom.xml new file mode 100644 index 0000000000000..f1423daab003c --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/pom.xml @@ -0,0 +1,133 @@ + + + 4.0.0 + com.microsoft.azure.apimanagement.v2019_01_01 + + com.microsoft.azure + azure-arm-parent + 0.0.3-beta + ../../../pom.xml + + azure-mgmt-apimanagement + 1.0.0-beta + jar + Microsoft Azure SDK for ApiManagement Management + This package contains Microsoft ApiManagement Management SDK. + https://github.com/Azure/azure-sdk-for-java + + + The MIT License (MIT) + http://opensource.org/licenses/MIT + repo + + + + scm:git:https://github.com/Azure/azure-sdk-for-java + scm:git:git@github.com:Azure/azure-sdk-for-java.git + HEAD + + + UTF-8 + + + + + microsoft + Microsoft + + + + + com.microsoft.azure + azure-client-runtime + + + com.microsoft.azure + azure-arm-client-runtime + + + junit + junit + test + + + com.microsoft.azure + azure-client-authentication + test + + + com.microsoft.azure + azure-mgmt-resources + test + + + com.microsoft.azure + azure-arm-client-runtime + test-jar + test + + + + + + org.apache.maven.plugins + maven-jar-plugin + + + + true + true + + + + + + org.codehaus.mojo + build-helper-maven-plugin + + + org.apache.maven.plugins + maven-compiler-plugin + 3.1 + + 1.7 + 1.7 + + + com.microsoft.azure.management.apigeneration.LangDefinitionProcessor + + + true + true + + true + true + + + + + org.apache.maven.plugins + maven-javadoc-plugin + 2.8 + + *.implementation.*;*.utils.*;com.microsoft.schemas._2003._10.serialization;*.blob.core.search + + + /** +
* Copyright (c) Microsoft Corporation. All rights reserved. +
* Licensed under the MIT License. See License.txt in the project root for +
* license information. +
*/ + ]]> +
+
+
+
+
+
diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/AccessInformationContract.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/AccessInformationContract.java new file mode 100644 index 0000000000000..92039b57896fc --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/AccessInformationContract.java @@ -0,0 +1,40 @@ +/** + * 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.apimanagement.v2019_01_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.apimanagement.v2019_01_01.implementation.ApiManagementManager; +import com.microsoft.azure.management.apimanagement.v2019_01_01.implementation.AccessInformationContractInner; + +/** + * Type representing AccessInformationContract. + */ +public interface AccessInformationContract extends HasInner, HasManager { + /** + * @return the enabled value. + */ + Boolean enabled(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the primaryKey value. + */ + String primaryKey(); + + /** + * @return the secondaryKey value. + */ + String secondaryKey(); + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/AccessInformationUpdateParameters.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/AccessInformationUpdateParameters.java new file mode 100644 index 0000000000000..b963b259865fa --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/AccessInformationUpdateParameters.java @@ -0,0 +1,45 @@ +/** + * 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.apimanagement.v2019_01_01; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; + +/** + * Tenant access information update parameters. + */ +@JsonFlatten +public class AccessInformationUpdateParameters { + /** + * Determines whether direct access is enabled. + */ + @JsonProperty(value = "properties.enabled") + private Boolean enabled; + + /** + * Get determines whether direct access is enabled. + * + * @return the enabled value + */ + public Boolean enabled() { + return this.enabled; + } + + /** + * Set determines whether direct access is enabled. + * + * @param enabled the enabled value to set + * @return the AccessInformationUpdateParameters object itself. + */ + public AccessInformationUpdateParameters withEnabled(Boolean enabled) { + this.enabled = enabled; + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/AdditionalLocation.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/AdditionalLocation.java new file mode 100644 index 0000000000000..b70baabb30702 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/AdditionalLocation.java @@ -0,0 +1,146 @@ +/** + * 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.apimanagement.v2019_01_01; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Description of an additional API Management resource location. + */ +public class AdditionalLocation { + /** + * The location name of the additional region among Azure Data center + * regions. + */ + @JsonProperty(value = "location", required = true) + private String location; + + /** + * SKU properties of the API Management service. + */ + @JsonProperty(value = "sku", required = true) + private ApiManagementServiceSkuProperties sku; + + /** + * Public Static Load Balanced IP addresses of the API Management service + * in the additional location. Available only for Basic, Standard and + * Premium SKU. + */ + @JsonProperty(value = "publicIPAddresses", access = JsonProperty.Access.WRITE_ONLY) + private List publicIPAddresses; + + /** + * Private Static Load Balanced IP addresses of the API Management service + * which is deployed in an Internal Virtual Network in a particular + * additional location. Available only for Basic, Standard and Premium SKU. + */ + @JsonProperty(value = "privateIPAddresses", access = JsonProperty.Access.WRITE_ONLY) + private List privateIPAddresses; + + /** + * Virtual network configuration for the location. + */ + @JsonProperty(value = "virtualNetworkConfiguration") + private VirtualNetworkConfiguration virtualNetworkConfiguration; + + /** + * Gateway URL of the API Management service in the Region. + */ + @JsonProperty(value = "gatewayRegionalUrl", access = JsonProperty.Access.WRITE_ONLY) + private String gatewayRegionalUrl; + + /** + * Get the location name of the additional region among Azure Data center regions. + * + * @return the location value + */ + public String location() { + return this.location; + } + + /** + * Set the location name of the additional region among Azure Data center regions. + * + * @param location the location value to set + * @return the AdditionalLocation object itself. + */ + public AdditionalLocation withLocation(String location) { + this.location = location; + return this; + } + + /** + * Get sKU properties of the API Management service. + * + * @return the sku value + */ + public ApiManagementServiceSkuProperties sku() { + return this.sku; + } + + /** + * Set sKU properties of the API Management service. + * + * @param sku the sku value to set + * @return the AdditionalLocation object itself. + */ + public AdditionalLocation withSku(ApiManagementServiceSkuProperties sku) { + this.sku = sku; + return this; + } + + /** + * Get public Static Load Balanced IP addresses of the API Management service in the additional location. Available only for Basic, Standard and Premium SKU. + * + * @return the publicIPAddresses value + */ + public List publicIPAddresses() { + return this.publicIPAddresses; + } + + /** + * Get private Static Load Balanced IP addresses of the API Management service which is deployed in an Internal Virtual Network in a particular additional location. Available only for Basic, Standard and Premium SKU. + * + * @return the privateIPAddresses value + */ + public List privateIPAddresses() { + return this.privateIPAddresses; + } + + /** + * Get virtual network configuration for the location. + * + * @return the virtualNetworkConfiguration value + */ + public VirtualNetworkConfiguration virtualNetworkConfiguration() { + return this.virtualNetworkConfiguration; + } + + /** + * Set virtual network configuration for the location. + * + * @param virtualNetworkConfiguration the virtualNetworkConfiguration value to set + * @return the AdditionalLocation object itself. + */ + public AdditionalLocation withVirtualNetworkConfiguration(VirtualNetworkConfiguration virtualNetworkConfiguration) { + this.virtualNetworkConfiguration = virtualNetworkConfiguration; + return this; + } + + /** + * Get gateway URL of the API Management service in the Region. + * + * @return the gatewayRegionalUrl value + */ + public String gatewayRegionalUrl() { + return this.gatewayRegionalUrl; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/AlwaysLog.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/AlwaysLog.java new file mode 100644 index 0000000000000..e4461900c8b35 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/AlwaysLog.java @@ -0,0 +1,38 @@ +/** + * 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.apimanagement.v2019_01_01; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for AlwaysLog. + */ +public final class AlwaysLog extends ExpandableStringEnum { + /** Static value allErrors for AlwaysLog. */ + public static final AlwaysLog ALL_ERRORS = fromString("allErrors"); + + /** + * Creates or finds a AlwaysLog from its string representation. + * @param name a name to look for + * @return the corresponding AlwaysLog + */ + @JsonCreator + public static AlwaysLog fromString(String name) { + return fromString(name, AlwaysLog.class); + } + + /** + * @return known AlwaysLog values + */ + public static Collection values() { + return values(AlwaysLog.class); + } +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiContract.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiContract.java new file mode 100644 index 0000000000000..bde99692f9963 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiContract.java @@ -0,0 +1,709 @@ +/** + * 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.apimanagement.v2019_01_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.apimanagement.v2019_01_01.implementation.ApiContractInner; +import com.microsoft.azure.arm.model.Indexable; +import com.microsoft.azure.arm.model.Creatable; +import com.microsoft.azure.arm.model.Updatable; +import com.microsoft.azure.arm.model.Appliable; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.apimanagement.v2019_01_01.implementation.ApiManagementManager; +import java.util.List; + +/** + * Type representing ApiContract. + */ +public interface ApiContract extends HasInner, Indexable, Updatable, HasManager { + /** + * @return the apiRevision value. + */ + String apiRevision(); + + /** + * @return the apiRevisionDescription value. + */ + String apiRevisionDescription(); + + /** + * @return the apiType value. + */ + ApiType apiType(); + + /** + * @return the apiVersion value. + */ + String apiVersion(); + + /** + * @return the apiVersionDescription value. + */ + String apiVersionDescription(); + + /** + * @return the apiVersionSet value. + */ + ApiVersionSetContractDetails apiVersionSet(); + + /** + * @return the apiVersionSetId value. + */ + String apiVersionSetId(); + + /** + * @return the authenticationSettings value. + */ + AuthenticationSettingsContract authenticationSettings(); + + /** + * @return the description value. + */ + String description(); + + /** + * @return the displayName value. + */ + String displayName(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the isCurrent value. + */ + Boolean isCurrent(); + + /** + * @return the isOnline value. + */ + Boolean isOnline(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the path value. + */ + String path(); + + /** + * @return the protocols value. + */ + List protocols(); + + /** + * @return the serviceUrl value. + */ + String serviceUrl(); + + /** + * @return the sourceApiId value. + */ + String sourceApiId(); + + /** + * @return the subscriptionKeyParameterNames value. + */ + SubscriptionKeyParameterNamesContract subscriptionKeyParameterNames(); + + /** + * @return the subscriptionRequired value. + */ + Boolean subscriptionRequired(); + + /** + * @return the type value. + */ + String type(); + + /** + * The entirety of the ApiContract definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithResourceGroupName, DefinitionStages.WithServiceName, DefinitionStages.WithIfMatch, DefinitionStages.WithPath, DefinitionStages.WithCreate { + } + + /** + * Grouping of ApiContract definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a ApiContract definition. + */ + interface Blank extends WithResourceGroupName { + } + + /** + * The stage of the apicontract definition allowing to specify ResourceGroupName. + */ + interface WithResourceGroupName { + /** + * Specifies resourceGroupName. + * @param resourceGroupName The name of the resource group + * @return the next definition stage + */ + WithServiceName withResourceGroupName(String resourceGroupName); + } + + /** + * The stage of the apicontract definition allowing to specify ServiceName. + */ + interface WithServiceName { + /** + * Specifies serviceName. + * @param serviceName The name of the API Management service + * @return the next definition stage + */ + WithIfMatch withServiceName(String serviceName); + } + + /** + * The stage of the apicontract definition allowing to specify IfMatch. + */ + interface WithIfMatch { + /** + * Specifies ifMatch. + * @param ifMatch ETag of the Entity. Not required when creating an entity, but required when updating an entity + * @return the next definition stage + */ + WithPath withIfMatch(String ifMatch); + } + + /** + * The stage of the apicontract definition allowing to specify Path. + */ + interface WithPath { + /** + * Specifies path. + * @param path Relative URL uniquely identifying this API and all of its resource paths within the API Management service instance. It is appended to the API endpoint base URL specified during the service instance creation to form a public URL for this API + * @return the next definition stage + */ + WithCreate withPath(String path); + } + + /** + * The stage of the apicontract definition allowing to specify ApiRevision. + */ + interface WithApiRevision { + /** + * Specifies apiRevision. + * @param apiRevision Describes the Revision of the Api. If no value is provided, default revision 1 is created + * @return the next definition stage + */ + WithCreate withApiRevision(String apiRevision); + } + + /** + * The stage of the apicontract definition allowing to specify ApiRevisionDescription. + */ + interface WithApiRevisionDescription { + /** + * Specifies apiRevisionDescription. + * @param apiRevisionDescription Description of the Api Revision + * @return the next definition stage + */ + WithCreate withApiRevisionDescription(String apiRevisionDescription); + } + + /** + * The stage of the apicontract definition allowing to specify ApiType. + */ + interface WithApiType { + /** + * Specifies apiType. + * @param apiType Type of API. Possible values include: 'http', 'soap' + * @return the next definition stage + */ + WithCreate withApiType(ApiType apiType); + } + + /** + * The stage of the apicontract definition allowing to specify ApiVersion. + */ + interface WithApiVersion { + /** + * Specifies apiVersion. + * @param apiVersion Indicates the Version identifier of the API if the API is versioned + * @return the next definition stage + */ + WithCreate withApiVersion(String apiVersion); + } + + /** + * The stage of the apicontract definition allowing to specify ApiVersionDescription. + */ + interface WithApiVersionDescription { + /** + * Specifies apiVersionDescription. + * @param apiVersionDescription Description of the Api Version + * @return the next definition stage + */ + WithCreate withApiVersionDescription(String apiVersionDescription); + } + + /** + * The stage of the apicontract definition allowing to specify ApiVersionSet. + */ + interface WithApiVersionSet { + /** + * Specifies apiVersionSet. + * @param apiVersionSet Version set details + * @return the next definition stage + */ + WithCreate withApiVersionSet(ApiVersionSetContractDetails apiVersionSet); + } + + /** + * The stage of the apicontract definition allowing to specify ApiVersionSetId. + */ + interface WithApiVersionSetId { + /** + * Specifies apiVersionSetId. + * @param apiVersionSetId A resource identifier for the related ApiVersionSet + * @return the next definition stage + */ + WithCreate withApiVersionSetId(String apiVersionSetId); + } + + /** + * The stage of the apicontract definition allowing to specify AuthenticationSettings. + */ + interface WithAuthenticationSettings { + /** + * Specifies authenticationSettings. + * @param authenticationSettings Collection of authentication settings included into this API + * @return the next definition stage + */ + WithCreate withAuthenticationSettings(AuthenticationSettingsContract authenticationSettings); + } + + /** + * The stage of the apicontract definition allowing to specify Description. + */ + interface WithDescription { + /** + * Specifies description. + * @param description Description of the API. May include HTML formatting tags + * @return the next definition stage + */ + WithCreate withDescription(String description); + } + + /** + * The stage of the apicontract definition allowing to specify DisplayName. + */ + interface WithDisplayName { + /** + * Specifies displayName. + * @param displayName API name. Must be 1 to 300 characters long + * @return the next definition stage + */ + WithCreate withDisplayName(String displayName); + } + + /** + * The stage of the apicontract definition allowing to specify Format. + */ + interface WithFormat { + /** + * Specifies format. + * @param format Format of the Content in which the API is getting imported. Possible values include: 'wadl-xml', 'wadl-link-json', 'swagger-json', 'swagger-link-json', 'wsdl', 'wsdl-link', 'openapi', 'openapi+json', 'openapi-link' + * @return the next definition stage + */ + WithCreate withFormat(ContentFormat format); + } + + /** + * The stage of the apicontract definition allowing to specify IsCurrent. + */ + interface WithIsCurrent { + /** + * Specifies isCurrent. + * @param isCurrent Indicates if API revision is current api revision + * @return the next definition stage + */ + WithCreate withIsCurrent(Boolean isCurrent); + } + + /** + * The stage of the apicontract definition allowing to specify Protocols. + */ + interface WithProtocols { + /** + * Specifies protocols. + * @param protocols Describes on which protocols the operations in this API can be invoked + * @return the next definition stage + */ + WithCreate withProtocols(List protocols); + } + + /** + * The stage of the apicontract definition allowing to specify ServiceUrl. + */ + interface WithServiceUrl { + /** + * Specifies serviceUrl. + * @param serviceUrl Absolute URL of the backend service implementing this API. Cannot be more than 2000 characters long + * @return the next definition stage + */ + WithCreate withServiceUrl(String serviceUrl); + } + + /** + * The stage of the apicontract definition allowing to specify SoapApiType. + */ + interface WithSoapApiType { + /** + * Specifies soapApiType. + * @param soapApiType Type of Api to create. + * `http` creates a SOAP to REST API + * `soap` creates a SOAP pass-through API. Possible values include: 'SoapToRest', 'SoapPassThrough' + * @return the next definition stage + */ + WithCreate withSoapApiType(SoapApiType soapApiType); + } + + /** + * The stage of the apicontract definition allowing to specify SourceApiId. + */ + interface WithSourceApiId { + /** + * Specifies sourceApiId. + * @param sourceApiId API identifier of the source API + * @return the next definition stage + */ + WithCreate withSourceApiId(String sourceApiId); + } + + /** + * The stage of the apicontract definition allowing to specify SubscriptionKeyParameterNames. + */ + interface WithSubscriptionKeyParameterNames { + /** + * Specifies subscriptionKeyParameterNames. + * @param subscriptionKeyParameterNames Protocols over which API is made available + * @return the next definition stage + */ + WithCreate withSubscriptionKeyParameterNames(SubscriptionKeyParameterNamesContract subscriptionKeyParameterNames); + } + + /** + * The stage of the apicontract definition allowing to specify SubscriptionRequired. + */ + interface WithSubscriptionRequired { + /** + * Specifies subscriptionRequired. + * @param subscriptionRequired Specifies whether an API or Product subscription is required for accessing the API + * @return the next definition stage + */ + WithCreate withSubscriptionRequired(Boolean subscriptionRequired); + } + + /** + * The stage of the apicontract definition allowing to specify Value. + */ + interface WithValue { + /** + * Specifies value. + * @param value Content value when Importing an API + * @return the next definition stage + */ + WithCreate withValue(String value); + } + + /** + * The stage of the apicontract definition allowing to specify WsdlSelector. + */ + interface WithWsdlSelector { + /** + * Specifies wsdlSelector. + * @param wsdlSelector Criteria to limit import of WSDL to a subset of the document + * @return the next definition stage + */ + WithCreate withWsdlSelector(ApiCreateOrUpdatePropertiesWsdlSelector wsdlSelector); + } + + /** + * The stage of the definition which contains all the minimum required inputs for + * the resource to be created (via {@link WithCreate#create()}), but also allows + * for any other optional settings to be specified. + */ + interface WithCreate extends Creatable, DefinitionStages.WithApiRevision, DefinitionStages.WithApiRevisionDescription, DefinitionStages.WithApiType, DefinitionStages.WithApiVersion, DefinitionStages.WithApiVersionDescription, DefinitionStages.WithApiVersionSet, DefinitionStages.WithApiVersionSetId, DefinitionStages.WithAuthenticationSettings, DefinitionStages.WithDescription, DefinitionStages.WithDisplayName, DefinitionStages.WithFormat, DefinitionStages.WithIsCurrent, DefinitionStages.WithProtocols, DefinitionStages.WithServiceUrl, DefinitionStages.WithSoapApiType, DefinitionStages.WithSourceApiId, DefinitionStages.WithSubscriptionKeyParameterNames, DefinitionStages.WithSubscriptionRequired, DefinitionStages.WithValue, DefinitionStages.WithWsdlSelector { + } + } + /** + * The template for a ApiContract update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithIfMatch, UpdateStages.WithApiRevision, UpdateStages.WithApiRevisionDescription, UpdateStages.WithApiType, UpdateStages.WithApiVersion, UpdateStages.WithApiVersionDescription, UpdateStages.WithApiVersionSet, UpdateStages.WithApiVersionSetId, UpdateStages.WithAuthenticationSettings, UpdateStages.WithDescription, UpdateStages.WithDisplayName, UpdateStages.WithFormat, UpdateStages.WithIsCurrent, UpdateStages.WithProtocols, UpdateStages.WithServiceUrl, UpdateStages.WithSoapApiType, UpdateStages.WithSourceApiId, UpdateStages.WithSubscriptionKeyParameterNames, UpdateStages.WithSubscriptionRequired, UpdateStages.WithValue, UpdateStages.WithWsdlSelector { + } + + /** + * Grouping of ApiContract update stages. + */ + interface UpdateStages { + /** + * The stage of the apicontract update allowing to specify IfMatch. + */ + interface WithIfMatch { + /** + * Specifies ifMatch. + * @param ifMatch ETag of the Entity. Not required when creating an entity, but required when updating an entity + * @return the next update stage + */ + Update withIfMatch(String ifMatch); + } + + /** + * The stage of the apicontract update allowing to specify ApiRevision. + */ + interface WithApiRevision { + /** + * Specifies apiRevision. + * @param apiRevision Describes the Revision of the Api. If no value is provided, default revision 1 is created + * @return the next update stage + */ + Update withApiRevision(String apiRevision); + } + + /** + * The stage of the apicontract update allowing to specify ApiRevisionDescription. + */ + interface WithApiRevisionDescription { + /** + * Specifies apiRevisionDescription. + * @param apiRevisionDescription Description of the Api Revision + * @return the next update stage + */ + Update withApiRevisionDescription(String apiRevisionDescription); + } + + /** + * The stage of the apicontract update allowing to specify ApiType. + */ + interface WithApiType { + /** + * Specifies apiType. + * @param apiType Type of API. Possible values include: 'http', 'soap' + * @return the next update stage + */ + Update withApiType(ApiType apiType); + } + + /** + * The stage of the apicontract update allowing to specify ApiVersion. + */ + interface WithApiVersion { + /** + * Specifies apiVersion. + * @param apiVersion Indicates the Version identifier of the API if the API is versioned + * @return the next update stage + */ + Update withApiVersion(String apiVersion); + } + + /** + * The stage of the apicontract update allowing to specify ApiVersionDescription. + */ + interface WithApiVersionDescription { + /** + * Specifies apiVersionDescription. + * @param apiVersionDescription Description of the Api Version + * @return the next update stage + */ + Update withApiVersionDescription(String apiVersionDescription); + } + + /** + * The stage of the apicontract update allowing to specify ApiVersionSet. + */ + interface WithApiVersionSet { + /** + * Specifies apiVersionSet. + * @param apiVersionSet Version set details + * @return the next update stage + */ + Update withApiVersionSet(ApiVersionSetContractDetails apiVersionSet); + } + + /** + * The stage of the apicontract update allowing to specify ApiVersionSetId. + */ + interface WithApiVersionSetId { + /** + * Specifies apiVersionSetId. + * @param apiVersionSetId A resource identifier for the related ApiVersionSet + * @return the next update stage + */ + Update withApiVersionSetId(String apiVersionSetId); + } + + /** + * The stage of the apicontract update allowing to specify AuthenticationSettings. + */ + interface WithAuthenticationSettings { + /** + * Specifies authenticationSettings. + * @param authenticationSettings Collection of authentication settings included into this API + * @return the next update stage + */ + Update withAuthenticationSettings(AuthenticationSettingsContract authenticationSettings); + } + + /** + * The stage of the apicontract update allowing to specify Description. + */ + interface WithDescription { + /** + * Specifies description. + * @param description Description of the API. May include HTML formatting tags + * @return the next update stage + */ + Update withDescription(String description); + } + + /** + * The stage of the apicontract update allowing to specify DisplayName. + */ + interface WithDisplayName { + /** + * Specifies displayName. + * @param displayName API name. Must be 1 to 300 characters long + * @return the next update stage + */ + Update withDisplayName(String displayName); + } + + /** + * The stage of the apicontract update allowing to specify Format. + */ + interface WithFormat { + /** + * Specifies format. + * @param format Format of the Content in which the API is getting imported. Possible values include: 'wadl-xml', 'wadl-link-json', 'swagger-json', 'swagger-link-json', 'wsdl', 'wsdl-link', 'openapi', 'openapi+json', 'openapi-link' + * @return the next update stage + */ + Update withFormat(ContentFormat format); + } + + /** + * The stage of the apicontract update allowing to specify IsCurrent. + */ + interface WithIsCurrent { + /** + * Specifies isCurrent. + * @param isCurrent Indicates if API revision is current api revision + * @return the next update stage + */ + Update withIsCurrent(Boolean isCurrent); + } + + /** + * The stage of the apicontract update allowing to specify Protocols. + */ + interface WithProtocols { + /** + * Specifies protocols. + * @param protocols Describes on which protocols the operations in this API can be invoked + * @return the next update stage + */ + Update withProtocols(List protocols); + } + + /** + * The stage of the apicontract update allowing to specify ServiceUrl. + */ + interface WithServiceUrl { + /** + * Specifies serviceUrl. + * @param serviceUrl Absolute URL of the backend service implementing this API. Cannot be more than 2000 characters long + * @return the next update stage + */ + Update withServiceUrl(String serviceUrl); + } + + /** + * The stage of the apicontract update allowing to specify SoapApiType. + */ + interface WithSoapApiType { + /** + * Specifies soapApiType. + * @param soapApiType Type of Api to create. + * `http` creates a SOAP to REST API + * `soap` creates a SOAP pass-through API. Possible values include: 'SoapToRest', 'SoapPassThrough' + * @return the next update stage + */ + Update withSoapApiType(SoapApiType soapApiType); + } + + /** + * The stage of the apicontract update allowing to specify SourceApiId. + */ + interface WithSourceApiId { + /** + * Specifies sourceApiId. + * @param sourceApiId API identifier of the source API + * @return the next update stage + */ + Update withSourceApiId(String sourceApiId); + } + + /** + * The stage of the apicontract update allowing to specify SubscriptionKeyParameterNames. + */ + interface WithSubscriptionKeyParameterNames { + /** + * Specifies subscriptionKeyParameterNames. + * @param subscriptionKeyParameterNames Protocols over which API is made available + * @return the next update stage + */ + Update withSubscriptionKeyParameterNames(SubscriptionKeyParameterNamesContract subscriptionKeyParameterNames); + } + + /** + * The stage of the apicontract update allowing to specify SubscriptionRequired. + */ + interface WithSubscriptionRequired { + /** + * Specifies subscriptionRequired. + * @param subscriptionRequired Specifies whether an API or Product subscription is required for accessing the API + * @return the next update stage + */ + Update withSubscriptionRequired(Boolean subscriptionRequired); + } + + /** + * The stage of the apicontract update allowing to specify Value. + */ + interface WithValue { + /** + * Specifies value. + * @param value Content value when Importing an API + * @return the next update stage + */ + Update withValue(String value); + } + + /** + * The stage of the apicontract update allowing to specify WsdlSelector. + */ + interface WithWsdlSelector { + /** + * Specifies wsdlSelector. + * @param wsdlSelector Criteria to limit import of WSDL to a subset of the document + * @return the next update stage + */ + Update withWsdlSelector(ApiCreateOrUpdatePropertiesWsdlSelector wsdlSelector); + } + + } +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiContractProperties.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiContractProperties.java new file mode 100644 index 0000000000000..5073200429d2f --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiContractProperties.java @@ -0,0 +1,178 @@ +/** + * 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.apimanagement.v2019_01_01; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Api Entity Properties. + */ +public class ApiContractProperties extends ApiEntityBaseContract { + /** + * API identifier of the source API. + */ + @JsonProperty(value = "sourceApiId") + private String sourceApiId; + + /** + * API name. Must be 1 to 300 characters long. + */ + @JsonProperty(value = "displayName") + private String displayName; + + /** + * Absolute URL of the backend service implementing this API. Cannot be + * more than 2000 characters long. + */ + @JsonProperty(value = "serviceUrl") + private String serviceUrl; + + /** + * Relative URL uniquely identifying this API and all of its resource paths + * within the API Management service instance. It is appended to the API + * endpoint base URL specified during the service instance creation to form + * a public URL for this API. + */ + @JsonProperty(value = "path", required = true) + private String path; + + /** + * Describes on which protocols the operations in this API can be invoked. + */ + @JsonProperty(value = "protocols") + private List protocols; + + /** + * Version set details. + */ + @JsonProperty(value = "apiVersionSet") + private ApiVersionSetContractDetails apiVersionSet; + + /** + * Get aPI identifier of the source API. + * + * @return the sourceApiId value + */ + public String sourceApiId() { + return this.sourceApiId; + } + + /** + * Set aPI identifier of the source API. + * + * @param sourceApiId the sourceApiId value to set + * @return the ApiContractProperties object itself. + */ + public ApiContractProperties withSourceApiId(String sourceApiId) { + this.sourceApiId = sourceApiId; + return this; + } + + /** + * Get aPI name. Must be 1 to 300 characters long. + * + * @return the displayName value + */ + public String displayName() { + return this.displayName; + } + + /** + * Set aPI name. Must be 1 to 300 characters long. + * + * @param displayName the displayName value to set + * @return the ApiContractProperties object itself. + */ + public ApiContractProperties withDisplayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Get absolute URL of the backend service implementing this API. Cannot be more than 2000 characters long. + * + * @return the serviceUrl value + */ + public String serviceUrl() { + return this.serviceUrl; + } + + /** + * Set absolute URL of the backend service implementing this API. Cannot be more than 2000 characters long. + * + * @param serviceUrl the serviceUrl value to set + * @return the ApiContractProperties object itself. + */ + public ApiContractProperties withServiceUrl(String serviceUrl) { + this.serviceUrl = serviceUrl; + return this; + } + + /** + * Get relative URL uniquely identifying this API and all of its resource paths within the API Management service instance. It is appended to the API endpoint base URL specified during the service instance creation to form a public URL for this API. + * + * @return the path value + */ + public String path() { + return this.path; + } + + /** + * Set relative URL uniquely identifying this API and all of its resource paths within the API Management service instance. It is appended to the API endpoint base URL specified during the service instance creation to form a public URL for this API. + * + * @param path the path value to set + * @return the ApiContractProperties object itself. + */ + public ApiContractProperties withPath(String path) { + this.path = path; + return this; + } + + /** + * Get describes on which protocols the operations in this API can be invoked. + * + * @return the protocols value + */ + public List protocols() { + return this.protocols; + } + + /** + * Set describes on which protocols the operations in this API can be invoked. + * + * @param protocols the protocols value to set + * @return the ApiContractProperties object itself. + */ + public ApiContractProperties withProtocols(List protocols) { + this.protocols = protocols; + return this; + } + + /** + * Get version set details. + * + * @return the apiVersionSet value + */ + public ApiVersionSetContractDetails apiVersionSet() { + return this.apiVersionSet; + } + + /** + * Set version set details. + * + * @param apiVersionSet the apiVersionSet value to set + * @return the ApiContractProperties object itself. + */ + public ApiContractProperties withApiVersionSet(ApiVersionSetContractDetails apiVersionSet) { + this.apiVersionSet = apiVersionSet; + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiCreateOrUpdateHeaders.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiCreateOrUpdateHeaders.java new file mode 100644 index 0000000000000..a8b0be32359a6 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiCreateOrUpdateHeaders.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.apimanagement.v2019_01_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for CreateOrUpdate operation. + */ +public class ApiCreateOrUpdateHeaders { + /** + * Current entity state version. Should be treated as opaque and used to + * make conditional HTTP requests. + */ + @JsonProperty(value = "ETag") + private String eTag; + + /** + * Get current entity state version. Should be treated as opaque and used to make conditional HTTP requests. + * + * @return the eTag value + */ + public String eTag() { + return this.eTag; + } + + /** + * Set current entity state version. Should be treated as opaque and used to make conditional HTTP requests. + * + * @param eTag the eTag value to set + * @return the ApiCreateOrUpdateHeaders object itself. + */ + public ApiCreateOrUpdateHeaders withETag(String eTag) { + this.eTag = eTag; + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiCreateOrUpdateParameter.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiCreateOrUpdateParameter.java new file mode 100644 index 0000000000000..d7fdb328637b2 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiCreateOrUpdateParameter.java @@ -0,0 +1,597 @@ +/** + * 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.apimanagement.v2019_01_01; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; + +/** + * API Create or Update Parameters. + */ +@JsonFlatten +public class ApiCreateOrUpdateParameter { + /** + * Description of the API. May include HTML formatting tags. + */ + @JsonProperty(value = "properties.description") + private String description; + + /** + * Collection of authentication settings included into this API. + */ + @JsonProperty(value = "properties.authenticationSettings") + private AuthenticationSettingsContract authenticationSettings; + + /** + * Protocols over which API is made available. + */ + @JsonProperty(value = "properties.subscriptionKeyParameterNames") + private SubscriptionKeyParameterNamesContract subscriptionKeyParameterNames; + + /** + * Type of API. Possible values include: 'http', 'soap'. + */ + @JsonProperty(value = "properties.type") + private ApiType apiType; + + /** + * Describes the Revision of the Api. If no value is provided, default + * revision 1 is created. + */ + @JsonProperty(value = "properties.apiRevision") + private String apiRevision; + + /** + * Indicates the Version identifier of the API if the API is versioned. + */ + @JsonProperty(value = "properties.apiVersion") + private String apiVersion; + + /** + * Indicates if API revision is current api revision. + */ + @JsonProperty(value = "properties.isCurrent") + private Boolean isCurrent; + + /** + * Indicates if API revision is accessible via the gateway. + */ + @JsonProperty(value = "properties.isOnline", access = JsonProperty.Access.WRITE_ONLY) + private Boolean isOnline; + + /** + * Description of the Api Revision. + */ + @JsonProperty(value = "properties.apiRevisionDescription") + private String apiRevisionDescription; + + /** + * Description of the Api Version. + */ + @JsonProperty(value = "properties.apiVersionDescription") + private String apiVersionDescription; + + /** + * A resource identifier for the related ApiVersionSet. + */ + @JsonProperty(value = "properties.apiVersionSetId") + private String apiVersionSetId; + + /** + * Specifies whether an API or Product subscription is required for + * accessing the API. + */ + @JsonProperty(value = "properties.subscriptionRequired") + private Boolean subscriptionRequired; + + /** + * API identifier of the source API. + */ + @JsonProperty(value = "properties.sourceApiId") + private String sourceApiId; + + /** + * API name. Must be 1 to 300 characters long. + */ + @JsonProperty(value = "properties.displayName") + private String displayName; + + /** + * Absolute URL of the backend service implementing this API. Cannot be + * more than 2000 characters long. + */ + @JsonProperty(value = "properties.serviceUrl") + private String serviceUrl; + + /** + * Relative URL uniquely identifying this API and all of its resource paths + * within the API Management service instance. It is appended to the API + * endpoint base URL specified during the service instance creation to form + * a public URL for this API. + */ + @JsonProperty(value = "properties.path", required = true) + private String path; + + /** + * Describes on which protocols the operations in this API can be invoked. + */ + @JsonProperty(value = "properties.protocols") + private List protocols; + + /** + * Version set details. + */ + @JsonProperty(value = "properties.apiVersionSet") + private ApiVersionSetContractDetails apiVersionSet; + + /** + * Content value when Importing an API. + */ + @JsonProperty(value = "properties.value") + private String value; + + /** + * Format of the Content in which the API is getting imported. Possible + * values include: 'wadl-xml', 'wadl-link-json', 'swagger-json', + * 'swagger-link-json', 'wsdl', 'wsdl-link', 'openapi', 'openapi+json', + * 'openapi-link'. + */ + @JsonProperty(value = "properties.format") + private ContentFormat format; + + /** + * Criteria to limit import of WSDL to a subset of the document. + */ + @JsonProperty(value = "properties.wsdlSelector") + private ApiCreateOrUpdatePropertiesWsdlSelector wsdlSelector; + + /** + * Type of Api to create. + * * `http` creates a SOAP to REST API + * * `soap` creates a SOAP pass-through API. Possible values include: + * 'SoapToRest', 'SoapPassThrough'. + */ + @JsonProperty(value = "properties.apiType") + private SoapApiType soapApiType; + + /** + * Get description of the API. May include HTML formatting tags. + * + * @return the description value + */ + public String description() { + return this.description; + } + + /** + * Set description of the API. May include HTML formatting tags. + * + * @param description the description value to set + * @return the ApiCreateOrUpdateParameter object itself. + */ + public ApiCreateOrUpdateParameter withDescription(String description) { + this.description = description; + return this; + } + + /** + * Get collection of authentication settings included into this API. + * + * @return the authenticationSettings value + */ + public AuthenticationSettingsContract authenticationSettings() { + return this.authenticationSettings; + } + + /** + * Set collection of authentication settings included into this API. + * + * @param authenticationSettings the authenticationSettings value to set + * @return the ApiCreateOrUpdateParameter object itself. + */ + public ApiCreateOrUpdateParameter withAuthenticationSettings(AuthenticationSettingsContract authenticationSettings) { + this.authenticationSettings = authenticationSettings; + return this; + } + + /** + * Get protocols over which API is made available. + * + * @return the subscriptionKeyParameterNames value + */ + public SubscriptionKeyParameterNamesContract subscriptionKeyParameterNames() { + return this.subscriptionKeyParameterNames; + } + + /** + * Set protocols over which API is made available. + * + * @param subscriptionKeyParameterNames the subscriptionKeyParameterNames value to set + * @return the ApiCreateOrUpdateParameter object itself. + */ + public ApiCreateOrUpdateParameter withSubscriptionKeyParameterNames(SubscriptionKeyParameterNamesContract subscriptionKeyParameterNames) { + this.subscriptionKeyParameterNames = subscriptionKeyParameterNames; + return this; + } + + /** + * Get type of API. Possible values include: 'http', 'soap'. + * + * @return the apiType value + */ + public ApiType apiType() { + return this.apiType; + } + + /** + * Set type of API. Possible values include: 'http', 'soap'. + * + * @param apiType the apiType value to set + * @return the ApiCreateOrUpdateParameter object itself. + */ + public ApiCreateOrUpdateParameter withApiType(ApiType apiType) { + this.apiType = apiType; + return this; + } + + /** + * Get describes the Revision of the Api. If no value is provided, default revision 1 is created. + * + * @return the apiRevision value + */ + public String apiRevision() { + return this.apiRevision; + } + + /** + * Set describes the Revision of the Api. If no value is provided, default revision 1 is created. + * + * @param apiRevision the apiRevision value to set + * @return the ApiCreateOrUpdateParameter object itself. + */ + public ApiCreateOrUpdateParameter withApiRevision(String apiRevision) { + this.apiRevision = apiRevision; + return this; + } + + /** + * Get indicates the Version identifier of the API if the API is versioned. + * + * @return the apiVersion value + */ + public String apiVersion() { + return this.apiVersion; + } + + /** + * Set indicates the Version identifier of the API if the API is versioned. + * + * @param apiVersion the apiVersion value to set + * @return the ApiCreateOrUpdateParameter object itself. + */ + public ApiCreateOrUpdateParameter withApiVersion(String apiVersion) { + this.apiVersion = apiVersion; + return this; + } + + /** + * Get indicates if API revision is current api revision. + * + * @return the isCurrent value + */ + public Boolean isCurrent() { + return this.isCurrent; + } + + /** + * Set indicates if API revision is current api revision. + * + * @param isCurrent the isCurrent value to set + * @return the ApiCreateOrUpdateParameter object itself. + */ + public ApiCreateOrUpdateParameter withIsCurrent(Boolean isCurrent) { + this.isCurrent = isCurrent; + return this; + } + + /** + * Get indicates if API revision is accessible via the gateway. + * + * @return the isOnline value + */ + public Boolean isOnline() { + return this.isOnline; + } + + /** + * Get description of the Api Revision. + * + * @return the apiRevisionDescription value + */ + public String apiRevisionDescription() { + return this.apiRevisionDescription; + } + + /** + * Set description of the Api Revision. + * + * @param apiRevisionDescription the apiRevisionDescription value to set + * @return the ApiCreateOrUpdateParameter object itself. + */ + public ApiCreateOrUpdateParameter withApiRevisionDescription(String apiRevisionDescription) { + this.apiRevisionDescription = apiRevisionDescription; + return this; + } + + /** + * Get description of the Api Version. + * + * @return the apiVersionDescription value + */ + public String apiVersionDescription() { + return this.apiVersionDescription; + } + + /** + * Set description of the Api Version. + * + * @param apiVersionDescription the apiVersionDescription value to set + * @return the ApiCreateOrUpdateParameter object itself. + */ + public ApiCreateOrUpdateParameter withApiVersionDescription(String apiVersionDescription) { + this.apiVersionDescription = apiVersionDescription; + return this; + } + + /** + * Get a resource identifier for the related ApiVersionSet. + * + * @return the apiVersionSetId value + */ + public String apiVersionSetId() { + return this.apiVersionSetId; + } + + /** + * Set a resource identifier for the related ApiVersionSet. + * + * @param apiVersionSetId the apiVersionSetId value to set + * @return the ApiCreateOrUpdateParameter object itself. + */ + public ApiCreateOrUpdateParameter withApiVersionSetId(String apiVersionSetId) { + this.apiVersionSetId = apiVersionSetId; + return this; + } + + /** + * Get specifies whether an API or Product subscription is required for accessing the API. + * + * @return the subscriptionRequired value + */ + public Boolean subscriptionRequired() { + return this.subscriptionRequired; + } + + /** + * Set specifies whether an API or Product subscription is required for accessing the API. + * + * @param subscriptionRequired the subscriptionRequired value to set + * @return the ApiCreateOrUpdateParameter object itself. + */ + public ApiCreateOrUpdateParameter withSubscriptionRequired(Boolean subscriptionRequired) { + this.subscriptionRequired = subscriptionRequired; + return this; + } + + /** + * Get aPI identifier of the source API. + * + * @return the sourceApiId value + */ + public String sourceApiId() { + return this.sourceApiId; + } + + /** + * Set aPI identifier of the source API. + * + * @param sourceApiId the sourceApiId value to set + * @return the ApiCreateOrUpdateParameter object itself. + */ + public ApiCreateOrUpdateParameter withSourceApiId(String sourceApiId) { + this.sourceApiId = sourceApiId; + return this; + } + + /** + * Get aPI name. Must be 1 to 300 characters long. + * + * @return the displayName value + */ + public String displayName() { + return this.displayName; + } + + /** + * Set aPI name. Must be 1 to 300 characters long. + * + * @param displayName the displayName value to set + * @return the ApiCreateOrUpdateParameter object itself. + */ + public ApiCreateOrUpdateParameter withDisplayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Get absolute URL of the backend service implementing this API. Cannot be more than 2000 characters long. + * + * @return the serviceUrl value + */ + public String serviceUrl() { + return this.serviceUrl; + } + + /** + * Set absolute URL of the backend service implementing this API. Cannot be more than 2000 characters long. + * + * @param serviceUrl the serviceUrl value to set + * @return the ApiCreateOrUpdateParameter object itself. + */ + public ApiCreateOrUpdateParameter withServiceUrl(String serviceUrl) { + this.serviceUrl = serviceUrl; + return this; + } + + /** + * Get relative URL uniquely identifying this API and all of its resource paths within the API Management service instance. It is appended to the API endpoint base URL specified during the service instance creation to form a public URL for this API. + * + * @return the path value + */ + public String path() { + return this.path; + } + + /** + * Set relative URL uniquely identifying this API and all of its resource paths within the API Management service instance. It is appended to the API endpoint base URL specified during the service instance creation to form a public URL for this API. + * + * @param path the path value to set + * @return the ApiCreateOrUpdateParameter object itself. + */ + public ApiCreateOrUpdateParameter withPath(String path) { + this.path = path; + return this; + } + + /** + * Get describes on which protocols the operations in this API can be invoked. + * + * @return the protocols value + */ + public List protocols() { + return this.protocols; + } + + /** + * Set describes on which protocols the operations in this API can be invoked. + * + * @param protocols the protocols value to set + * @return the ApiCreateOrUpdateParameter object itself. + */ + public ApiCreateOrUpdateParameter withProtocols(List protocols) { + this.protocols = protocols; + return this; + } + + /** + * Get version set details. + * + * @return the apiVersionSet value + */ + public ApiVersionSetContractDetails apiVersionSet() { + return this.apiVersionSet; + } + + /** + * Set version set details. + * + * @param apiVersionSet the apiVersionSet value to set + * @return the ApiCreateOrUpdateParameter object itself. + */ + public ApiCreateOrUpdateParameter withApiVersionSet(ApiVersionSetContractDetails apiVersionSet) { + this.apiVersionSet = apiVersionSet; + return this; + } + + /** + * Get content value when Importing an API. + * + * @return the value value + */ + public String value() { + return this.value; + } + + /** + * Set content value when Importing an API. + * + * @param value the value value to set + * @return the ApiCreateOrUpdateParameter object itself. + */ + public ApiCreateOrUpdateParameter withValue(String value) { + this.value = value; + return this; + } + + /** + * Get format of the Content in which the API is getting imported. Possible values include: 'wadl-xml', 'wadl-link-json', 'swagger-json', 'swagger-link-json', 'wsdl', 'wsdl-link', 'openapi', 'openapi+json', 'openapi-link'. + * + * @return the format value + */ + public ContentFormat format() { + return this.format; + } + + /** + * Set format of the Content in which the API is getting imported. Possible values include: 'wadl-xml', 'wadl-link-json', 'swagger-json', 'swagger-link-json', 'wsdl', 'wsdl-link', 'openapi', 'openapi+json', 'openapi-link'. + * + * @param format the format value to set + * @return the ApiCreateOrUpdateParameter object itself. + */ + public ApiCreateOrUpdateParameter withFormat(ContentFormat format) { + this.format = format; + return this; + } + + /** + * Get criteria to limit import of WSDL to a subset of the document. + * + * @return the wsdlSelector value + */ + public ApiCreateOrUpdatePropertiesWsdlSelector wsdlSelector() { + return this.wsdlSelector; + } + + /** + * Set criteria to limit import of WSDL to a subset of the document. + * + * @param wsdlSelector the wsdlSelector value to set + * @return the ApiCreateOrUpdateParameter object itself. + */ + public ApiCreateOrUpdateParameter withWsdlSelector(ApiCreateOrUpdatePropertiesWsdlSelector wsdlSelector) { + this.wsdlSelector = wsdlSelector; + return this; + } + + /** + * Get type of Api to create. + * `http` creates a SOAP to REST API + * `soap` creates a SOAP pass-through API. Possible values include: 'SoapToRest', 'SoapPassThrough'. + * + * @return the soapApiType value + */ + public SoapApiType soapApiType() { + return this.soapApiType; + } + + /** + * Set type of Api to create. + * `http` creates a SOAP to REST API + * `soap` creates a SOAP pass-through API. Possible values include: 'SoapToRest', 'SoapPassThrough'. + * + * @param soapApiType the soapApiType value to set + * @return the ApiCreateOrUpdateParameter object itself. + */ + public ApiCreateOrUpdateParameter withSoapApiType(SoapApiType soapApiType) { + this.soapApiType = soapApiType; + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiCreateOrUpdatePropertiesWsdlSelector.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiCreateOrUpdatePropertiesWsdlSelector.java new file mode 100644 index 0000000000000..e24fd107f7c95 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiCreateOrUpdatePropertiesWsdlSelector.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.apimanagement.v2019_01_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Criteria to limit import of WSDL to a subset of the document. + */ +public class ApiCreateOrUpdatePropertiesWsdlSelector { + /** + * Name of service to import from WSDL. + */ + @JsonProperty(value = "wsdlServiceName") + private String wsdlServiceName; + + /** + * Name of endpoint(port) to import from WSDL. + */ + @JsonProperty(value = "wsdlEndpointName") + private String wsdlEndpointName; + + /** + * Get name of service to import from WSDL. + * + * @return the wsdlServiceName value + */ + public String wsdlServiceName() { + return this.wsdlServiceName; + } + + /** + * Set name of service to import from WSDL. + * + * @param wsdlServiceName the wsdlServiceName value to set + * @return the ApiCreateOrUpdatePropertiesWsdlSelector object itself. + */ + public ApiCreateOrUpdatePropertiesWsdlSelector withWsdlServiceName(String wsdlServiceName) { + this.wsdlServiceName = wsdlServiceName; + return this; + } + + /** + * Get name of endpoint(port) to import from WSDL. + * + * @return the wsdlEndpointName value + */ + public String wsdlEndpointName() { + return this.wsdlEndpointName; + } + + /** + * Set name of endpoint(port) to import from WSDL. + * + * @param wsdlEndpointName the wsdlEndpointName value to set + * @return the ApiCreateOrUpdatePropertiesWsdlSelector object itself. + */ + public ApiCreateOrUpdatePropertiesWsdlSelector withWsdlEndpointName(String wsdlEndpointName) { + this.wsdlEndpointName = wsdlEndpointName; + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiDiagnosticContract.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiDiagnosticContract.java new file mode 100644 index 0000000000000..2d54503c31f0f --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiDiagnosticContract.java @@ -0,0 +1,275 @@ +/** + * 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.apimanagement.v2019_01_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.apimanagement.v2019_01_01.implementation.DiagnosticContractInner; +import com.microsoft.azure.arm.model.Indexable; +import com.microsoft.azure.arm.model.Refreshable; +import com.microsoft.azure.arm.model.Updatable; +import com.microsoft.azure.arm.model.Appliable; +import com.microsoft.azure.arm.model.Creatable; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.apimanagement.v2019_01_01.implementation.ApiManagementManager; + +/** + * Type representing ApiDiagnosticContract. + */ +public interface ApiDiagnosticContract extends HasInner, Indexable, Refreshable, Updatable, HasManager { + /** + * @return the alwaysLog value. + */ + AlwaysLog alwaysLog(); + + /** + * @return the backend value. + */ + PipelineDiagnosticSettings backend(); + + /** + * @return the enableHttpCorrelationHeaders value. + */ + Boolean enableHttpCorrelationHeaders(); + + /** + * @return the frontend value. + */ + PipelineDiagnosticSettings frontend(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the loggerId value. + */ + String loggerId(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the sampling value. + */ + SamplingSettings sampling(); + + /** + * @return the type value. + */ + String type(); + + /** + * The entirety of the ApiDiagnosticContract definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithApi, DefinitionStages.WithIfMatch, DefinitionStages.WithLoggerId, DefinitionStages.WithCreate { + } + + /** + * Grouping of ApiDiagnosticContract definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a ApiDiagnosticContract definition. + */ + interface Blank extends WithApi { + } + + /** + * The stage of the apidiagnosticcontract definition allowing to specify Api. + */ + interface WithApi { + /** + * Specifies resourceGroupName, serviceName, apiId. + * @param resourceGroupName The name of the resource group + * @param serviceName The name of the API Management service + * @param apiId API identifier. Must be unique in the current API Management service instance + * @return the next definition stage + */ + WithIfMatch withExistingApi(String resourceGroupName, String serviceName, String apiId); + } + + /** + * The stage of the apidiagnosticcontract definition allowing to specify IfMatch. + */ + interface WithIfMatch { + /** + * Specifies ifMatch. + * @param ifMatch ETag of the Entity. Not required when creating an entity, but required when updating an entity + * @return the next definition stage + */ + WithLoggerId withIfMatch(String ifMatch); + } + + /** + * The stage of the apidiagnosticcontract definition allowing to specify LoggerId. + */ + interface WithLoggerId { + /** + * Specifies loggerId. + * @param loggerId Resource Id of a target logger + * @return the next definition stage + */ + WithCreate withLoggerId(String loggerId); + } + + /** + * The stage of the apidiagnosticcontract definition allowing to specify AlwaysLog. + */ + interface WithAlwaysLog { + /** + * Specifies alwaysLog. + * @param alwaysLog Specifies for what type of messages sampling settings should not apply. Possible values include: 'allErrors' + * @return the next definition stage + */ + WithCreate withAlwaysLog(AlwaysLog alwaysLog); + } + + /** + * The stage of the apidiagnosticcontract definition allowing to specify Backend. + */ + interface WithBackend { + /** + * Specifies backend. + * @param backend Diagnostic settings for incoming/outgoing HTTP messages to the Backend + * @return the next definition stage + */ + WithCreate withBackend(PipelineDiagnosticSettings backend); + } + + /** + * The stage of the apidiagnosticcontract definition allowing to specify EnableHttpCorrelationHeaders. + */ + interface WithEnableHttpCorrelationHeaders { + /** + * Specifies enableHttpCorrelationHeaders. + * @param enableHttpCorrelationHeaders Whether to process Correlation Headers coming to Api Management Service. Only applicable to Application Insights diagnostics. Default is true + * @return the next definition stage + */ + WithCreate withEnableHttpCorrelationHeaders(Boolean enableHttpCorrelationHeaders); + } + + /** + * The stage of the apidiagnosticcontract definition allowing to specify Frontend. + */ + interface WithFrontend { + /** + * Specifies frontend. + * @param frontend Diagnostic settings for incoming/outgoing HTTP messages to the Gateway + * @return the next definition stage + */ + WithCreate withFrontend(PipelineDiagnosticSettings frontend); + } + + /** + * The stage of the apidiagnosticcontract definition allowing to specify Sampling. + */ + interface WithSampling { + /** + * Specifies sampling. + * @param sampling Sampling settings for Diagnostic + * @return the next definition stage + */ + WithCreate withSampling(SamplingSettings sampling); + } + + /** + * The stage of the definition which contains all the minimum required inputs for + * the resource to be created (via {@link WithCreate#create()}), but also allows + * for any other optional settings to be specified. + */ + interface WithCreate extends Creatable, DefinitionStages.WithAlwaysLog, DefinitionStages.WithBackend, DefinitionStages.WithEnableHttpCorrelationHeaders, DefinitionStages.WithFrontend, DefinitionStages.WithSampling { + } + } + /** + * The template for a ApiDiagnosticContract update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithIfMatch, UpdateStages.WithAlwaysLog, UpdateStages.WithBackend, UpdateStages.WithEnableHttpCorrelationHeaders, UpdateStages.WithFrontend, UpdateStages.WithSampling { + } + + /** + * Grouping of ApiDiagnosticContract update stages. + */ + interface UpdateStages { + /** + * The stage of the apidiagnosticcontract update allowing to specify IfMatch. + */ + interface WithIfMatch { + /** + * Specifies ifMatch. + * @param ifMatch ETag of the Entity. Not required when creating an entity, but required when updating an entity + * @return the next update stage + */ + Update withIfMatch(String ifMatch); + } + + /** + * The stage of the apidiagnosticcontract update allowing to specify AlwaysLog. + */ + interface WithAlwaysLog { + /** + * Specifies alwaysLog. + * @param alwaysLog Specifies for what type of messages sampling settings should not apply. Possible values include: 'allErrors' + * @return the next update stage + */ + Update withAlwaysLog(AlwaysLog alwaysLog); + } + + /** + * The stage of the apidiagnosticcontract update allowing to specify Backend. + */ + interface WithBackend { + /** + * Specifies backend. + * @param backend Diagnostic settings for incoming/outgoing HTTP messages to the Backend + * @return the next update stage + */ + Update withBackend(PipelineDiagnosticSettings backend); + } + + /** + * The stage of the apidiagnosticcontract update allowing to specify EnableHttpCorrelationHeaders. + */ + interface WithEnableHttpCorrelationHeaders { + /** + * Specifies enableHttpCorrelationHeaders. + * @param enableHttpCorrelationHeaders Whether to process Correlation Headers coming to Api Management Service. Only applicable to Application Insights diagnostics. Default is true + * @return the next update stage + */ + Update withEnableHttpCorrelationHeaders(Boolean enableHttpCorrelationHeaders); + } + + /** + * The stage of the apidiagnosticcontract update allowing to specify Frontend. + */ + interface WithFrontend { + /** + * Specifies frontend. + * @param frontend Diagnostic settings for incoming/outgoing HTTP messages to the Gateway + * @return the next update stage + */ + Update withFrontend(PipelineDiagnosticSettings frontend); + } + + /** + * The stage of the apidiagnosticcontract update allowing to specify Sampling. + */ + interface WithSampling { + /** + * Specifies sampling. + * @param sampling Sampling settings for Diagnostic + * @return the next update stage + */ + Update withSampling(SamplingSettings sampling); + } + + } +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiDiagnosticCreateOrUpdateHeaders.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiDiagnosticCreateOrUpdateHeaders.java new file mode 100644 index 0000000000000..e1a51485cc4fa --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiDiagnosticCreateOrUpdateHeaders.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.apimanagement.v2019_01_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for CreateOrUpdate operation. + */ +public class ApiDiagnosticCreateOrUpdateHeaders { + /** + * Current entity state version. Should be treated as opaque and used to + * make conditional HTTP requests. + */ + @JsonProperty(value = "ETag") + private String eTag; + + /** + * Get current entity state version. Should be treated as opaque and used to make conditional HTTP requests. + * + * @return the eTag value + */ + public String eTag() { + return this.eTag; + } + + /** + * Set current entity state version. Should be treated as opaque and used to make conditional HTTP requests. + * + * @param eTag the eTag value to set + * @return the ApiDiagnosticCreateOrUpdateHeaders object itself. + */ + public ApiDiagnosticCreateOrUpdateHeaders withETag(String eTag) { + this.eTag = eTag; + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiDiagnosticGetEntityTagHeaders.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiDiagnosticGetEntityTagHeaders.java new file mode 100644 index 0000000000000..675ba56f54cf9 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiDiagnosticGetEntityTagHeaders.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.apimanagement.v2019_01_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for GetEntityTag operation. + */ +public class ApiDiagnosticGetEntityTagHeaders { + /** + * Current entity state version. Should be treated as opaque and used to + * make conditional HTTP requests. + */ + @JsonProperty(value = "ETag") + private String eTag; + + /** + * Get current entity state version. Should be treated as opaque and used to make conditional HTTP requests. + * + * @return the eTag value + */ + public String eTag() { + return this.eTag; + } + + /** + * Set current entity state version. Should be treated as opaque and used to make conditional HTTP requests. + * + * @param eTag the eTag value to set + * @return the ApiDiagnosticGetEntityTagHeaders object itself. + */ + public ApiDiagnosticGetEntityTagHeaders withETag(String eTag) { + this.eTag = eTag; + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiDiagnosticGetHeaders.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiDiagnosticGetHeaders.java new file mode 100644 index 0000000000000..c0281abf85668 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiDiagnosticGetHeaders.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.apimanagement.v2019_01_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for Get operation. + */ +public class ApiDiagnosticGetHeaders { + /** + * Current entity state version. Should be treated as opaque and used to + * make conditional HTTP requests. + */ + @JsonProperty(value = "ETag") + private String eTag; + + /** + * Get current entity state version. Should be treated as opaque and used to make conditional HTTP requests. + * + * @return the eTag value + */ + public String eTag() { + return this.eTag; + } + + /** + * Set current entity state version. Should be treated as opaque and used to make conditional HTTP requests. + * + * @param eTag the eTag value to set + * @return the ApiDiagnosticGetHeaders object itself. + */ + public ApiDiagnosticGetHeaders withETag(String eTag) { + this.eTag = eTag; + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiDiagnostics.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiDiagnostics.java new file mode 100644 index 0000000000000..9b238487912c8 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiDiagnostics.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.apimanagement.v2019_01_01; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import rx.Completable; +import rx.Observable; +import com.microsoft.azure.management.apimanagement.v2019_01_01.implementation.ApiDiagnosticsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing ApiDiagnostics. + */ +public interface ApiDiagnostics extends SupportsCreating, HasInner { + /** + * Gets the entity state (Etag) version of the Diagnostic for an API specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API identifier. Must be unique in the current API Management service instance. + * @param diagnosticId Diagnostic identifier. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable getEntityTagAsync(String resourceGroupName, String serviceName, String apiId, String diagnosticId); + + /** + * Gets the details of the Diagnostic for an API specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API identifier. Must be unique in the current API Management service instance. + * @param diagnosticId Diagnostic identifier. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String resourceGroupName, String serviceName, String apiId, String diagnosticId); + + /** + * Lists all diagnostics of an API. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API identifier. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByServiceAsync(final String resourceGroupName, final String serviceName, final String apiId); + + /** + * Deletes the specified Diagnostic from an API. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API identifier. Must be unique in the current API Management service instance. + * @param diagnosticId Diagnostic identifier. Must be unique in the current API Management service instance. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable deleteAsync(String resourceGroupName, String serviceName, String apiId, String diagnosticId, String ifMatch); + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiEntityBaseContract.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiEntityBaseContract.java new file mode 100644 index 0000000000000..9e571acd42853 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiEntityBaseContract.java @@ -0,0 +1,320 @@ +/** + * 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.apimanagement.v2019_01_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * API base contract details. + */ +public class ApiEntityBaseContract { + /** + * Description of the API. May include HTML formatting tags. + */ + @JsonProperty(value = "description") + private String description; + + /** + * Collection of authentication settings included into this API. + */ + @JsonProperty(value = "authenticationSettings") + private AuthenticationSettingsContract authenticationSettings; + + /** + * Protocols over which API is made available. + */ + @JsonProperty(value = "subscriptionKeyParameterNames") + private SubscriptionKeyParameterNamesContract subscriptionKeyParameterNames; + + /** + * Type of API. Possible values include: 'http', 'soap'. + */ + @JsonProperty(value = "type") + private ApiType apiType; + + /** + * Describes the Revision of the Api. If no value is provided, default + * revision 1 is created. + */ + @JsonProperty(value = "apiRevision") + private String apiRevision; + + /** + * Indicates the Version identifier of the API if the API is versioned. + */ + @JsonProperty(value = "apiVersion") + private String apiVersion; + + /** + * Indicates if API revision is current api revision. + */ + @JsonProperty(value = "isCurrent") + private Boolean isCurrent; + + /** + * Indicates if API revision is accessible via the gateway. + */ + @JsonProperty(value = "isOnline", access = JsonProperty.Access.WRITE_ONLY) + private Boolean isOnline; + + /** + * Description of the Api Revision. + */ + @JsonProperty(value = "apiRevisionDescription") + private String apiRevisionDescription; + + /** + * Description of the Api Version. + */ + @JsonProperty(value = "apiVersionDescription") + private String apiVersionDescription; + + /** + * A resource identifier for the related ApiVersionSet. + */ + @JsonProperty(value = "apiVersionSetId") + private String apiVersionSetId; + + /** + * Specifies whether an API or Product subscription is required for + * accessing the API. + */ + @JsonProperty(value = "subscriptionRequired") + private Boolean subscriptionRequired; + + /** + * Get description of the API. May include HTML formatting tags. + * + * @return the description value + */ + public String description() { + return this.description; + } + + /** + * Set description of the API. May include HTML formatting tags. + * + * @param description the description value to set + * @return the ApiEntityBaseContract object itself. + */ + public ApiEntityBaseContract withDescription(String description) { + this.description = description; + return this; + } + + /** + * Get collection of authentication settings included into this API. + * + * @return the authenticationSettings value + */ + public AuthenticationSettingsContract authenticationSettings() { + return this.authenticationSettings; + } + + /** + * Set collection of authentication settings included into this API. + * + * @param authenticationSettings the authenticationSettings value to set + * @return the ApiEntityBaseContract object itself. + */ + public ApiEntityBaseContract withAuthenticationSettings(AuthenticationSettingsContract authenticationSettings) { + this.authenticationSettings = authenticationSettings; + return this; + } + + /** + * Get protocols over which API is made available. + * + * @return the subscriptionKeyParameterNames value + */ + public SubscriptionKeyParameterNamesContract subscriptionKeyParameterNames() { + return this.subscriptionKeyParameterNames; + } + + /** + * Set protocols over which API is made available. + * + * @param subscriptionKeyParameterNames the subscriptionKeyParameterNames value to set + * @return the ApiEntityBaseContract object itself. + */ + public ApiEntityBaseContract withSubscriptionKeyParameterNames(SubscriptionKeyParameterNamesContract subscriptionKeyParameterNames) { + this.subscriptionKeyParameterNames = subscriptionKeyParameterNames; + return this; + } + + /** + * Get type of API. Possible values include: 'http', 'soap'. + * + * @return the apiType value + */ + public ApiType apiType() { + return this.apiType; + } + + /** + * Set type of API. Possible values include: 'http', 'soap'. + * + * @param apiType the apiType value to set + * @return the ApiEntityBaseContract object itself. + */ + public ApiEntityBaseContract withApiType(ApiType apiType) { + this.apiType = apiType; + return this; + } + + /** + * Get describes the Revision of the Api. If no value is provided, default revision 1 is created. + * + * @return the apiRevision value + */ + public String apiRevision() { + return this.apiRevision; + } + + /** + * Set describes the Revision of the Api. If no value is provided, default revision 1 is created. + * + * @param apiRevision the apiRevision value to set + * @return the ApiEntityBaseContract object itself. + */ + public ApiEntityBaseContract withApiRevision(String apiRevision) { + this.apiRevision = apiRevision; + return this; + } + + /** + * Get indicates the Version identifier of the API if the API is versioned. + * + * @return the apiVersion value + */ + public String apiVersion() { + return this.apiVersion; + } + + /** + * Set indicates the Version identifier of the API if the API is versioned. + * + * @param apiVersion the apiVersion value to set + * @return the ApiEntityBaseContract object itself. + */ + public ApiEntityBaseContract withApiVersion(String apiVersion) { + this.apiVersion = apiVersion; + return this; + } + + /** + * Get indicates if API revision is current api revision. + * + * @return the isCurrent value + */ + public Boolean isCurrent() { + return this.isCurrent; + } + + /** + * Set indicates if API revision is current api revision. + * + * @param isCurrent the isCurrent value to set + * @return the ApiEntityBaseContract object itself. + */ + public ApiEntityBaseContract withIsCurrent(Boolean isCurrent) { + this.isCurrent = isCurrent; + return this; + } + + /** + * Get indicates if API revision is accessible via the gateway. + * + * @return the isOnline value + */ + public Boolean isOnline() { + return this.isOnline; + } + + /** + * Get description of the Api Revision. + * + * @return the apiRevisionDescription value + */ + public String apiRevisionDescription() { + return this.apiRevisionDescription; + } + + /** + * Set description of the Api Revision. + * + * @param apiRevisionDescription the apiRevisionDescription value to set + * @return the ApiEntityBaseContract object itself. + */ + public ApiEntityBaseContract withApiRevisionDescription(String apiRevisionDescription) { + this.apiRevisionDescription = apiRevisionDescription; + return this; + } + + /** + * Get description of the Api Version. + * + * @return the apiVersionDescription value + */ + public String apiVersionDescription() { + return this.apiVersionDescription; + } + + /** + * Set description of the Api Version. + * + * @param apiVersionDescription the apiVersionDescription value to set + * @return the ApiEntityBaseContract object itself. + */ + public ApiEntityBaseContract withApiVersionDescription(String apiVersionDescription) { + this.apiVersionDescription = apiVersionDescription; + return this; + } + + /** + * Get a resource identifier for the related ApiVersionSet. + * + * @return the apiVersionSetId value + */ + public String apiVersionSetId() { + return this.apiVersionSetId; + } + + /** + * Set a resource identifier for the related ApiVersionSet. + * + * @param apiVersionSetId the apiVersionSetId value to set + * @return the ApiEntityBaseContract object itself. + */ + public ApiEntityBaseContract withApiVersionSetId(String apiVersionSetId) { + this.apiVersionSetId = apiVersionSetId; + return this; + } + + /** + * Get specifies whether an API or Product subscription is required for accessing the API. + * + * @return the subscriptionRequired value + */ + public Boolean subscriptionRequired() { + return this.subscriptionRequired; + } + + /** + * Set specifies whether an API or Product subscription is required for accessing the API. + * + * @param subscriptionRequired the subscriptionRequired value to set + * @return the ApiEntityBaseContract object itself. + */ + public ApiEntityBaseContract withSubscriptionRequired(Boolean subscriptionRequired) { + this.subscriptionRequired = subscriptionRequired; + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiExportResult.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiExportResult.java new file mode 100644 index 0000000000000..84bcb9b5c64bc --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiExportResult.java @@ -0,0 +1,35 @@ +/** + * 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.apimanagement.v2019_01_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.apimanagement.v2019_01_01.implementation.ApiManagementManager; +import com.microsoft.azure.management.apimanagement.v2019_01_01.implementation.ApiExportResultInner; + +/** + * Type representing ApiExportResult. + */ +public interface ApiExportResult extends HasInner, HasManager { + /** + * @return the exportResultFormat value. + */ + ExportResultFormat exportResultFormat(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the value value. + */ + ApiExportResultValue value(); + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiExportResultValue.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiExportResultValue.java new file mode 100644 index 0000000000000..853cc41c1ae1f --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiExportResultValue.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.apimanagement.v2019_01_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The object defining the schema of the exported Api Detail. + */ +public class ApiExportResultValue { + /** + * Link to the Storage Blob containing the result of the export operation. + * The Blob Uri is only valid for 5 minutes. + */ + @JsonProperty(value = "link") + private String link; + + /** + * Get link to the Storage Blob containing the result of the export operation. The Blob Uri is only valid for 5 minutes. + * + * @return the link value + */ + public String link() { + return this.link; + } + + /** + * Set link to the Storage Blob containing the result of the export operation. The Blob Uri is only valid for 5 minutes. + * + * @param link the link value to set + * @return the ApiExportResultValue object itself. + */ + public ApiExportResultValue withLink(String link) { + this.link = link; + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiExports.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiExports.java new file mode 100644 index 0000000000000..31357ada91e46 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiExports.java @@ -0,0 +1,31 @@ +/** + * 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.apimanagement.v2019_01_01; + +import rx.Observable; +import com.microsoft.azure.management.apimanagement.v2019_01_01.implementation.ApiExportsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing ApiExports. + */ +public interface ApiExports extends HasInner { + /** + * Gets the details of the API specified by its identifier in the format specified to the Storage Blob with SAS Key valid for 5 minutes. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @param format Format in which to export the Api Details to the Storage Blob with Sas Key valid for 5 minutes. Possible values include: 'Swagger', 'Wsdl', 'Wadl', 'Openapi' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String resourceGroupName, String serviceName, String apiId, ExportFormat format); + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiGetEntityTagHeaders.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiGetEntityTagHeaders.java new file mode 100644 index 0000000000000..763a9d5c71458 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiGetEntityTagHeaders.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.apimanagement.v2019_01_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for GetEntityTag operation. + */ +public class ApiGetEntityTagHeaders { + /** + * Current entity state version. Should be treated as opaque and used to + * make conditional HTTP requests. + */ + @JsonProperty(value = "ETag") + private String eTag; + + /** + * Get current entity state version. Should be treated as opaque and used to make conditional HTTP requests. + * + * @return the eTag value + */ + public String eTag() { + return this.eTag; + } + + /** + * Set current entity state version. Should be treated as opaque and used to make conditional HTTP requests. + * + * @param eTag the eTag value to set + * @return the ApiGetEntityTagHeaders object itself. + */ + public ApiGetEntityTagHeaders withETag(String eTag) { + this.eTag = eTag; + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiGetHeaders.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiGetHeaders.java new file mode 100644 index 0000000000000..967c535ab49d6 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiGetHeaders.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.apimanagement.v2019_01_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for Get operation. + */ +public class ApiGetHeaders { + /** + * Current entity state version. Should be treated as opaque and used to + * make conditional HTTP requests. + */ + @JsonProperty(value = "ETag") + private String eTag; + + /** + * Get current entity state version. Should be treated as opaque and used to make conditional HTTP requests. + * + * @return the eTag value + */ + public String eTag() { + return this.eTag; + } + + /** + * Set current entity state version. Should be treated as opaque and used to make conditional HTTP requests. + * + * @param eTag the eTag value to set + * @return the ApiGetHeaders object itself. + */ + public ApiGetHeaders withETag(String eTag) { + this.eTag = eTag; + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiIssueAttachmentCreateOrUpdateHeaders.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiIssueAttachmentCreateOrUpdateHeaders.java new file mode 100644 index 0000000000000..1035f9fbcd94b --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiIssueAttachmentCreateOrUpdateHeaders.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.apimanagement.v2019_01_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for CreateOrUpdate operation. + */ +public class ApiIssueAttachmentCreateOrUpdateHeaders { + /** + * Current entity state version. Should be treated as opaque and used to + * make conditional HTTP requests. + */ + @JsonProperty(value = "ETag") + private String eTag; + + /** + * Get current entity state version. Should be treated as opaque and used to make conditional HTTP requests. + * + * @return the eTag value + */ + public String eTag() { + return this.eTag; + } + + /** + * Set current entity state version. Should be treated as opaque and used to make conditional HTTP requests. + * + * @param eTag the eTag value to set + * @return the ApiIssueAttachmentCreateOrUpdateHeaders object itself. + */ + public ApiIssueAttachmentCreateOrUpdateHeaders withETag(String eTag) { + this.eTag = eTag; + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiIssueAttachmentGetEntityTagHeaders.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiIssueAttachmentGetEntityTagHeaders.java new file mode 100644 index 0000000000000..68104f4c64a94 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiIssueAttachmentGetEntityTagHeaders.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.apimanagement.v2019_01_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for GetEntityTag operation. + */ +public class ApiIssueAttachmentGetEntityTagHeaders { + /** + * Current entity state version. Should be treated as opaque and used to + * make conditional HTTP requests. + */ + @JsonProperty(value = "ETag") + private String eTag; + + /** + * Get current entity state version. Should be treated as opaque and used to make conditional HTTP requests. + * + * @return the eTag value + */ + public String eTag() { + return this.eTag; + } + + /** + * Set current entity state version. Should be treated as opaque and used to make conditional HTTP requests. + * + * @param eTag the eTag value to set + * @return the ApiIssueAttachmentGetEntityTagHeaders object itself. + */ + public ApiIssueAttachmentGetEntityTagHeaders withETag(String eTag) { + this.eTag = eTag; + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiIssueAttachmentGetHeaders.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiIssueAttachmentGetHeaders.java new file mode 100644 index 0000000000000..409cc7941ffd4 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiIssueAttachmentGetHeaders.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.apimanagement.v2019_01_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for Get operation. + */ +public class ApiIssueAttachmentGetHeaders { + /** + * Current entity state version. Should be treated as opaque and used to + * make conditional HTTP requests. + */ + @JsonProperty(value = "ETag") + private String eTag; + + /** + * Get current entity state version. Should be treated as opaque and used to make conditional HTTP requests. + * + * @return the eTag value + */ + public String eTag() { + return this.eTag; + } + + /** + * Set current entity state version. Should be treated as opaque and used to make conditional HTTP requests. + * + * @param eTag the eTag value to set + * @return the ApiIssueAttachmentGetHeaders object itself. + */ + public ApiIssueAttachmentGetHeaders withETag(String eTag) { + this.eTag = eTag; + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiIssueAttachments.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiIssueAttachments.java new file mode 100644 index 0000000000000..8ad91576a0c9a --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiIssueAttachments.java @@ -0,0 +1,73 @@ +/** + * 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.apimanagement.v2019_01_01; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import rx.Completable; +import rx.Observable; +import com.microsoft.azure.management.apimanagement.v2019_01_01.implementation.ApiIssueAttachmentsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing ApiIssueAttachments. + */ +public interface ApiIssueAttachments extends SupportsCreating, HasInner { + /** + * Gets the entity state (Etag) version of the issue Attachment for an API specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API identifier. Must be unique in the current API Management service instance. + * @param issueId Issue identifier. Must be unique in the current API Management service instance. + * @param attachmentId Attachment identifier within an Issue. Must be unique in the current Issue. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable getEntityTagAsync(String resourceGroupName, String serviceName, String apiId, String issueId, String attachmentId); + + /** + * Gets the details of the issue Attachment for an API specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API identifier. Must be unique in the current API Management service instance. + * @param issueId Issue identifier. Must be unique in the current API Management service instance. + * @param attachmentId Attachment identifier within an Issue. Must be unique in the current Issue. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String resourceGroupName, String serviceName, String apiId, String issueId, String attachmentId); + + /** + * Lists all attachments for the Issue associated with the specified API. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API identifier. Must be unique in the current API Management service instance. + * @param issueId Issue identifier. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByServiceAsync(final String resourceGroupName, final String serviceName, final String apiId, final String issueId); + + /** + * Deletes the specified comment from an Issue. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API identifier. Must be unique in the current API Management service instance. + * @param issueId Issue identifier. Must be unique in the current API Management service instance. + * @param attachmentId Attachment identifier within an Issue. Must be unique in the current Issue. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable deleteAsync(String resourceGroupName, String serviceName, String apiId, String issueId, String attachmentId, String ifMatch); + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiIssueCommentCreateOrUpdateHeaders.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiIssueCommentCreateOrUpdateHeaders.java new file mode 100644 index 0000000000000..4d05cc922c27e --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiIssueCommentCreateOrUpdateHeaders.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.apimanagement.v2019_01_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for CreateOrUpdate operation. + */ +public class ApiIssueCommentCreateOrUpdateHeaders { + /** + * Current entity state version. Should be treated as opaque and used to + * make conditional HTTP requests. + */ + @JsonProperty(value = "ETag") + private String eTag; + + /** + * Get current entity state version. Should be treated as opaque and used to make conditional HTTP requests. + * + * @return the eTag value + */ + public String eTag() { + return this.eTag; + } + + /** + * Set current entity state version. Should be treated as opaque and used to make conditional HTTP requests. + * + * @param eTag the eTag value to set + * @return the ApiIssueCommentCreateOrUpdateHeaders object itself. + */ + public ApiIssueCommentCreateOrUpdateHeaders withETag(String eTag) { + this.eTag = eTag; + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiIssueCommentGetEntityTagHeaders.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiIssueCommentGetEntityTagHeaders.java new file mode 100644 index 0000000000000..e177ee30765d8 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiIssueCommentGetEntityTagHeaders.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.apimanagement.v2019_01_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for GetEntityTag operation. + */ +public class ApiIssueCommentGetEntityTagHeaders { + /** + * Current entity state version. Should be treated as opaque and used to + * make conditional HTTP requests. + */ + @JsonProperty(value = "ETag") + private String eTag; + + /** + * Get current entity state version. Should be treated as opaque and used to make conditional HTTP requests. + * + * @return the eTag value + */ + public String eTag() { + return this.eTag; + } + + /** + * Set current entity state version. Should be treated as opaque and used to make conditional HTTP requests. + * + * @param eTag the eTag value to set + * @return the ApiIssueCommentGetEntityTagHeaders object itself. + */ + public ApiIssueCommentGetEntityTagHeaders withETag(String eTag) { + this.eTag = eTag; + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiIssueCommentGetHeaders.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiIssueCommentGetHeaders.java new file mode 100644 index 0000000000000..b8cac8bfd4b8d --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiIssueCommentGetHeaders.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.apimanagement.v2019_01_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for Get operation. + */ +public class ApiIssueCommentGetHeaders { + /** + * Current entity state version. Should be treated as opaque and used to + * make conditional HTTP requests. + */ + @JsonProperty(value = "ETag") + private String eTag; + + /** + * Get current entity state version. Should be treated as opaque and used to make conditional HTTP requests. + * + * @return the eTag value + */ + public String eTag() { + return this.eTag; + } + + /** + * Set current entity state version. Should be treated as opaque and used to make conditional HTTP requests. + * + * @param eTag the eTag value to set + * @return the ApiIssueCommentGetHeaders object itself. + */ + public ApiIssueCommentGetHeaders withETag(String eTag) { + this.eTag = eTag; + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiIssueComments.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiIssueComments.java new file mode 100644 index 0000000000000..3e3818aecd82d --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiIssueComments.java @@ -0,0 +1,73 @@ +/** + * 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.apimanagement.v2019_01_01; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import rx.Completable; +import rx.Observable; +import com.microsoft.azure.management.apimanagement.v2019_01_01.implementation.ApiIssueCommentsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing ApiIssueComments. + */ +public interface ApiIssueComments extends SupportsCreating, HasInner { + /** + * Gets the entity state (Etag) version of the issue Comment for an API specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API identifier. Must be unique in the current API Management service instance. + * @param issueId Issue identifier. Must be unique in the current API Management service instance. + * @param commentId Comment identifier within an Issue. Must be unique in the current Issue. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable getEntityTagAsync(String resourceGroupName, String serviceName, String apiId, String issueId, String commentId); + + /** + * Gets the details of the issue Comment for an API specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API identifier. Must be unique in the current API Management service instance. + * @param issueId Issue identifier. Must be unique in the current API Management service instance. + * @param commentId Comment identifier within an Issue. Must be unique in the current Issue. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String resourceGroupName, String serviceName, String apiId, String issueId, String commentId); + + /** + * Lists all comments for the Issue associated with the specified API. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API identifier. Must be unique in the current API Management service instance. + * @param issueId Issue identifier. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByServiceAsync(final String resourceGroupName, final String serviceName, final String apiId, final String issueId); + + /** + * Deletes the specified comment from an Issue. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API identifier. Must be unique in the current API Management service instance. + * @param issueId Issue identifier. Must be unique in the current API Management service instance. + * @param commentId Comment identifier within an Issue. Must be unique in the current Issue. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable deleteAsync(String resourceGroupName, String serviceName, String apiId, String issueId, String commentId, String ifMatch); + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiIssueCreateOrUpdateHeaders.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiIssueCreateOrUpdateHeaders.java new file mode 100644 index 0000000000000..aaa4a78a720ca --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiIssueCreateOrUpdateHeaders.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.apimanagement.v2019_01_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for CreateOrUpdate operation. + */ +public class ApiIssueCreateOrUpdateHeaders { + /** + * Current entity state version. Should be treated as opaque and used to + * make conditional HTTP requests. + */ + @JsonProperty(value = "ETag") + private String eTag; + + /** + * Get current entity state version. Should be treated as opaque and used to make conditional HTTP requests. + * + * @return the eTag value + */ + public String eTag() { + return this.eTag; + } + + /** + * Set current entity state version. Should be treated as opaque and used to make conditional HTTP requests. + * + * @param eTag the eTag value to set + * @return the ApiIssueCreateOrUpdateHeaders object itself. + */ + public ApiIssueCreateOrUpdateHeaders withETag(String eTag) { + this.eTag = eTag; + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiIssueGetEntityTagHeaders.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiIssueGetEntityTagHeaders.java new file mode 100644 index 0000000000000..76db9713efc66 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiIssueGetEntityTagHeaders.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.apimanagement.v2019_01_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for GetEntityTag operation. + */ +public class ApiIssueGetEntityTagHeaders { + /** + * Current entity state version. Should be treated as opaque and used to + * make conditional HTTP requests. + */ + @JsonProperty(value = "ETag") + private String eTag; + + /** + * Get current entity state version. Should be treated as opaque and used to make conditional HTTP requests. + * + * @return the eTag value + */ + public String eTag() { + return this.eTag; + } + + /** + * Set current entity state version. Should be treated as opaque and used to make conditional HTTP requests. + * + * @param eTag the eTag value to set + * @return the ApiIssueGetEntityTagHeaders object itself. + */ + public ApiIssueGetEntityTagHeaders withETag(String eTag) { + this.eTag = eTag; + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiIssueGetHeaders.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiIssueGetHeaders.java new file mode 100644 index 0000000000000..a5adff62d62c2 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiIssueGetHeaders.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.apimanagement.v2019_01_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for Get operation. + */ +public class ApiIssueGetHeaders { + /** + * Current entity state version. Should be treated as opaque and used to + * make conditional HTTP requests. + */ + @JsonProperty(value = "ETag") + private String eTag; + + /** + * Get current entity state version. Should be treated as opaque and used to make conditional HTTP requests. + * + * @return the eTag value + */ + public String eTag() { + return this.eTag; + } + + /** + * Set current entity state version. Should be treated as opaque and used to make conditional HTTP requests. + * + * @param eTag the eTag value to set + * @return the ApiIssueGetHeaders object itself. + */ + public ApiIssueGetHeaders withETag(String eTag) { + this.eTag = eTag; + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiIssues.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiIssues.java new file mode 100644 index 0000000000000..763864abb23aa --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiIssues.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.apimanagement.v2019_01_01; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import rx.Completable; +import rx.Observable; +import com.microsoft.azure.management.apimanagement.v2019_01_01.implementation.ApiIssuesInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing ApiIssues. + */ +public interface ApiIssues extends SupportsCreating, HasInner { + /** + * Gets the entity state (Etag) version of the Issue for an API specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API identifier. Must be unique in the current API Management service instance. + * @param issueId Issue identifier. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable getEntityTagAsync(String resourceGroupName, String serviceName, String apiId, String issueId); + + /** + * Gets the details of the Issue for an API specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API identifier. Must be unique in the current API Management service instance. + * @param issueId Issue identifier. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String resourceGroupName, String serviceName, String apiId, String issueId); + + /** + * Lists all issues associated with the specified API. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API identifier. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByServiceAsync(final String resourceGroupName, final String serviceName, final String apiId); + + /** + * Deletes the specified Issue from an API. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API identifier. Must be unique in the current API Management service instance. + * @param issueId Issue identifier. Must be unique in the current API Management service instance. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable deleteAsync(String resourceGroupName, String serviceName, String apiId, String issueId, String ifMatch); + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiManagementOperations.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiManagementOperations.java new file mode 100644 index 0000000000000..71c718818788d --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiManagementOperations.java @@ -0,0 +1,27 @@ +/** + * 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.apimanagement.v2019_01_01; + +import rx.Observable; +import com.microsoft.azure.management.apimanagement.v2019_01_01.implementation.ApiManagementOperationsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing ApiManagementOperations. + */ +public interface ApiManagementOperations extends HasInner { + /** + * Lists all of the available REST API operations of the Microsoft.ApiManagement provider. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listAsync(); + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiManagementServiceApplyNetworkConfigurationParameters.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiManagementServiceApplyNetworkConfigurationParameters.java new file mode 100644 index 0000000000000..2b0775de386a4 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiManagementServiceApplyNetworkConfigurationParameters.java @@ -0,0 +1,45 @@ +/** + * 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.apimanagement.v2019_01_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Parameter supplied to the Apply Network configuration operation. + */ +public class ApiManagementServiceApplyNetworkConfigurationParameters { + /** + * Location of the Api Management service to update for a multi-region + * service. For a service deployed in a single region, this parameter is + * not required. + */ + @JsonProperty(value = "location") + private String location; + + /** + * Get location of the Api Management service to update for a multi-region service. For a service deployed in a single region, this parameter is not required. + * + * @return the location value + */ + public String location() { + return this.location; + } + + /** + * Set location of the Api Management service to update for a multi-region service. For a service deployed in a single region, this parameter is not required. + * + * @param location the location value to set + * @return the ApiManagementServiceApplyNetworkConfigurationParameters object itself. + */ + public ApiManagementServiceApplyNetworkConfigurationParameters withLocation(String location) { + this.location = location; + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiManagementServiceBackupRestoreParameters.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiManagementServiceBackupRestoreParameters.java new file mode 100644 index 0000000000000..44e371c49cd2b --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiManagementServiceBackupRestoreParameters.java @@ -0,0 +1,124 @@ +/** + * 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.apimanagement.v2019_01_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Parameters supplied to the Backup/Restore of an API Management service + * operation. + */ +public class ApiManagementServiceBackupRestoreParameters { + /** + * Azure Cloud Storage account (used to place/retrieve the backup) name. + */ + @JsonProperty(value = "storageAccount", required = true) + private String storageAccount; + + /** + * Azure Cloud Storage account (used to place/retrieve the backup) access + * key. + */ + @JsonProperty(value = "accessKey", required = true) + private String accessKey; + + /** + * Azure Cloud Storage blob container name used to place/retrieve the + * backup. + */ + @JsonProperty(value = "containerName", required = true) + private String containerName; + + /** + * The name of the backup file to create. + */ + @JsonProperty(value = "backupName", required = true) + private String backupName; + + /** + * Get azure Cloud Storage account (used to place/retrieve the backup) name. + * + * @return the storageAccount value + */ + public String storageAccount() { + return this.storageAccount; + } + + /** + * Set azure Cloud Storage account (used to place/retrieve the backup) name. + * + * @param storageAccount the storageAccount value to set + * @return the ApiManagementServiceBackupRestoreParameters object itself. + */ + public ApiManagementServiceBackupRestoreParameters withStorageAccount(String storageAccount) { + this.storageAccount = storageAccount; + return this; + } + + /** + * Get azure Cloud Storage account (used to place/retrieve the backup) access key. + * + * @return the accessKey value + */ + public String accessKey() { + return this.accessKey; + } + + /** + * Set azure Cloud Storage account (used to place/retrieve the backup) access key. + * + * @param accessKey the accessKey value to set + * @return the ApiManagementServiceBackupRestoreParameters object itself. + */ + public ApiManagementServiceBackupRestoreParameters withAccessKey(String accessKey) { + this.accessKey = accessKey; + return this; + } + + /** + * Get azure Cloud Storage blob container name used to place/retrieve the backup. + * + * @return the containerName value + */ + public String containerName() { + return this.containerName; + } + + /** + * Set azure Cloud Storage blob container name used to place/retrieve the backup. + * + * @param containerName the containerName value to set + * @return the ApiManagementServiceBackupRestoreParameters object itself. + */ + public ApiManagementServiceBackupRestoreParameters withContainerName(String containerName) { + this.containerName = containerName; + return this; + } + + /** + * Get the name of the backup file to create. + * + * @return the backupName value + */ + public String backupName() { + return this.backupName; + } + + /** + * Set the name of the backup file to create. + * + * @param backupName the backupName value to set + * @return the ApiManagementServiceBackupRestoreParameters object itself. + */ + public ApiManagementServiceBackupRestoreParameters withBackupName(String backupName) { + this.backupName = backupName; + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiManagementServiceBaseProperties.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiManagementServiceBaseProperties.java new file mode 100644 index 0000000000000..16e5910230083 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiManagementServiceBaseProperties.java @@ -0,0 +1,403 @@ +/** + * 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.apimanagement.v2019_01_01; + +import org.joda.time.DateTime; +import java.util.List; +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Base Properties of an API Management service resource description. + */ +public class ApiManagementServiceBaseProperties { + /** + * Email address from which the notification will be sent. + */ + @JsonProperty(value = "notificationSenderEmail") + private String notificationSenderEmail; + + /** + * The current provisioning state of the API Management service which can + * be one of the following: + * Created/Activating/Succeeded/Updating/Failed/Stopped/Terminating/TerminationFailed/Deleted. + */ + @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private String provisioningState; + + /** + * The provisioning state of the API Management service, which is targeted + * by the long running operation started on the service. + */ + @JsonProperty(value = "targetProvisioningState", access = JsonProperty.Access.WRITE_ONLY) + private String targetProvisioningState; + + /** + * Creation UTC date of the API Management service.The date conforms to the + * following format: `yyyy-MM-ddTHH:mm:ssZ` as specified by the ISO 8601 + * standard. + */ + @JsonProperty(value = "createdAtUtc", access = JsonProperty.Access.WRITE_ONLY) + private DateTime createdAtUtc; + + /** + * Gateway URL of the API Management service. + */ + @JsonProperty(value = "gatewayUrl", access = JsonProperty.Access.WRITE_ONLY) + private String gatewayUrl; + + /** + * Gateway URL of the API Management service in the Default Region. + */ + @JsonProperty(value = "gatewayRegionalUrl", access = JsonProperty.Access.WRITE_ONLY) + private String gatewayRegionalUrl; + + /** + * Publisher portal endpoint Url of the API Management service. + */ + @JsonProperty(value = "portalUrl", access = JsonProperty.Access.WRITE_ONLY) + private String portalUrl; + + /** + * Management API endpoint URL of the API Management service. + */ + @JsonProperty(value = "managementApiUrl", access = JsonProperty.Access.WRITE_ONLY) + private String managementApiUrl; + + /** + * SCM endpoint URL of the API Management service. + */ + @JsonProperty(value = "scmUrl", access = JsonProperty.Access.WRITE_ONLY) + private String scmUrl; + + /** + * Custom hostname configuration of the API Management service. + */ + @JsonProperty(value = "hostnameConfigurations") + private List hostnameConfigurations; + + /** + * Public Static Load Balanced IP addresses of the API Management service + * in Primary region. Available only for Basic, Standard and Premium SKU. + */ + @JsonProperty(value = "publicIPAddresses", access = JsonProperty.Access.WRITE_ONLY) + private List publicIPAddresses; + + /** + * Private Static Load Balanced IP addresses of the API Management service + * in Primary region which is deployed in an Internal Virtual Network. + * Available only for Basic, Standard and Premium SKU. + */ + @JsonProperty(value = "privateIPAddresses", access = JsonProperty.Access.WRITE_ONLY) + private List privateIPAddresses; + + /** + * Virtual network configuration of the API Management service. + */ + @JsonProperty(value = "virtualNetworkConfiguration") + private VirtualNetworkConfiguration virtualNetworkConfiguration; + + /** + * Additional datacenter locations of the API Management service. + */ + @JsonProperty(value = "additionalLocations") + private List additionalLocations; + + /** + * Custom properties of the API Management service. Setting + * `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TripleDes168` + * will disable the cipher TLS_RSA_WITH_3DES_EDE_CBC_SHA for all TLS(1.0, + * 1.1 and 1.2). Setting + * `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Tls11` + * can be used to disable just TLS 1.1 and setting + * `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Tls10` + * can be used to disable TLS 1.0 on an API Management service. + */ + @JsonProperty(value = "customProperties") + private Map customProperties; + + /** + * List of Certificates that need to be installed in the API Management + * service. Max supported certificates that can be installed is 10. + */ + @JsonProperty(value = "certificates") + private List certificates; + + /** + * Property only meant to be used for Consumption SKU Service. This + * enforces a client certificate to be presented on each request to the + * gateway. This also enables the ability to authenticate the certificate + * in the policy on the gateway. + */ + @JsonProperty(value = "enableClientCertificate") + private Boolean enableClientCertificate; + + /** + * The type of VPN in which API Management service needs to be configured + * in. None (Default Value) means the API Management service is not part of + * any Virtual Network, External means the API Management deployment is set + * up inside a Virtual Network having an Internet Facing Endpoint, and + * Internal means that API Management deployment is setup inside a Virtual + * Network having an Intranet Facing Endpoint only. Possible values + * include: 'None', 'External', 'Internal'. + */ + @JsonProperty(value = "virtualNetworkType") + private VirtualNetworkType virtualNetworkType; + + /** + * Get email address from which the notification will be sent. + * + * @return the notificationSenderEmail value + */ + public String notificationSenderEmail() { + return this.notificationSenderEmail; + } + + /** + * Set email address from which the notification will be sent. + * + * @param notificationSenderEmail the notificationSenderEmail value to set + * @return the ApiManagementServiceBaseProperties object itself. + */ + public ApiManagementServiceBaseProperties withNotificationSenderEmail(String notificationSenderEmail) { + this.notificationSenderEmail = notificationSenderEmail; + return this; + } + + /** + * Get the current provisioning state of the API Management service which can be one of the following: Created/Activating/Succeeded/Updating/Failed/Stopped/Terminating/TerminationFailed/Deleted. + * + * @return the provisioningState value + */ + public String provisioningState() { + return this.provisioningState; + } + + /** + * Get the provisioning state of the API Management service, which is targeted by the long running operation started on the service. + * + * @return the targetProvisioningState value + */ + public String targetProvisioningState() { + return this.targetProvisioningState; + } + + /** + * Get creation UTC date of the API Management service.The date conforms to the following format: `yyyy-MM-ddTHH:mm:ssZ` as specified by the ISO 8601 standard. + * + * @return the createdAtUtc value + */ + public DateTime createdAtUtc() { + return this.createdAtUtc; + } + + /** + * Get gateway URL of the API Management service. + * + * @return the gatewayUrl value + */ + public String gatewayUrl() { + return this.gatewayUrl; + } + + /** + * Get gateway URL of the API Management service in the Default Region. + * + * @return the gatewayRegionalUrl value + */ + public String gatewayRegionalUrl() { + return this.gatewayRegionalUrl; + } + + /** + * Get publisher portal endpoint Url of the API Management service. + * + * @return the portalUrl value + */ + public String portalUrl() { + return this.portalUrl; + } + + /** + * Get management API endpoint URL of the API Management service. + * + * @return the managementApiUrl value + */ + public String managementApiUrl() { + return this.managementApiUrl; + } + + /** + * Get sCM endpoint URL of the API Management service. + * + * @return the scmUrl value + */ + public String scmUrl() { + return this.scmUrl; + } + + /** + * Get custom hostname configuration of the API Management service. + * + * @return the hostnameConfigurations value + */ + public List hostnameConfigurations() { + return this.hostnameConfigurations; + } + + /** + * Set custom hostname configuration of the API Management service. + * + * @param hostnameConfigurations the hostnameConfigurations value to set + * @return the ApiManagementServiceBaseProperties object itself. + */ + public ApiManagementServiceBaseProperties withHostnameConfigurations(List hostnameConfigurations) { + this.hostnameConfigurations = hostnameConfigurations; + return this; + } + + /** + * Get public Static Load Balanced IP addresses of the API Management service in Primary region. Available only for Basic, Standard and Premium SKU. + * + * @return the publicIPAddresses value + */ + public List publicIPAddresses() { + return this.publicIPAddresses; + } + + /** + * Get private Static Load Balanced IP addresses of the API Management service in Primary region which is deployed in an Internal Virtual Network. Available only for Basic, Standard and Premium SKU. + * + * @return the privateIPAddresses value + */ + public List privateIPAddresses() { + return this.privateIPAddresses; + } + + /** + * Get virtual network configuration of the API Management service. + * + * @return the virtualNetworkConfiguration value + */ + public VirtualNetworkConfiguration virtualNetworkConfiguration() { + return this.virtualNetworkConfiguration; + } + + /** + * Set virtual network configuration of the API Management service. + * + * @param virtualNetworkConfiguration the virtualNetworkConfiguration value to set + * @return the ApiManagementServiceBaseProperties object itself. + */ + public ApiManagementServiceBaseProperties withVirtualNetworkConfiguration(VirtualNetworkConfiguration virtualNetworkConfiguration) { + this.virtualNetworkConfiguration = virtualNetworkConfiguration; + return this; + } + + /** + * Get additional datacenter locations of the API Management service. + * + * @return the additionalLocations value + */ + public List additionalLocations() { + return this.additionalLocations; + } + + /** + * Set additional datacenter locations of the API Management service. + * + * @param additionalLocations the additionalLocations value to set + * @return the ApiManagementServiceBaseProperties object itself. + */ + public ApiManagementServiceBaseProperties withAdditionalLocations(List additionalLocations) { + this.additionalLocations = additionalLocations; + return this; + } + + /** + * Get custom properties of the API Management service. Setting `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TripleDes168` will disable the cipher TLS_RSA_WITH_3DES_EDE_CBC_SHA for all TLS(1.0, 1.1 and 1.2). Setting `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Tls11` can be used to disable just TLS 1.1 and setting `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Tls10` can be used to disable TLS 1.0 on an API Management service. + * + * @return the customProperties value + */ + public Map customProperties() { + return this.customProperties; + } + + /** + * Set custom properties of the API Management service. Setting `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TripleDes168` will disable the cipher TLS_RSA_WITH_3DES_EDE_CBC_SHA for all TLS(1.0, 1.1 and 1.2). Setting `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Tls11` can be used to disable just TLS 1.1 and setting `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Tls10` can be used to disable TLS 1.0 on an API Management service. + * + * @param customProperties the customProperties value to set + * @return the ApiManagementServiceBaseProperties object itself. + */ + public ApiManagementServiceBaseProperties withCustomProperties(Map customProperties) { + this.customProperties = customProperties; + return this; + } + + /** + * Get list of Certificates that need to be installed in the API Management service. Max supported certificates that can be installed is 10. + * + * @return the certificates value + */ + public List certificates() { + return this.certificates; + } + + /** + * Set list of Certificates that need to be installed in the API Management service. Max supported certificates that can be installed is 10. + * + * @param certificates the certificates value to set + * @return the ApiManagementServiceBaseProperties object itself. + */ + public ApiManagementServiceBaseProperties withCertificates(List certificates) { + this.certificates = certificates; + return this; + } + + /** + * Get property only meant to be used for Consumption SKU Service. This enforces a client certificate to be presented on each request to the gateway. This also enables the ability to authenticate the certificate in the policy on the gateway. + * + * @return the enableClientCertificate value + */ + public Boolean enableClientCertificate() { + return this.enableClientCertificate; + } + + /** + * Set property only meant to be used for Consumption SKU Service. This enforces a client certificate to be presented on each request to the gateway. This also enables the ability to authenticate the certificate in the policy on the gateway. + * + * @param enableClientCertificate the enableClientCertificate value to set + * @return the ApiManagementServiceBaseProperties object itself. + */ + public ApiManagementServiceBaseProperties withEnableClientCertificate(Boolean enableClientCertificate) { + this.enableClientCertificate = enableClientCertificate; + return this; + } + + /** + * Get the type of VPN in which API Management service needs to be configured in. None (Default Value) means the API Management service is not part of any Virtual Network, External means the API Management deployment is set up inside a Virtual Network having an Internet Facing Endpoint, and Internal means that API Management deployment is setup inside a Virtual Network having an Intranet Facing Endpoint only. Possible values include: 'None', 'External', 'Internal'. + * + * @return the virtualNetworkType value + */ + public VirtualNetworkType virtualNetworkType() { + return this.virtualNetworkType; + } + + /** + * Set the type of VPN in which API Management service needs to be configured in. None (Default Value) means the API Management service is not part of any Virtual Network, External means the API Management deployment is set up inside a Virtual Network having an Internet Facing Endpoint, and Internal means that API Management deployment is setup inside a Virtual Network having an Intranet Facing Endpoint only. Possible values include: 'None', 'External', 'Internal'. + * + * @param virtualNetworkType the virtualNetworkType value to set + * @return the ApiManagementServiceBaseProperties object itself. + */ + public ApiManagementServiceBaseProperties withVirtualNetworkType(VirtualNetworkType virtualNetworkType) { + this.virtualNetworkType = virtualNetworkType; + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiManagementServiceCheckNameAvailabilityParameters.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiManagementServiceCheckNameAvailabilityParameters.java new file mode 100644 index 0000000000000..9d888d98d5367 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiManagementServiceCheckNameAvailabilityParameters.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.apimanagement.v2019_01_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Parameters supplied to the CheckNameAvailability operation. + */ +public class ApiManagementServiceCheckNameAvailabilityParameters { + /** + * The name to check for availability. + */ + @JsonProperty(value = "name", required = true) + private String name; + + /** + * 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 ApiManagementServiceCheckNameAvailabilityParameters object itself. + */ + public ApiManagementServiceCheckNameAvailabilityParameters withName(String name) { + this.name = name; + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiManagementServiceGetSsoTokenResult.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiManagementServiceGetSsoTokenResult.java new file mode 100644 index 0000000000000..fbd7db53b7661 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiManagementServiceGetSsoTokenResult.java @@ -0,0 +1,25 @@ +/** + * 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.apimanagement.v2019_01_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.apimanagement.v2019_01_01.implementation.ApiManagementManager; +import com.microsoft.azure.management.apimanagement.v2019_01_01.implementation.ApiManagementServiceGetSsoTokenResultInner; + +/** + * Type representing ApiManagementServiceGetSsoTokenResult. + */ +public interface ApiManagementServiceGetSsoTokenResult extends HasInner, HasManager { + /** + * @return the redirectUri value. + */ + String redirectUri(); + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiManagementServiceIdentity.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiManagementServiceIdentity.java new file mode 100644 index 0000000000000..a1d039ec7cd6b --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiManagementServiceIdentity.java @@ -0,0 +1,82 @@ +/** + * 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.apimanagement.v2019_01_01; + +import java.util.UUID; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Identity properties of the Api Management service resource. + */ +public class ApiManagementServiceIdentity { + /** + * The identity type. Currently the only supported type is + * 'SystemAssigned'. + */ + @JsonProperty(value = "type", required = true) + private String type; + + /** + * The principal id of the identity. + */ + @JsonProperty(value = "principalId", access = JsonProperty.Access.WRITE_ONLY) + private UUID principalId; + + /** + * The client tenant id of the identity. + */ + @JsonProperty(value = "tenantId", access = JsonProperty.Access.WRITE_ONLY) + private UUID tenantId; + + /** + * Creates an instance of ApiManagementServiceIdentity class. + */ + public ApiManagementServiceIdentity() { + type = "SystemAssigned"; + } + + /** + * Get the identity type. Currently the only supported type is 'SystemAssigned'. + * + * @return the type value + */ + public String type() { + return this.type; + } + + /** + * Set the identity type. Currently the only supported type is 'SystemAssigned'. + * + * @param type the type value to set + * @return the ApiManagementServiceIdentity object itself. + */ + public ApiManagementServiceIdentity withType(String type) { + this.type = type; + return this; + } + + /** + * Get the principal id of the identity. + * + * @return the principalId value + */ + public UUID principalId() { + return this.principalId; + } + + /** + * Get the client tenant id of the identity. + * + * @return the tenantId value + */ + public UUID tenantId() { + return this.tenantId; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiManagementServiceNameAvailabilityResult.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiManagementServiceNameAvailabilityResult.java new file mode 100644 index 0000000000000..af0e3881bbe03 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiManagementServiceNameAvailabilityResult.java @@ -0,0 +1,35 @@ +/** + * 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.apimanagement.v2019_01_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.apimanagement.v2019_01_01.implementation.ApiManagementManager; +import com.microsoft.azure.management.apimanagement.v2019_01_01.implementation.ApiManagementServiceNameAvailabilityResultInner; + +/** + * Type representing ApiManagementServiceNameAvailabilityResult. + */ +public interface ApiManagementServiceNameAvailabilityResult extends HasInner, HasManager { + /** + * @return the message value. + */ + String message(); + + /** + * @return the nameAvailable value. + */ + Boolean nameAvailable(); + + /** + * @return the reason value. + */ + NameAvailabilityReason reason(); + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiManagementServiceResource.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiManagementServiceResource.java new file mode 100644 index 0000000000000..a89107bf4b009 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiManagementServiceResource.java @@ -0,0 +1,163 @@ +/** + * 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.apimanagement.v2019_01_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.apimanagement.v2019_01_01.implementation.ApiManagementManager; +import com.microsoft.azure.management.apimanagement.v2019_01_01.implementation.ApiManagementServiceResourceInner; +import java.util.List; +import org.joda.time.DateTime; +import java.util.Map; + +/** + * Type representing ApiManagementServiceResource. + */ +public interface ApiManagementServiceResource extends HasInner, HasManager { + /** + * @return the additionalLocations value. + */ + List additionalLocations(); + + /** + * @return the certificates value. + */ + List certificates(); + + /** + * @return the createdAtUtc value. + */ + DateTime createdAtUtc(); + + /** + * @return the customProperties value. + */ + Map customProperties(); + + /** + * @return the enableClientCertificate value. + */ + Boolean enableClientCertificate(); + + /** + * @return the etag value. + */ + String etag(); + + /** + * @return the gatewayRegionalUrl value. + */ + String gatewayRegionalUrl(); + + /** + * @return the gatewayUrl value. + */ + String gatewayUrl(); + + /** + * @return the hostnameConfigurations value. + */ + List hostnameConfigurations(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the identity value. + */ + ApiManagementServiceIdentity identity(); + + /** + * @return the location value. + */ + String location(); + + /** + * @return the managementApiUrl value. + */ + String managementApiUrl(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the notificationSenderEmail value. + */ + String notificationSenderEmail(); + + /** + * @return the portalUrl value. + */ + String portalUrl(); + + /** + * @return the privateIPAddresses value. + */ + List privateIPAddresses(); + + /** + * @return the provisioningState value. + */ + String provisioningState(); + + /** + * @return the publicIPAddresses value. + */ + List publicIPAddresses(); + + /** + * @return the publisherEmail value. + */ + String publisherEmail(); + + /** + * @return the publisherName value. + */ + String publisherName(); + + /** + * @return the scmUrl value. + */ + String scmUrl(); + + /** + * @return the sku value. + */ + ApiManagementServiceSkuProperties sku(); + + /** + * @return the tags value. + */ + Map tags(); + + /** + * @return the targetProvisioningState value. + */ + String targetProvisioningState(); + + /** + * @return the type value. + */ + String type(); + + /** + * @return the virtualNetworkConfiguration value. + */ + VirtualNetworkConfiguration virtualNetworkConfiguration(); + + /** + * @return the virtualNetworkType value. + */ + VirtualNetworkType virtualNetworkType(); + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiManagementServiceSkuProperties.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiManagementServiceSkuProperties.java new file mode 100644 index 0000000000000..296ac8fcb8301 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiManagementServiceSkuProperties.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.apimanagement.v2019_01_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * API Management service resource SKU properties. + */ +public class ApiManagementServiceSkuProperties { + /** + * Name of the Sku. Possible values include: 'Developer', 'Standard', + * 'Premium', 'Basic', 'Consumption'. + */ + @JsonProperty(value = "name", required = true) + private SkuType name; + + /** + * Capacity of the SKU (number of deployed units of the SKU). + */ + @JsonProperty(value = "capacity") + private Integer capacity; + + /** + * Get name of the Sku. Possible values include: 'Developer', 'Standard', 'Premium', 'Basic', 'Consumption'. + * + * @return the name value + */ + public SkuType name() { + return this.name; + } + + /** + * Set name of the Sku. Possible values include: 'Developer', 'Standard', 'Premium', 'Basic', 'Consumption'. + * + * @param name the name value to set + * @return the ApiManagementServiceSkuProperties object itself. + */ + public ApiManagementServiceSkuProperties withName(SkuType name) { + this.name = name; + return this; + } + + /** + * Get capacity of the SKU (number of deployed units of the SKU). + * + * @return the capacity value + */ + public Integer capacity() { + return this.capacity; + } + + /** + * Set capacity of the SKU (number of deployed units of the SKU). + * + * @param capacity the capacity value to set + * @return the ApiManagementServiceSkuProperties object itself. + */ + public ApiManagementServiceSkuProperties withCapacity(Integer capacity) { + this.capacity = capacity; + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiManagementServiceSkus.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiManagementServiceSkus.java new file mode 100644 index 0000000000000..691800183c225 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiManagementServiceSkus.java @@ -0,0 +1,30 @@ +/** + * 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.apimanagement.v2019_01_01; + +import rx.Observable; +import com.microsoft.azure.management.apimanagement.v2019_01_01.implementation.ApiManagementServiceSkusInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing ApiManagementServiceSkus. + */ +public interface ApiManagementServiceSkus extends HasInner { + /** + * Gets available SKUs for API Management service. + * Gets all available SKU for a given API Management service. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listAvailableServiceSkusAsync(final String resourceGroupName, final String serviceName); + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiManagementServiceUpdateParameters.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiManagementServiceUpdateParameters.java new file mode 100644 index 0000000000000..e7e342d2943fc --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiManagementServiceUpdateParameters.java @@ -0,0 +1,524 @@ +/** + * 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.apimanagement.v2019_01_01; + +import org.joda.time.DateTime; +import java.util.List; +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; + +/** + * Parameter supplied to Update Api Management Service. + */ +@JsonFlatten +public class ApiManagementServiceUpdateParameters extends ApimResource { + /** + * Email address from which the notification will be sent. + */ + @JsonProperty(value = "properties.notificationSenderEmail") + private String notificationSenderEmail; + + /** + * The current provisioning state of the API Management service which can + * be one of the following: + * Created/Activating/Succeeded/Updating/Failed/Stopped/Terminating/TerminationFailed/Deleted. + */ + @JsonProperty(value = "properties.provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private String provisioningState; + + /** + * The provisioning state of the API Management service, which is targeted + * by the long running operation started on the service. + */ + @JsonProperty(value = "properties.targetProvisioningState", access = JsonProperty.Access.WRITE_ONLY) + private String targetProvisioningState; + + /** + * Creation UTC date of the API Management service.The date conforms to the + * following format: `yyyy-MM-ddTHH:mm:ssZ` as specified by the ISO 8601 + * standard. + */ + @JsonProperty(value = "properties.createdAtUtc", access = JsonProperty.Access.WRITE_ONLY) + private DateTime createdAtUtc; + + /** + * Gateway URL of the API Management service. + */ + @JsonProperty(value = "properties.gatewayUrl", access = JsonProperty.Access.WRITE_ONLY) + private String gatewayUrl; + + /** + * Gateway URL of the API Management service in the Default Region. + */ + @JsonProperty(value = "properties.gatewayRegionalUrl", access = JsonProperty.Access.WRITE_ONLY) + private String gatewayRegionalUrl; + + /** + * Publisher portal endpoint Url of the API Management service. + */ + @JsonProperty(value = "properties.portalUrl", access = JsonProperty.Access.WRITE_ONLY) + private String portalUrl; + + /** + * Management API endpoint URL of the API Management service. + */ + @JsonProperty(value = "properties.managementApiUrl", access = JsonProperty.Access.WRITE_ONLY) + private String managementApiUrl; + + /** + * SCM endpoint URL of the API Management service. + */ + @JsonProperty(value = "properties.scmUrl", access = JsonProperty.Access.WRITE_ONLY) + private String scmUrl; + + /** + * Custom hostname configuration of the API Management service. + */ + @JsonProperty(value = "properties.hostnameConfigurations") + private List hostnameConfigurations; + + /** + * Public Static Load Balanced IP addresses of the API Management service + * in Primary region. Available only for Basic, Standard and Premium SKU. + */ + @JsonProperty(value = "properties.publicIPAddresses", access = JsonProperty.Access.WRITE_ONLY) + private List publicIPAddresses; + + /** + * Private Static Load Balanced IP addresses of the API Management service + * in Primary region which is deployed in an Internal Virtual Network. + * Available only for Basic, Standard and Premium SKU. + */ + @JsonProperty(value = "properties.privateIPAddresses", access = JsonProperty.Access.WRITE_ONLY) + private List privateIPAddresses; + + /** + * Virtual network configuration of the API Management service. + */ + @JsonProperty(value = "properties.virtualNetworkConfiguration") + private VirtualNetworkConfiguration virtualNetworkConfiguration; + + /** + * Additional datacenter locations of the API Management service. + */ + @JsonProperty(value = "properties.additionalLocations") + private List additionalLocations; + + /** + * Custom properties of the API Management service. Setting + * `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TripleDes168` + * will disable the cipher TLS_RSA_WITH_3DES_EDE_CBC_SHA for all TLS(1.0, + * 1.1 and 1.2). Setting + * `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Tls11` + * can be used to disable just TLS 1.1 and setting + * `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Tls10` + * can be used to disable TLS 1.0 on an API Management service. + */ + @JsonProperty(value = "properties.customProperties") + private Map customProperties; + + /** + * List of Certificates that need to be installed in the API Management + * service. Max supported certificates that can be installed is 10. + */ + @JsonProperty(value = "properties.certificates") + private List certificates; + + /** + * Property only meant to be used for Consumption SKU Service. This + * enforces a client certificate to be presented on each request to the + * gateway. This also enables the ability to authenticate the certificate + * in the policy on the gateway. + */ + @JsonProperty(value = "properties.enableClientCertificate") + private Boolean enableClientCertificate; + + /** + * The type of VPN in which API Management service needs to be configured + * in. None (Default Value) means the API Management service is not part of + * any Virtual Network, External means the API Management deployment is set + * up inside a Virtual Network having an Internet Facing Endpoint, and + * Internal means that API Management deployment is setup inside a Virtual + * Network having an Intranet Facing Endpoint only. Possible values + * include: 'None', 'External', 'Internal'. + */ + @JsonProperty(value = "properties.virtualNetworkType") + private VirtualNetworkType virtualNetworkType; + + /** + * Publisher email. + */ + @JsonProperty(value = "properties.publisherEmail") + private String publisherEmail; + + /** + * Publisher name. + */ + @JsonProperty(value = "properties.publisherName") + private String publisherName; + + /** + * SKU properties of the API Management service. + */ + @JsonProperty(value = "sku") + private ApiManagementServiceSkuProperties sku; + + /** + * Managed service identity of the Api Management service. + */ + @JsonProperty(value = "identity") + private ApiManagementServiceIdentity identity; + + /** + * ETag of the resource. + */ + @JsonProperty(value = "etag", access = JsonProperty.Access.WRITE_ONLY) + private String etag; + + /** + * Get email address from which the notification will be sent. + * + * @return the notificationSenderEmail value + */ + public String notificationSenderEmail() { + return this.notificationSenderEmail; + } + + /** + * Set email address from which the notification will be sent. + * + * @param notificationSenderEmail the notificationSenderEmail value to set + * @return the ApiManagementServiceUpdateParameters object itself. + */ + public ApiManagementServiceUpdateParameters withNotificationSenderEmail(String notificationSenderEmail) { + this.notificationSenderEmail = notificationSenderEmail; + return this; + } + + /** + * Get the current provisioning state of the API Management service which can be one of the following: Created/Activating/Succeeded/Updating/Failed/Stopped/Terminating/TerminationFailed/Deleted. + * + * @return the provisioningState value + */ + public String provisioningState() { + return this.provisioningState; + } + + /** + * Get the provisioning state of the API Management service, which is targeted by the long running operation started on the service. + * + * @return the targetProvisioningState value + */ + public String targetProvisioningState() { + return this.targetProvisioningState; + } + + /** + * Get creation UTC date of the API Management service.The date conforms to the following format: `yyyy-MM-ddTHH:mm:ssZ` as specified by the ISO 8601 standard. + * + * @return the createdAtUtc value + */ + public DateTime createdAtUtc() { + return this.createdAtUtc; + } + + /** + * Get gateway URL of the API Management service. + * + * @return the gatewayUrl value + */ + public String gatewayUrl() { + return this.gatewayUrl; + } + + /** + * Get gateway URL of the API Management service in the Default Region. + * + * @return the gatewayRegionalUrl value + */ + public String gatewayRegionalUrl() { + return this.gatewayRegionalUrl; + } + + /** + * Get publisher portal endpoint Url of the API Management service. + * + * @return the portalUrl value + */ + public String portalUrl() { + return this.portalUrl; + } + + /** + * Get management API endpoint URL of the API Management service. + * + * @return the managementApiUrl value + */ + public String managementApiUrl() { + return this.managementApiUrl; + } + + /** + * Get sCM endpoint URL of the API Management service. + * + * @return the scmUrl value + */ + public String scmUrl() { + return this.scmUrl; + } + + /** + * Get custom hostname configuration of the API Management service. + * + * @return the hostnameConfigurations value + */ + public List hostnameConfigurations() { + return this.hostnameConfigurations; + } + + /** + * Set custom hostname configuration of the API Management service. + * + * @param hostnameConfigurations the hostnameConfigurations value to set + * @return the ApiManagementServiceUpdateParameters object itself. + */ + public ApiManagementServiceUpdateParameters withHostnameConfigurations(List hostnameConfigurations) { + this.hostnameConfigurations = hostnameConfigurations; + return this; + } + + /** + * Get public Static Load Balanced IP addresses of the API Management service in Primary region. Available only for Basic, Standard and Premium SKU. + * + * @return the publicIPAddresses value + */ + public List publicIPAddresses() { + return this.publicIPAddresses; + } + + /** + * Get private Static Load Balanced IP addresses of the API Management service in Primary region which is deployed in an Internal Virtual Network. Available only for Basic, Standard and Premium SKU. + * + * @return the privateIPAddresses value + */ + public List privateIPAddresses() { + return this.privateIPAddresses; + } + + /** + * Get virtual network configuration of the API Management service. + * + * @return the virtualNetworkConfiguration value + */ + public VirtualNetworkConfiguration virtualNetworkConfiguration() { + return this.virtualNetworkConfiguration; + } + + /** + * Set virtual network configuration of the API Management service. + * + * @param virtualNetworkConfiguration the virtualNetworkConfiguration value to set + * @return the ApiManagementServiceUpdateParameters object itself. + */ + public ApiManagementServiceUpdateParameters withVirtualNetworkConfiguration(VirtualNetworkConfiguration virtualNetworkConfiguration) { + this.virtualNetworkConfiguration = virtualNetworkConfiguration; + return this; + } + + /** + * Get additional datacenter locations of the API Management service. + * + * @return the additionalLocations value + */ + public List additionalLocations() { + return this.additionalLocations; + } + + /** + * Set additional datacenter locations of the API Management service. + * + * @param additionalLocations the additionalLocations value to set + * @return the ApiManagementServiceUpdateParameters object itself. + */ + public ApiManagementServiceUpdateParameters withAdditionalLocations(List additionalLocations) { + this.additionalLocations = additionalLocations; + return this; + } + + /** + * Get custom properties of the API Management service. Setting `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TripleDes168` will disable the cipher TLS_RSA_WITH_3DES_EDE_CBC_SHA for all TLS(1.0, 1.1 and 1.2). Setting `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Tls11` can be used to disable just TLS 1.1 and setting `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Tls10` can be used to disable TLS 1.0 on an API Management service. + * + * @return the customProperties value + */ + public Map customProperties() { + return this.customProperties; + } + + /** + * Set custom properties of the API Management service. Setting `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TripleDes168` will disable the cipher TLS_RSA_WITH_3DES_EDE_CBC_SHA for all TLS(1.0, 1.1 and 1.2). Setting `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Tls11` can be used to disable just TLS 1.1 and setting `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Tls10` can be used to disable TLS 1.0 on an API Management service. + * + * @param customProperties the customProperties value to set + * @return the ApiManagementServiceUpdateParameters object itself. + */ + public ApiManagementServiceUpdateParameters withCustomProperties(Map customProperties) { + this.customProperties = customProperties; + return this; + } + + /** + * Get list of Certificates that need to be installed in the API Management service. Max supported certificates that can be installed is 10. + * + * @return the certificates value + */ + public List certificates() { + return this.certificates; + } + + /** + * Set list of Certificates that need to be installed in the API Management service. Max supported certificates that can be installed is 10. + * + * @param certificates the certificates value to set + * @return the ApiManagementServiceUpdateParameters object itself. + */ + public ApiManagementServiceUpdateParameters withCertificates(List certificates) { + this.certificates = certificates; + return this; + } + + /** + * Get property only meant to be used for Consumption SKU Service. This enforces a client certificate to be presented on each request to the gateway. This also enables the ability to authenticate the certificate in the policy on the gateway. + * + * @return the enableClientCertificate value + */ + public Boolean enableClientCertificate() { + return this.enableClientCertificate; + } + + /** + * Set property only meant to be used for Consumption SKU Service. This enforces a client certificate to be presented on each request to the gateway. This also enables the ability to authenticate the certificate in the policy on the gateway. + * + * @param enableClientCertificate the enableClientCertificate value to set + * @return the ApiManagementServiceUpdateParameters object itself. + */ + public ApiManagementServiceUpdateParameters withEnableClientCertificate(Boolean enableClientCertificate) { + this.enableClientCertificate = enableClientCertificate; + return this; + } + + /** + * Get the type of VPN in which API Management service needs to be configured in. None (Default Value) means the API Management service is not part of any Virtual Network, External means the API Management deployment is set up inside a Virtual Network having an Internet Facing Endpoint, and Internal means that API Management deployment is setup inside a Virtual Network having an Intranet Facing Endpoint only. Possible values include: 'None', 'External', 'Internal'. + * + * @return the virtualNetworkType value + */ + public VirtualNetworkType virtualNetworkType() { + return this.virtualNetworkType; + } + + /** + * Set the type of VPN in which API Management service needs to be configured in. None (Default Value) means the API Management service is not part of any Virtual Network, External means the API Management deployment is set up inside a Virtual Network having an Internet Facing Endpoint, and Internal means that API Management deployment is setup inside a Virtual Network having an Intranet Facing Endpoint only. Possible values include: 'None', 'External', 'Internal'. + * + * @param virtualNetworkType the virtualNetworkType value to set + * @return the ApiManagementServiceUpdateParameters object itself. + */ + public ApiManagementServiceUpdateParameters withVirtualNetworkType(VirtualNetworkType virtualNetworkType) { + this.virtualNetworkType = virtualNetworkType; + return this; + } + + /** + * Get publisher email. + * + * @return the publisherEmail value + */ + public String publisherEmail() { + return this.publisherEmail; + } + + /** + * Set publisher email. + * + * @param publisherEmail the publisherEmail value to set + * @return the ApiManagementServiceUpdateParameters object itself. + */ + public ApiManagementServiceUpdateParameters withPublisherEmail(String publisherEmail) { + this.publisherEmail = publisherEmail; + return this; + } + + /** + * Get publisher name. + * + * @return the publisherName value + */ + public String publisherName() { + return this.publisherName; + } + + /** + * Set publisher name. + * + * @param publisherName the publisherName value to set + * @return the ApiManagementServiceUpdateParameters object itself. + */ + public ApiManagementServiceUpdateParameters withPublisherName(String publisherName) { + this.publisherName = publisherName; + return this; + } + + /** + * Get sKU properties of the API Management service. + * + * @return the sku value + */ + public ApiManagementServiceSkuProperties sku() { + return this.sku; + } + + /** + * Set sKU properties of the API Management service. + * + * @param sku the sku value to set + * @return the ApiManagementServiceUpdateParameters object itself. + */ + public ApiManagementServiceUpdateParameters withSku(ApiManagementServiceSkuProperties sku) { + this.sku = sku; + return this; + } + + /** + * Get managed service identity of the Api Management service. + * + * @return the identity value + */ + public ApiManagementServiceIdentity identity() { + return this.identity; + } + + /** + * Set managed service identity of the Api Management service. + * + * @param identity the identity value to set + * @return the ApiManagementServiceUpdateParameters object itself. + */ + public ApiManagementServiceUpdateParameters withIdentity(ApiManagementServiceIdentity identity) { + this.identity = identity; + return this; + } + + /** + * Get eTag of the resource. + * + * @return the etag value + */ + public String etag() { + return this.etag; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiManagementServices.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiManagementServices.java new file mode 100644 index 0000000000000..c7098b7f118ef --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiManagementServices.java @@ -0,0 +1,129 @@ +/** + * 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.apimanagement.v2019_01_01; + +import rx.Completable; +import rx.Observable; +import com.microsoft.azure.management.apimanagement.v2019_01_01.implementation.ApiManagementServiceResourceInner; + +/** + * Type representing ApiManagementServices. + */ +public interface ApiManagementServices { + /** + * Restores a backup of an API Management service created using the ApiManagementService_Backup operation on the current service. This is a long running operation and could take several minutes to complete. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param parameters Parameters supplied to the Restore API Management service from backup operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable restoreAsync(String resourceGroupName, String serviceName, ApiManagementServiceBackupRestoreParameters parameters); + + /** + * Creates a backup of the API Management service to the given Azure Storage Account. This is long running operation and could take several minutes to complete. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param parameters Parameters supplied to the ApiManagementService_Backup operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable backupAsync(String resourceGroupName, String serviceName, ApiManagementServiceBackupRestoreParameters parameters); + + /** + * Creates or updates an API Management service. This is long running operation and could take several minutes to complete. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param parameters Parameters supplied to the CreateOrUpdate API Management service operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable createOrUpdateAsync(String resourceGroupName, String serviceName, ApiManagementServiceResourceInner parameters); + + /** + * Updates an existing API Management service. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param parameters Parameters supplied to the CreateOrUpdate API Management service operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable updateAsync(String resourceGroupName, String serviceName, ApiManagementServiceUpdateParameters parameters); + + /** + * Gets an API Management service resource description. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getByResourceGroupAsync(String resourceGroupName, String serviceName); + + /** + * Deletes an existing API Management service. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable deleteAsync(String resourceGroupName, String serviceName); + + /** + * Gets the Single-Sign-On token for the API Management Service which is valid for 5 Minutes. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getSsoTokenAsync(String resourceGroupName, String serviceName); + + /** + * List all API Management services within a resource group. + * + * @param resourceGroupName The name of the resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByResourceGroupAsync(final String resourceGroupName); + + /** + * Lists all API Management services within an Azure subscription. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listAsync(); + + /** + * Checks availability and correctness of a name for an API Management service. + * + * @param name The name to check for availability. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable checkNameAvailabilityAsync(String name); + + /** + * Updates the Microsoft.ApiManagement resource running in the Virtual network to pick the updated network settings. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable applyNetworkConfigurationUpdatesAsync(String resourceGroupName, String serviceName); + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiOperationCreateOrUpdateHeaders.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiOperationCreateOrUpdateHeaders.java new file mode 100644 index 0000000000000..6102348f3d002 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiOperationCreateOrUpdateHeaders.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.apimanagement.v2019_01_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for CreateOrUpdate operation. + */ +public class ApiOperationCreateOrUpdateHeaders { + /** + * Current entity state version. Should be treated as opaque and used to + * make conditional HTTP requests. + */ + @JsonProperty(value = "ETag") + private String eTag; + + /** + * Get current entity state version. Should be treated as opaque and used to make conditional HTTP requests. + * + * @return the eTag value + */ + public String eTag() { + return this.eTag; + } + + /** + * Set current entity state version. Should be treated as opaque and used to make conditional HTTP requests. + * + * @param eTag the eTag value to set + * @return the ApiOperationCreateOrUpdateHeaders object itself. + */ + public ApiOperationCreateOrUpdateHeaders withETag(String eTag) { + this.eTag = eTag; + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiOperationGetEntityTagHeaders.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiOperationGetEntityTagHeaders.java new file mode 100644 index 0000000000000..592ef281c11cc --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiOperationGetEntityTagHeaders.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.apimanagement.v2019_01_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for GetEntityTag operation. + */ +public class ApiOperationGetEntityTagHeaders { + /** + * Current entity state version. Should be treated as opaque and used to + * make conditional HTTP requests. + */ + @JsonProperty(value = "ETag") + private String eTag; + + /** + * Get current entity state version. Should be treated as opaque and used to make conditional HTTP requests. + * + * @return the eTag value + */ + public String eTag() { + return this.eTag; + } + + /** + * Set current entity state version. Should be treated as opaque and used to make conditional HTTP requests. + * + * @param eTag the eTag value to set + * @return the ApiOperationGetEntityTagHeaders object itself. + */ + public ApiOperationGetEntityTagHeaders withETag(String eTag) { + this.eTag = eTag; + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiOperationGetHeaders.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiOperationGetHeaders.java new file mode 100644 index 0000000000000..144dfb2b84fa8 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiOperationGetHeaders.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.apimanagement.v2019_01_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for Get operation. + */ +public class ApiOperationGetHeaders { + /** + * Current entity state version. Should be treated as opaque and used to + * make conditional HTTP requests. + */ + @JsonProperty(value = "ETag") + private String eTag; + + /** + * Get current entity state version. Should be treated as opaque and used to make conditional HTTP requests. + * + * @return the eTag value + */ + public String eTag() { + return this.eTag; + } + + /** + * Set current entity state version. Should be treated as opaque and used to make conditional HTTP requests. + * + * @param eTag the eTag value to set + * @return the ApiOperationGetHeaders object itself. + */ + public ApiOperationGetHeaders withETag(String eTag) { + this.eTag = eTag; + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiOperationPolicyCreateOrUpdateHeaders.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiOperationPolicyCreateOrUpdateHeaders.java new file mode 100644 index 0000000000000..5a81ea1c3ffb2 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiOperationPolicyCreateOrUpdateHeaders.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.apimanagement.v2019_01_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for CreateOrUpdate operation. + */ +public class ApiOperationPolicyCreateOrUpdateHeaders { + /** + * Current entity state version. Should be treated as opaque and used to + * make conditional HTTP requests. + */ + @JsonProperty(value = "ETag") + private String eTag; + + /** + * Get current entity state version. Should be treated as opaque and used to make conditional HTTP requests. + * + * @return the eTag value + */ + public String eTag() { + return this.eTag; + } + + /** + * Set current entity state version. Should be treated as opaque and used to make conditional HTTP requests. + * + * @param eTag the eTag value to set + * @return the ApiOperationPolicyCreateOrUpdateHeaders object itself. + */ + public ApiOperationPolicyCreateOrUpdateHeaders withETag(String eTag) { + this.eTag = eTag; + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiOperationPolicyGetEntityTagHeaders.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiOperationPolicyGetEntityTagHeaders.java new file mode 100644 index 0000000000000..58c876beaa6ab --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiOperationPolicyGetEntityTagHeaders.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.apimanagement.v2019_01_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for GetEntityTag operation. + */ +public class ApiOperationPolicyGetEntityTagHeaders { + /** + * Current entity state version. Should be treated as opaque and used to + * make conditional HTTP requests. + */ + @JsonProperty(value = "ETag") + private String eTag; + + /** + * Get current entity state version. Should be treated as opaque and used to make conditional HTTP requests. + * + * @return the eTag value + */ + public String eTag() { + return this.eTag; + } + + /** + * Set current entity state version. Should be treated as opaque and used to make conditional HTTP requests. + * + * @param eTag the eTag value to set + * @return the ApiOperationPolicyGetEntityTagHeaders object itself. + */ + public ApiOperationPolicyGetEntityTagHeaders withETag(String eTag) { + this.eTag = eTag; + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiOperationPolicyGetHeaders.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiOperationPolicyGetHeaders.java new file mode 100644 index 0000000000000..58f1202b09626 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiOperationPolicyGetHeaders.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.apimanagement.v2019_01_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for Get operation. + */ +public class ApiOperationPolicyGetHeaders { + /** + * Current entity state version. Should be treated as opaque and used to + * make conditional HTTP requests. + */ + @JsonProperty(value = "ETag") + private String eTag; + + /** + * Get current entity state version. Should be treated as opaque and used to make conditional HTTP requests. + * + * @return the eTag value + */ + public String eTag() { + return this.eTag; + } + + /** + * Set current entity state version. Should be treated as opaque and used to make conditional HTTP requests. + * + * @param eTag the eTag value to set + * @return the ApiOperationPolicyGetHeaders object itself. + */ + public ApiOperationPolicyGetHeaders withETag(String eTag) { + this.eTag = eTag; + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiOperationPolicys.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiOperationPolicys.java new file mode 100644 index 0000000000000..da6e98245dfe4 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiOperationPolicys.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.apimanagement.v2019_01_01; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import rx.Completable; +import rx.Observable; +import com.microsoft.azure.management.apimanagement.v2019_01_01.implementation.ApiOperationPolicysInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing ApiOperationPolicys. + */ +public interface ApiOperationPolicys extends SupportsCreating, HasInner { + /** + * Get the list of policy configuration at the API Operation level. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @param operationId Operation identifier within an API. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByOperationAsync(String resourceGroupName, String serviceName, String apiId, String operationId); + + /** + * Gets the entity state (Etag) version of the API operation policy specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @param operationId Operation identifier within an API. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable getEntityTagAsync(String resourceGroupName, String serviceName, String apiId, String operationId); + + /** + * Get the policy configuration at the API Operation level. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @param operationId Operation identifier within an API. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String resourceGroupName, String serviceName, String apiId, String operationId); + + /** + * Deletes the policy configuration at the Api Operation. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @param operationId Operation identifier within an API. Must be unique in the current API Management service instance. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable deleteAsync(String resourceGroupName, String serviceName, String apiId, String operationId, String ifMatch); + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiOperations.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiOperations.java new file mode 100644 index 0000000000000..e1c8134579e46 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiOperations.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.apimanagement.v2019_01_01; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import rx.Completable; +import rx.Observable; +import com.microsoft.azure.management.apimanagement.v2019_01_01.implementation.ApiOperationsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing ApiOperations. + */ +public interface ApiOperations extends SupportsCreating, HasInner { + /** + * Gets the entity state (Etag) version of the API operation specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @param operationId Operation identifier within an API. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable getEntityTagAsync(String resourceGroupName, String serviceName, String apiId, String operationId); + + /** + * Gets the details of the API Operation specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @param operationId Operation identifier within an API. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String resourceGroupName, String serviceName, String apiId, String operationId); + + /** + * Lists a collection of the operations for the specified API. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByApiAsync(final String resourceGroupName, final String serviceName, final String apiId); + + /** + * Deletes the specified operation in the API. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @param operationId Operation identifier within an API. Must be unique in the current API Management service instance. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable deleteAsync(String resourceGroupName, String serviceName, String apiId, String operationId, String ifMatch); + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiPolicyContract.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiPolicyContract.java new file mode 100644 index 0000000000000..3ed3f0e3a9a61 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiPolicyContract.java @@ -0,0 +1,159 @@ +/** + * 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.apimanagement.v2019_01_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.apimanagement.v2019_01_01.implementation.PolicyContractInner; +import com.microsoft.azure.arm.model.Indexable; +import com.microsoft.azure.arm.model.Refreshable; +import com.microsoft.azure.arm.model.Updatable; +import com.microsoft.azure.arm.model.Appliable; +import com.microsoft.azure.arm.model.Creatable; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.apimanagement.v2019_01_01.implementation.ApiManagementManager; + +/** + * Type representing ApiPolicyContract. + */ +public interface ApiPolicyContract extends HasInner, Indexable, Refreshable, Updatable, HasManager { + /** + * @return the format value. + */ + PolicyContentFormat format(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the type value. + */ + String type(); + + /** + * @return the value value. + */ + String value(); + + /** + * The entirety of the ApiPolicyContract definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithApi, DefinitionStages.WithIfMatch, DefinitionStages.WithValue, DefinitionStages.WithCreate { + } + + /** + * Grouping of ApiPolicyContract definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a ApiPolicyContract definition. + */ + interface Blank extends WithApi { + } + + /** + * The stage of the apipolicycontract definition allowing to specify Api. + */ + interface WithApi { + /** + * Specifies resourceGroupName, serviceName, apiId. + * @param resourceGroupName The name of the resource group + * @param serviceName The name of the API Management service + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number + * @return the next definition stage + */ + WithIfMatch withExistingApi(String resourceGroupName, String serviceName, String apiId); + } + + /** + * The stage of the apipolicycontract definition allowing to specify IfMatch. + */ + interface WithIfMatch { + /** + * Specifies ifMatch. + * @param ifMatch ETag of the Entity. Not required when creating an entity, but required when updating an entity + * @return the next definition stage + */ + WithValue withIfMatch(String ifMatch); + } + + /** + * The stage of the apipolicycontract definition allowing to specify Value. + */ + interface WithValue { + /** + * Specifies value. + * @param value Contents of the Policy as defined by the format + * @return the next definition stage + */ + WithCreate withValue(String value); + } + + /** + * The stage of the apipolicycontract definition allowing to specify Format. + */ + interface WithFormat { + /** + * Specifies format. + * @param format Format of the policyContent. Possible values include: 'xml', 'xml-link', 'rawxml', 'rawxml-link' + * @return the next definition stage + */ + WithCreate withFormat(PolicyContentFormat format); + } + + /** + * The stage of the definition which contains all the minimum required inputs for + * the resource to be created (via {@link WithCreate#create()}), but also allows + * for any other optional settings to be specified. + */ + interface WithCreate extends Creatable, DefinitionStages.WithFormat { + } + } + /** + * The template for a ApiPolicyContract update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithIfMatch, UpdateStages.WithFormat { + } + + /** + * Grouping of ApiPolicyContract update stages. + */ + interface UpdateStages { + /** + * The stage of the apipolicycontract update allowing to specify IfMatch. + */ + interface WithIfMatch { + /** + * Specifies ifMatch. + * @param ifMatch ETag of the Entity. Not required when creating an entity, but required when updating an entity + * @return the next update stage + */ + Update withIfMatch(String ifMatch); + } + + /** + * The stage of the apipolicycontract update allowing to specify Format. + */ + interface WithFormat { + /** + * Specifies format. + * @param format Format of the policyContent. Possible values include: 'xml', 'xml-link', 'rawxml', 'rawxml-link' + * @return the next update stage + */ + Update withFormat(PolicyContentFormat format); + } + + } +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiPolicyCreateOrUpdateHeaders.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiPolicyCreateOrUpdateHeaders.java new file mode 100644 index 0000000000000..644b675e2e283 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiPolicyCreateOrUpdateHeaders.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.apimanagement.v2019_01_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for CreateOrUpdate operation. + */ +public class ApiPolicyCreateOrUpdateHeaders { + /** + * Current entity state version. Should be treated as opaque and used to + * make conditional HTTP requests. + */ + @JsonProperty(value = "ETag") + private String eTag; + + /** + * Get current entity state version. Should be treated as opaque and used to make conditional HTTP requests. + * + * @return the eTag value + */ + public String eTag() { + return this.eTag; + } + + /** + * Set current entity state version. Should be treated as opaque and used to make conditional HTTP requests. + * + * @param eTag the eTag value to set + * @return the ApiPolicyCreateOrUpdateHeaders object itself. + */ + public ApiPolicyCreateOrUpdateHeaders withETag(String eTag) { + this.eTag = eTag; + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiPolicyGetEntityTagHeaders.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiPolicyGetEntityTagHeaders.java new file mode 100644 index 0000000000000..8c9b3f618cd4b --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiPolicyGetEntityTagHeaders.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.apimanagement.v2019_01_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for GetEntityTag operation. + */ +public class ApiPolicyGetEntityTagHeaders { + /** + * Current entity state version. Should be treated as opaque and used to + * make conditional HTTP requests. + */ + @JsonProperty(value = "ETag") + private String eTag; + + /** + * Get current entity state version. Should be treated as opaque and used to make conditional HTTP requests. + * + * @return the eTag value + */ + public String eTag() { + return this.eTag; + } + + /** + * Set current entity state version. Should be treated as opaque and used to make conditional HTTP requests. + * + * @param eTag the eTag value to set + * @return the ApiPolicyGetEntityTagHeaders object itself. + */ + public ApiPolicyGetEntityTagHeaders withETag(String eTag) { + this.eTag = eTag; + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiPolicyGetHeaders.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiPolicyGetHeaders.java new file mode 100644 index 0000000000000..7cc9f31cffa67 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiPolicyGetHeaders.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.apimanagement.v2019_01_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for Get operation. + */ +public class ApiPolicyGetHeaders { + /** + * Current entity state version. Should be treated as opaque and used to + * make conditional HTTP requests. + */ + @JsonProperty(value = "ETag") + private String eTag; + + /** + * Get current entity state version. Should be treated as opaque and used to make conditional HTTP requests. + * + * @return the eTag value + */ + public String eTag() { + return this.eTag; + } + + /** + * Set current entity state version. Should be treated as opaque and used to make conditional HTTP requests. + * + * @param eTag the eTag value to set + * @return the ApiPolicyGetHeaders object itself. + */ + public ApiPolicyGetHeaders withETag(String eTag) { + this.eTag = eTag; + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiPolicys.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiPolicys.java new file mode 100644 index 0000000000000..ffae14dcb5cb1 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiPolicys.java @@ -0,0 +1,66 @@ +/** + * 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.apimanagement.v2019_01_01; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import rx.Completable; +import rx.Observable; +import com.microsoft.azure.management.apimanagement.v2019_01_01.implementation.ApiPolicysInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing ApiPolicys. + */ +public interface ApiPolicys extends SupportsCreating, HasInner { + /** + * Get the policy configuration at the API level. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByApiAsync(String resourceGroupName, String serviceName, String apiId); + + /** + * Gets the entity state (Etag) version of the API policy specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable getEntityTagAsync(String resourceGroupName, String serviceName, String apiId); + + /** + * Get the policy configuration at the API level. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String resourceGroupName, String serviceName, String apiId); + + /** + * Deletes the policy configuration at the Api. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable deleteAsync(String resourceGroupName, String serviceName, String apiId, String ifMatch); + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiProductContract.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiProductContract.java new file mode 100644 index 0000000000000..2e425c56cad7b --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiProductContract.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.apimanagement.v2019_01_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.apimanagement.v2019_01_01.implementation.ProductContractInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.apimanagement.v2019_01_01.implementation.ApiManagementManager; + +/** + * Type representing ApiProductContract. + */ +public interface ApiProductContract extends HasInner, HasManager { + /** + * @return the approvalRequired value. + */ + Boolean approvalRequired(); + + /** + * @return the description value. + */ + String description(); + + /** + * @return the displayName value. + */ + String displayName(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the state value. + */ + ProductState state(); + + /** + * @return the subscriptionRequired value. + */ + Boolean subscriptionRequired(); + + /** + * @return the subscriptionsLimit value. + */ + Integer subscriptionsLimit(); + + /** + * @return the terms value. + */ + String terms(); + + /** + * @return the type value. + */ + String type(); + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiProducts.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiProducts.java new file mode 100644 index 0000000000000..8873983fe500f --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiProducts.java @@ -0,0 +1,30 @@ +/** + * 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.apimanagement.v2019_01_01; + +import rx.Observable; +import com.microsoft.azure.management.apimanagement.v2019_01_01.implementation.ApiProductsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing ApiProducts. + */ +public interface ApiProducts extends HasInner { + /** + * Lists all Products, which the API is part of. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API identifier. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByApisAsync(final String resourceGroupName, final String serviceName, final String apiId); + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiReleaseContract.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiReleaseContract.java new file mode 100644 index 0000000000000..868f754adba77 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiReleaseContract.java @@ -0,0 +1,182 @@ +/** + * 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.apimanagement.v2019_01_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.apimanagement.v2019_01_01.implementation.ApiReleaseContractInner; +import com.microsoft.azure.arm.model.Indexable; +import com.microsoft.azure.arm.model.Refreshable; +import com.microsoft.azure.arm.model.Updatable; +import com.microsoft.azure.arm.model.Appliable; +import com.microsoft.azure.arm.model.Creatable; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.apimanagement.v2019_01_01.implementation.ApiManagementManager; +import org.joda.time.DateTime; + +/** + * Type representing ApiReleaseContract. + */ +public interface ApiReleaseContract extends HasInner, Indexable, Refreshable, Updatable, HasManager { + /** + * @return the apiId value. + */ + String apiId(); + + /** + * @return the createdDateTime value. + */ + DateTime createdDateTime(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the notes value. + */ + String notes(); + + /** + * @return the type value. + */ + String type(); + + /** + * @return the updatedDateTime value. + */ + DateTime updatedDateTime(); + + /** + * The entirety of the ApiReleaseContract definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithApi, DefinitionStages.WithIfMatch, DefinitionStages.WithCreate { + } + + /** + * Grouping of ApiReleaseContract definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a ApiReleaseContract definition. + */ + interface Blank extends WithApi { + } + + /** + * The stage of the apireleasecontract definition allowing to specify Api. + */ + interface WithApi { + /** + * Specifies resourceGroupName, serviceName, apiId. + * @param resourceGroupName The name of the resource group + * @param serviceName The name of the API Management service + * @param apiId API identifier. Must be unique in the current API Management service instance + * @return the next definition stage + */ + WithIfMatch withExistingApi(String resourceGroupName, String serviceName, String apiId); + } + + /** + * The stage of the apireleasecontract definition allowing to specify IfMatch. + */ + interface WithIfMatch { + /** + * Specifies ifMatch. + * @param ifMatch ETag of the Entity. Not required when creating an entity, but required when updating an entity + * @return the next definition stage + */ + WithCreate withIfMatch(String ifMatch); + } + + /** + * The stage of the apireleasecontract definition allowing to specify ApiId. + */ + interface WithApiId { + /** + * Specifies apiId. + * @param apiId Identifier of the API the release belongs to + * @return the next definition stage + */ + WithCreate withApiId(String apiId); + } + + /** + * The stage of the apireleasecontract definition allowing to specify Notes. + */ + interface WithNotes { + /** + * Specifies notes. + * @param notes Release Notes + * @return the next definition stage + */ + WithCreate withNotes(String notes); + } + + /** + * The stage of the definition which contains all the minimum required inputs for + * the resource to be created (via {@link WithCreate#create()}), but also allows + * for any other optional settings to be specified. + */ + interface WithCreate extends Creatable, DefinitionStages.WithApiId, DefinitionStages.WithNotes { + } + } + /** + * The template for a ApiReleaseContract update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithIfMatch, UpdateStages.WithApiId, UpdateStages.WithNotes { + } + + /** + * Grouping of ApiReleaseContract update stages. + */ + interface UpdateStages { + /** + * The stage of the apireleasecontract update allowing to specify IfMatch. + */ + interface WithIfMatch { + /** + * Specifies ifMatch. + * @param ifMatch ETag of the Entity. Not required when creating an entity, but required when updating an entity + * @return the next update stage + */ + Update withIfMatch(String ifMatch); + } + + /** + * The stage of the apireleasecontract update allowing to specify ApiId. + */ + interface WithApiId { + /** + * Specifies apiId. + * @param apiId Identifier of the API the release belongs to + * @return the next update stage + */ + Update withApiId(String apiId); + } + + /** + * The stage of the apireleasecontract update allowing to specify Notes. + */ + interface WithNotes { + /** + * Specifies notes. + * @param notes Release Notes + * @return the next update stage + */ + Update withNotes(String notes); + } + + } +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiReleaseCreateOrUpdateHeaders.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiReleaseCreateOrUpdateHeaders.java new file mode 100644 index 0000000000000..d32a2c43d3eae --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiReleaseCreateOrUpdateHeaders.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.apimanagement.v2019_01_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for CreateOrUpdate operation. + */ +public class ApiReleaseCreateOrUpdateHeaders { + /** + * Current entity state version. Should be treated as opaque and used to + * make conditional HTTP requests. + */ + @JsonProperty(value = "ETag") + private String eTag; + + /** + * Get current entity state version. Should be treated as opaque and used to make conditional HTTP requests. + * + * @return the eTag value + */ + public String eTag() { + return this.eTag; + } + + /** + * Set current entity state version. Should be treated as opaque and used to make conditional HTTP requests. + * + * @param eTag the eTag value to set + * @return the ApiReleaseCreateOrUpdateHeaders object itself. + */ + public ApiReleaseCreateOrUpdateHeaders withETag(String eTag) { + this.eTag = eTag; + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiReleaseGetEntityTagHeaders.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiReleaseGetEntityTagHeaders.java new file mode 100644 index 0000000000000..75feba27cfcdb --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiReleaseGetEntityTagHeaders.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.apimanagement.v2019_01_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for GetEntityTag operation. + */ +public class ApiReleaseGetEntityTagHeaders { + /** + * Current entity state version. Should be treated as opaque and used to + * make conditional HTTP requests. + */ + @JsonProperty(value = "ETag") + private String eTag; + + /** + * Get current entity state version. Should be treated as opaque and used to make conditional HTTP requests. + * + * @return the eTag value + */ + public String eTag() { + return this.eTag; + } + + /** + * Set current entity state version. Should be treated as opaque and used to make conditional HTTP requests. + * + * @param eTag the eTag value to set + * @return the ApiReleaseGetEntityTagHeaders object itself. + */ + public ApiReleaseGetEntityTagHeaders withETag(String eTag) { + this.eTag = eTag; + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiReleaseGetHeaders.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiReleaseGetHeaders.java new file mode 100644 index 0000000000000..5d026a11adc8e --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiReleaseGetHeaders.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.apimanagement.v2019_01_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for Get operation. + */ +public class ApiReleaseGetHeaders { + /** + * Current entity state version. Should be treated as opaque and used to + * make conditional HTTP requests. + */ + @JsonProperty(value = "ETag") + private String eTag; + + /** + * Get current entity state version. Should be treated as opaque and used to make conditional HTTP requests. + * + * @return the eTag value + */ + public String eTag() { + return this.eTag; + } + + /** + * Set current entity state version. Should be treated as opaque and used to make conditional HTTP requests. + * + * @param eTag the eTag value to set + * @return the ApiReleaseGetHeaders object itself. + */ + public ApiReleaseGetHeaders withETag(String eTag) { + this.eTag = eTag; + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiReleases.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiReleases.java new file mode 100644 index 0000000000000..7b7050145338d --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiReleases.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.apimanagement.v2019_01_01; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import rx.Completable; +import rx.Observable; +import com.microsoft.azure.management.apimanagement.v2019_01_01.implementation.ApiReleasesInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing ApiReleases. + */ +public interface ApiReleases extends SupportsCreating, HasInner { + /** + * Returns the etag of an API release. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API identifier. Must be unique in the current API Management service instance. + * @param releaseId Release identifier within an API. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable getEntityTagAsync(String resourceGroupName, String serviceName, String apiId, String releaseId); + + /** + * Returns the details of an API release. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API identifier. Must be unique in the current API Management service instance. + * @param releaseId Release identifier within an API. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String resourceGroupName, String serviceName, String apiId, String releaseId); + + /** + * Lists all releases of an API. An API release is created when making an API Revision current. Releases are also used to rollback to previous revisions. Results will be paged and can be constrained by the $top and $skip parameters. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API identifier. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByServiceAsync(final String resourceGroupName, final String serviceName, final String apiId); + + /** + * Deletes the specified release in the API. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API identifier. Must be unique in the current API Management service instance. + * @param releaseId Release identifier within an API. Must be unique in the current API Management service instance. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable deleteAsync(String resourceGroupName, String serviceName, String apiId, String releaseId, String ifMatch); + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiRevisionContract.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiRevisionContract.java new file mode 100644 index 0000000000000..60415961f0b13 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiRevisionContract.java @@ -0,0 +1,61 @@ +/** + * 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.apimanagement.v2019_01_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.apimanagement.v2019_01_01.implementation.ApiRevisionContractInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.apimanagement.v2019_01_01.implementation.ApiManagementManager; +import org.joda.time.DateTime; + +/** + * Type representing ApiRevisionContract. + */ +public interface ApiRevisionContract extends HasInner, HasManager { + /** + * @return the apiId value. + */ + String apiId(); + + /** + * @return the apiRevision value. + */ + String apiRevision(); + + /** + * @return the createdDateTime value. + */ + DateTime createdDateTime(); + + /** + * @return the description value. + */ + String description(); + + /** + * @return the isCurrent value. + */ + Boolean isCurrent(); + + /** + * @return the isOnline value. + */ + Boolean isOnline(); + + /** + * @return the privateUrl value. + */ + String privateUrl(); + + /** + * @return the updatedDateTime value. + */ + DateTime updatedDateTime(); + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiRevisionInfoContract.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiRevisionInfoContract.java new file mode 100644 index 0000000000000..8d903750add0a --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiRevisionInfoContract.java @@ -0,0 +1,122 @@ +/** + * 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.apimanagement.v2019_01_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Object used to create an API Revision or Version based on an existing API + * Revision. + */ +public class ApiRevisionInfoContract { + /** + * Resource identifier of API to be used to create the revision from. + */ + @JsonProperty(value = "sourceApiId") + private String sourceApiId; + + /** + * Version identifier for the new API Version. + */ + @JsonProperty(value = "apiVersionName") + private String apiVersionName; + + /** + * Description of new API Revision. + */ + @JsonProperty(value = "apiRevisionDescription") + private String apiRevisionDescription; + + /** + * Version set details. + */ + @JsonProperty(value = "apiVersionSet") + private ApiVersionSetContractDetails apiVersionSet; + + /** + * Get resource identifier of API to be used to create the revision from. + * + * @return the sourceApiId value + */ + public String sourceApiId() { + return this.sourceApiId; + } + + /** + * Set resource identifier of API to be used to create the revision from. + * + * @param sourceApiId the sourceApiId value to set + * @return the ApiRevisionInfoContract object itself. + */ + public ApiRevisionInfoContract withSourceApiId(String sourceApiId) { + this.sourceApiId = sourceApiId; + return this; + } + + /** + * Get version identifier for the new API Version. + * + * @return the apiVersionName value + */ + public String apiVersionName() { + return this.apiVersionName; + } + + /** + * Set version identifier for the new API Version. + * + * @param apiVersionName the apiVersionName value to set + * @return the ApiRevisionInfoContract object itself. + */ + public ApiRevisionInfoContract withApiVersionName(String apiVersionName) { + this.apiVersionName = apiVersionName; + return this; + } + + /** + * Get description of new API Revision. + * + * @return the apiRevisionDescription value + */ + public String apiRevisionDescription() { + return this.apiRevisionDescription; + } + + /** + * Set description of new API Revision. + * + * @param apiRevisionDescription the apiRevisionDescription value to set + * @return the ApiRevisionInfoContract object itself. + */ + public ApiRevisionInfoContract withApiRevisionDescription(String apiRevisionDescription) { + this.apiRevisionDescription = apiRevisionDescription; + return this; + } + + /** + * Get version set details. + * + * @return the apiVersionSet value + */ + public ApiVersionSetContractDetails apiVersionSet() { + return this.apiVersionSet; + } + + /** + * Set version set details. + * + * @param apiVersionSet the apiVersionSet value to set + * @return the ApiRevisionInfoContract object itself. + */ + public ApiRevisionInfoContract withApiVersionSet(ApiVersionSetContractDetails apiVersionSet) { + this.apiVersionSet = apiVersionSet; + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiRevisions.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiRevisions.java new file mode 100644 index 0000000000000..a19c0273169e2 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiRevisions.java @@ -0,0 +1,30 @@ +/** + * 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.apimanagement.v2019_01_01; + +import rx.Observable; +import com.microsoft.azure.management.apimanagement.v2019_01_01.implementation.ApiRevisionsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing ApiRevisions. + */ +public interface ApiRevisions extends HasInner { + /** + * Lists all revisions of an API. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API identifier. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByServiceAsync(final String resourceGroupName, final String serviceName, final String apiId); + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiSchemaCreateOrUpdateHeaders.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiSchemaCreateOrUpdateHeaders.java new file mode 100644 index 0000000000000..afce3cafa67fe --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiSchemaCreateOrUpdateHeaders.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.apimanagement.v2019_01_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for CreateOrUpdate operation. + */ +public class ApiSchemaCreateOrUpdateHeaders { + /** + * Current entity state version. Should be treated as opaque and used to + * make conditional HTTP requests. + */ + @JsonProperty(value = "ETag") + private String eTag; + + /** + * Get current entity state version. Should be treated as opaque and used to make conditional HTTP requests. + * + * @return the eTag value + */ + public String eTag() { + return this.eTag; + } + + /** + * Set current entity state version. Should be treated as opaque and used to make conditional HTTP requests. + * + * @param eTag the eTag value to set + * @return the ApiSchemaCreateOrUpdateHeaders object itself. + */ + public ApiSchemaCreateOrUpdateHeaders withETag(String eTag) { + this.eTag = eTag; + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiSchemaGetEntityTagHeaders.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiSchemaGetEntityTagHeaders.java new file mode 100644 index 0000000000000..3756556b71ceb --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiSchemaGetEntityTagHeaders.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.apimanagement.v2019_01_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for GetEntityTag operation. + */ +public class ApiSchemaGetEntityTagHeaders { + /** + * Current entity state version. Should be treated as opaque and used to + * make conditional HTTP requests. + */ + @JsonProperty(value = "ETag") + private String eTag; + + /** + * Get current entity state version. Should be treated as opaque and used to make conditional HTTP requests. + * + * @return the eTag value + */ + public String eTag() { + return this.eTag; + } + + /** + * Set current entity state version. Should be treated as opaque and used to make conditional HTTP requests. + * + * @param eTag the eTag value to set + * @return the ApiSchemaGetEntityTagHeaders object itself. + */ + public ApiSchemaGetEntityTagHeaders withETag(String eTag) { + this.eTag = eTag; + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiSchemaGetHeaders.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiSchemaGetHeaders.java new file mode 100644 index 0000000000000..a477ea4df6f28 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiSchemaGetHeaders.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.apimanagement.v2019_01_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for Get operation. + */ +public class ApiSchemaGetHeaders { + /** + * Current entity state version. Should be treated as opaque and used to + * make conditional HTTP requests. + */ + @JsonProperty(value = "ETag") + private String eTag; + + /** + * Get current entity state version. Should be treated as opaque and used to make conditional HTTP requests. + * + * @return the eTag value + */ + public String eTag() { + return this.eTag; + } + + /** + * Set current entity state version. Should be treated as opaque and used to make conditional HTTP requests. + * + * @param eTag the eTag value to set + * @return the ApiSchemaGetHeaders object itself. + */ + public ApiSchemaGetHeaders withETag(String eTag) { + this.eTag = eTag; + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiSchemas.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiSchemas.java new file mode 100644 index 0000000000000..801b9b1d73f38 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiSchemas.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.apimanagement.v2019_01_01; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import rx.Completable; +import rx.Observable; +import com.microsoft.azure.management.apimanagement.v2019_01_01.implementation.ApiSchemasInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing ApiSchemas. + */ +public interface ApiSchemas extends SupportsCreating, HasInner { + /** + * Gets the entity state (Etag) version of the schema specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @param schemaId Schema identifier within an API. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable getEntityTagAsync(String resourceGroupName, String serviceName, String apiId, String schemaId); + + /** + * Get the schema configuration at the API level. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @param schemaId Schema identifier within an API. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String resourceGroupName, String serviceName, String apiId, String schemaId); + + /** + * Get the schema configuration at the API level. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByApiAsync(final String resourceGroupName, final String serviceName, final String apiId); + + /** + * Deletes the schema configuration at the Api. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @param schemaId Schema identifier within an API. Must be unique in the current API Management service instance. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable deleteAsync(String resourceGroupName, String serviceName, String apiId, String schemaId, String ifMatch); + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiTagDescriptionCreateOrUpdateHeaders.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiTagDescriptionCreateOrUpdateHeaders.java new file mode 100644 index 0000000000000..ea10ce8027377 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiTagDescriptionCreateOrUpdateHeaders.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.apimanagement.v2019_01_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for CreateOrUpdate operation. + */ +public class ApiTagDescriptionCreateOrUpdateHeaders { + /** + * Current entity state version. Should be treated as opaque and used to + * make conditional HTTP requests. + */ + @JsonProperty(value = "ETag") + private String eTag; + + /** + * Get current entity state version. Should be treated as opaque and used to make conditional HTTP requests. + * + * @return the eTag value + */ + public String eTag() { + return this.eTag; + } + + /** + * Set current entity state version. Should be treated as opaque and used to make conditional HTTP requests. + * + * @param eTag the eTag value to set + * @return the ApiTagDescriptionCreateOrUpdateHeaders object itself. + */ + public ApiTagDescriptionCreateOrUpdateHeaders withETag(String eTag) { + this.eTag = eTag; + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiTagDescriptionGetEntityTagHeaders.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiTagDescriptionGetEntityTagHeaders.java new file mode 100644 index 0000000000000..042f0b7b5945d --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiTagDescriptionGetEntityTagHeaders.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.apimanagement.v2019_01_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for GetEntityTag operation. + */ +public class ApiTagDescriptionGetEntityTagHeaders { + /** + * Current entity state version. Should be treated as opaque and used to + * make conditional HTTP requests. + */ + @JsonProperty(value = "ETag") + private String eTag; + + /** + * Get current entity state version. Should be treated as opaque and used to make conditional HTTP requests. + * + * @return the eTag value + */ + public String eTag() { + return this.eTag; + } + + /** + * Set current entity state version. Should be treated as opaque and used to make conditional HTTP requests. + * + * @param eTag the eTag value to set + * @return the ApiTagDescriptionGetEntityTagHeaders object itself. + */ + public ApiTagDescriptionGetEntityTagHeaders withETag(String eTag) { + this.eTag = eTag; + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiTagDescriptionGetHeaders.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiTagDescriptionGetHeaders.java new file mode 100644 index 0000000000000..bf3f3fb63bcb3 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiTagDescriptionGetHeaders.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.apimanagement.v2019_01_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for Get operation. + */ +public class ApiTagDescriptionGetHeaders { + /** + * Current entity state version. Should be treated as opaque and used to + * make conditional HTTP requests. + */ + @JsonProperty(value = "ETag") + private String eTag; + + /** + * Get current entity state version. Should be treated as opaque and used to make conditional HTTP requests. + * + * @return the eTag value + */ + public String eTag() { + return this.eTag; + } + + /** + * Set current entity state version. Should be treated as opaque and used to make conditional HTTP requests. + * + * @param eTag the eTag value to set + * @return the ApiTagDescriptionGetHeaders object itself. + */ + public ApiTagDescriptionGetHeaders withETag(String eTag) { + this.eTag = eTag; + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiTagDescriptions.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiTagDescriptions.java new file mode 100644 index 0000000000000..560c713e66466 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiTagDescriptions.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.apimanagement.v2019_01_01; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import rx.Completable; +import rx.Observable; +import com.microsoft.azure.management.apimanagement.v2019_01_01.implementation.ApiTagDescriptionsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing ApiTagDescriptions. + */ +public interface ApiTagDescriptions extends SupportsCreating, HasInner { + /** + * Gets the entity state version of the tag specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @param tagId Tag identifier. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable getEntityTagAsync(String resourceGroupName, String serviceName, String apiId, String tagId); + + /** + * Get Tag description in scope of API. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @param tagId Tag identifier. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String resourceGroupName, String serviceName, String apiId, String tagId); + + /** + * Lists all Tags descriptions in scope of API. Model similar to swagger - tagDescription is defined on API level but tag may be assigned to the Operations. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByServiceAsync(final String resourceGroupName, final String serviceName, final String apiId); + + /** + * Delete tag description for the Api. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @param tagId Tag identifier. Must be unique in the current API Management service instance. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable deleteAsync(String resourceGroupName, String serviceName, String apiId, String tagId, String ifMatch); + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiTagResourceContractProperties.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiTagResourceContractProperties.java new file mode 100644 index 0000000000000..3a8bf4f2aee3f --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiTagResourceContractProperties.java @@ -0,0 +1,151 @@ +/** + * 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.apimanagement.v2019_01_01; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * API contract properties for the Tag Resources. + */ +public class ApiTagResourceContractProperties extends ApiEntityBaseContract { + /** + * API identifier in the form /apis/{apiId}. + */ + @JsonProperty(value = "id") + private String id; + + /** + * API name. + */ + @JsonProperty(value = "name") + private String name; + + /** + * Absolute URL of the backend service implementing this API. + */ + @JsonProperty(value = "serviceUrl") + private String serviceUrl; + + /** + * Relative URL uniquely identifying this API and all of its resource paths + * within the API Management service instance. It is appended to the API + * endpoint base URL specified during the service instance creation to form + * a public URL for this API. + */ + @JsonProperty(value = "path") + private String path; + + /** + * Describes on which protocols the operations in this API can be invoked. + */ + @JsonProperty(value = "protocols") + private List protocols; + + /** + * Get aPI identifier in the form /apis/{apiId}. + * + * @return the id value + */ + public String id() { + return this.id; + } + + /** + * Set aPI identifier in the form /apis/{apiId}. + * + * @param id the id value to set + * @return the ApiTagResourceContractProperties object itself. + */ + public ApiTagResourceContractProperties withId(String id) { + this.id = id; + return this; + } + + /** + * Get aPI name. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set aPI name. + * + * @param name the name value to set + * @return the ApiTagResourceContractProperties object itself. + */ + public ApiTagResourceContractProperties withName(String name) { + this.name = name; + return this; + } + + /** + * Get absolute URL of the backend service implementing this API. + * + * @return the serviceUrl value + */ + public String serviceUrl() { + return this.serviceUrl; + } + + /** + * Set absolute URL of the backend service implementing this API. + * + * @param serviceUrl the serviceUrl value to set + * @return the ApiTagResourceContractProperties object itself. + */ + public ApiTagResourceContractProperties withServiceUrl(String serviceUrl) { + this.serviceUrl = serviceUrl; + return this; + } + + /** + * Get relative URL uniquely identifying this API and all of its resource paths within the API Management service instance. It is appended to the API endpoint base URL specified during the service instance creation to form a public URL for this API. + * + * @return the path value + */ + public String path() { + return this.path; + } + + /** + * Set relative URL uniquely identifying this API and all of its resource paths within the API Management service instance. It is appended to the API endpoint base URL specified during the service instance creation to form a public URL for this API. + * + * @param path the path value to set + * @return the ApiTagResourceContractProperties object itself. + */ + public ApiTagResourceContractProperties withPath(String path) { + this.path = path; + return this; + } + + /** + * Get describes on which protocols the operations in this API can be invoked. + * + * @return the protocols value + */ + public List protocols() { + return this.protocols; + } + + /** + * Set describes on which protocols the operations in this API can be invoked. + * + * @param protocols the protocols value to set + * @return the ApiTagResourceContractProperties object itself. + */ + public ApiTagResourceContractProperties withProtocols(List protocols) { + this.protocols = protocols; + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiType.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiType.java new file mode 100644 index 0000000000000..90968020ee068 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiType.java @@ -0,0 +1,41 @@ +/** + * 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.apimanagement.v2019_01_01; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for ApiType. + */ +public final class ApiType extends ExpandableStringEnum { + /** Static value http for ApiType. */ + public static final ApiType HTTP = fromString("http"); + + /** Static value soap for ApiType. */ + public static final ApiType SOAP = fromString("soap"); + + /** + * Creates or finds a ApiType from its string representation. + * @param name a name to look for + * @return the corresponding ApiType + */ + @JsonCreator + public static ApiType fromString(String name) { + return fromString(name, ApiType.class); + } + + /** + * @return known ApiType values + */ + public static Collection values() { + return values(ApiType.class); + } +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiUpdateContract.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiUpdateContract.java new file mode 100644 index 0000000000000..f233b77ea0aad --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiUpdateContract.java @@ -0,0 +1,430 @@ +/** + * 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.apimanagement.v2019_01_01; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; + +/** + * API update contract details. + */ +@JsonFlatten +public class ApiUpdateContract { + /** + * Description of the API. May include HTML formatting tags. + */ + @JsonProperty(value = "properties.description") + private String description; + + /** + * Collection of authentication settings included into this API. + */ + @JsonProperty(value = "properties.authenticationSettings") + private AuthenticationSettingsContract authenticationSettings; + + /** + * Protocols over which API is made available. + */ + @JsonProperty(value = "properties.subscriptionKeyParameterNames") + private SubscriptionKeyParameterNamesContract subscriptionKeyParameterNames; + + /** + * Type of API. Possible values include: 'http', 'soap'. + */ + @JsonProperty(value = "properties.type") + private ApiType apiType; + + /** + * Describes the Revision of the Api. If no value is provided, default + * revision 1 is created. + */ + @JsonProperty(value = "properties.apiRevision") + private String apiRevision; + + /** + * Indicates the Version identifier of the API if the API is versioned. + */ + @JsonProperty(value = "properties.apiVersion") + private String apiVersion; + + /** + * Indicates if API revision is current api revision. + */ + @JsonProperty(value = "properties.isCurrent") + private Boolean isCurrent; + + /** + * Indicates if API revision is accessible via the gateway. + */ + @JsonProperty(value = "properties.isOnline", access = JsonProperty.Access.WRITE_ONLY) + private Boolean isOnline; + + /** + * Description of the Api Revision. + */ + @JsonProperty(value = "properties.apiRevisionDescription") + private String apiRevisionDescription; + + /** + * Description of the Api Version. + */ + @JsonProperty(value = "properties.apiVersionDescription") + private String apiVersionDescription; + + /** + * A resource identifier for the related ApiVersionSet. + */ + @JsonProperty(value = "properties.apiVersionSetId") + private String apiVersionSetId; + + /** + * Specifies whether an API or Product subscription is required for + * accessing the API. + */ + @JsonProperty(value = "properties.subscriptionRequired") + private Boolean subscriptionRequired; + + /** + * API name. + */ + @JsonProperty(value = "properties.displayName") + private String displayName; + + /** + * Absolute URL of the backend service implementing this API. + */ + @JsonProperty(value = "properties.serviceUrl") + private String serviceUrl; + + /** + * Relative URL uniquely identifying this API and all of its resource paths + * within the API Management service instance. It is appended to the API + * endpoint base URL specified during the service instance creation to form + * a public URL for this API. + */ + @JsonProperty(value = "properties.path") + private String path; + + /** + * Describes on which protocols the operations in this API can be invoked. + */ + @JsonProperty(value = "properties.protocols") + private List protocols; + + /** + * Get description of the API. May include HTML formatting tags. + * + * @return the description value + */ + public String description() { + return this.description; + } + + /** + * Set description of the API. May include HTML formatting tags. + * + * @param description the description value to set + * @return the ApiUpdateContract object itself. + */ + public ApiUpdateContract withDescription(String description) { + this.description = description; + return this; + } + + /** + * Get collection of authentication settings included into this API. + * + * @return the authenticationSettings value + */ + public AuthenticationSettingsContract authenticationSettings() { + return this.authenticationSettings; + } + + /** + * Set collection of authentication settings included into this API. + * + * @param authenticationSettings the authenticationSettings value to set + * @return the ApiUpdateContract object itself. + */ + public ApiUpdateContract withAuthenticationSettings(AuthenticationSettingsContract authenticationSettings) { + this.authenticationSettings = authenticationSettings; + return this; + } + + /** + * Get protocols over which API is made available. + * + * @return the subscriptionKeyParameterNames value + */ + public SubscriptionKeyParameterNamesContract subscriptionKeyParameterNames() { + return this.subscriptionKeyParameterNames; + } + + /** + * Set protocols over which API is made available. + * + * @param subscriptionKeyParameterNames the subscriptionKeyParameterNames value to set + * @return the ApiUpdateContract object itself. + */ + public ApiUpdateContract withSubscriptionKeyParameterNames(SubscriptionKeyParameterNamesContract subscriptionKeyParameterNames) { + this.subscriptionKeyParameterNames = subscriptionKeyParameterNames; + return this; + } + + /** + * Get type of API. Possible values include: 'http', 'soap'. + * + * @return the apiType value + */ + public ApiType apiType() { + return this.apiType; + } + + /** + * Set type of API. Possible values include: 'http', 'soap'. + * + * @param apiType the apiType value to set + * @return the ApiUpdateContract object itself. + */ + public ApiUpdateContract withApiType(ApiType apiType) { + this.apiType = apiType; + return this; + } + + /** + * Get describes the Revision of the Api. If no value is provided, default revision 1 is created. + * + * @return the apiRevision value + */ + public String apiRevision() { + return this.apiRevision; + } + + /** + * Set describes the Revision of the Api. If no value is provided, default revision 1 is created. + * + * @param apiRevision the apiRevision value to set + * @return the ApiUpdateContract object itself. + */ + public ApiUpdateContract withApiRevision(String apiRevision) { + this.apiRevision = apiRevision; + return this; + } + + /** + * Get indicates the Version identifier of the API if the API is versioned. + * + * @return the apiVersion value + */ + public String apiVersion() { + return this.apiVersion; + } + + /** + * Set indicates the Version identifier of the API if the API is versioned. + * + * @param apiVersion the apiVersion value to set + * @return the ApiUpdateContract object itself. + */ + public ApiUpdateContract withApiVersion(String apiVersion) { + this.apiVersion = apiVersion; + return this; + } + + /** + * Get indicates if API revision is current api revision. + * + * @return the isCurrent value + */ + public Boolean isCurrent() { + return this.isCurrent; + } + + /** + * Set indicates if API revision is current api revision. + * + * @param isCurrent the isCurrent value to set + * @return the ApiUpdateContract object itself. + */ + public ApiUpdateContract withIsCurrent(Boolean isCurrent) { + this.isCurrent = isCurrent; + return this; + } + + /** + * Get indicates if API revision is accessible via the gateway. + * + * @return the isOnline value + */ + public Boolean isOnline() { + return this.isOnline; + } + + /** + * Get description of the Api Revision. + * + * @return the apiRevisionDescription value + */ + public String apiRevisionDescription() { + return this.apiRevisionDescription; + } + + /** + * Set description of the Api Revision. + * + * @param apiRevisionDescription the apiRevisionDescription value to set + * @return the ApiUpdateContract object itself. + */ + public ApiUpdateContract withApiRevisionDescription(String apiRevisionDescription) { + this.apiRevisionDescription = apiRevisionDescription; + return this; + } + + /** + * Get description of the Api Version. + * + * @return the apiVersionDescription value + */ + public String apiVersionDescription() { + return this.apiVersionDescription; + } + + /** + * Set description of the Api Version. + * + * @param apiVersionDescription the apiVersionDescription value to set + * @return the ApiUpdateContract object itself. + */ + public ApiUpdateContract withApiVersionDescription(String apiVersionDescription) { + this.apiVersionDescription = apiVersionDescription; + return this; + } + + /** + * Get a resource identifier for the related ApiVersionSet. + * + * @return the apiVersionSetId value + */ + public String apiVersionSetId() { + return this.apiVersionSetId; + } + + /** + * Set a resource identifier for the related ApiVersionSet. + * + * @param apiVersionSetId the apiVersionSetId value to set + * @return the ApiUpdateContract object itself. + */ + public ApiUpdateContract withApiVersionSetId(String apiVersionSetId) { + this.apiVersionSetId = apiVersionSetId; + return this; + } + + /** + * Get specifies whether an API or Product subscription is required for accessing the API. + * + * @return the subscriptionRequired value + */ + public Boolean subscriptionRequired() { + return this.subscriptionRequired; + } + + /** + * Set specifies whether an API or Product subscription is required for accessing the API. + * + * @param subscriptionRequired the subscriptionRequired value to set + * @return the ApiUpdateContract object itself. + */ + public ApiUpdateContract withSubscriptionRequired(Boolean subscriptionRequired) { + this.subscriptionRequired = subscriptionRequired; + return this; + } + + /** + * Get aPI name. + * + * @return the displayName value + */ + public String displayName() { + return this.displayName; + } + + /** + * Set aPI name. + * + * @param displayName the displayName value to set + * @return the ApiUpdateContract object itself. + */ + public ApiUpdateContract withDisplayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Get absolute URL of the backend service implementing this API. + * + * @return the serviceUrl value + */ + public String serviceUrl() { + return this.serviceUrl; + } + + /** + * Set absolute URL of the backend service implementing this API. + * + * @param serviceUrl the serviceUrl value to set + * @return the ApiUpdateContract object itself. + */ + public ApiUpdateContract withServiceUrl(String serviceUrl) { + this.serviceUrl = serviceUrl; + return this; + } + + /** + * Get relative URL uniquely identifying this API and all of its resource paths within the API Management service instance. It is appended to the API endpoint base URL specified during the service instance creation to form a public URL for this API. + * + * @return the path value + */ + public String path() { + return this.path; + } + + /** + * Set relative URL uniquely identifying this API and all of its resource paths within the API Management service instance. It is appended to the API endpoint base URL specified during the service instance creation to form a public URL for this API. + * + * @param path the path value to set + * @return the ApiUpdateContract object itself. + */ + public ApiUpdateContract withPath(String path) { + this.path = path; + return this; + } + + /** + * Get describes on which protocols the operations in this API can be invoked. + * + * @return the protocols value + */ + public List protocols() { + return this.protocols; + } + + /** + * Set describes on which protocols the operations in this API can be invoked. + * + * @param protocols the protocols value to set + * @return the ApiUpdateContract object itself. + */ + public ApiUpdateContract withProtocols(List protocols) { + this.protocols = protocols; + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiVersionSetContract.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiVersionSetContract.java new file mode 100644 index 0000000000000..1efeea7bd354d --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiVersionSetContract.java @@ -0,0 +1,243 @@ +/** + * 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.apimanagement.v2019_01_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.apimanagement.v2019_01_01.implementation.ApiVersionSetContractInner; +import com.microsoft.azure.arm.model.Indexable; +import com.microsoft.azure.arm.model.Creatable; +import com.microsoft.azure.arm.model.Updatable; +import com.microsoft.azure.arm.model.Appliable; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.apimanagement.v2019_01_01.implementation.ApiManagementManager; + +/** + * Type representing ApiVersionSetContract. + */ +public interface ApiVersionSetContract extends HasInner, Indexable, Updatable, HasManager { + /** + * @return the description value. + */ + String description(); + + /** + * @return the displayName value. + */ + String displayName(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the type value. + */ + String type(); + + /** + * @return the versionHeaderName value. + */ + String versionHeaderName(); + + /** + * @return the versioningScheme value. + */ + VersioningScheme versioningScheme(); + + /** + * @return the versionQueryName value. + */ + String versionQueryName(); + + /** + * The entirety of the ApiVersionSetContract definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithResourceGroupName, DefinitionStages.WithServiceName, DefinitionStages.WithIfMatch, DefinitionStages.WithDisplayName, DefinitionStages.WithVersioningScheme, DefinitionStages.WithCreate { + } + + /** + * Grouping of ApiVersionSetContract definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a ApiVersionSetContract definition. + */ + interface Blank extends WithResourceGroupName { + } + + /** + * The stage of the apiversionsetcontract definition allowing to specify ResourceGroupName. + */ + interface WithResourceGroupName { + /** + * Specifies resourceGroupName. + * @param resourceGroupName The name of the resource group + * @return the next definition stage + */ + WithServiceName withResourceGroupName(String resourceGroupName); + } + + /** + * The stage of the apiversionsetcontract definition allowing to specify ServiceName. + */ + interface WithServiceName { + /** + * Specifies serviceName. + * @param serviceName The name of the API Management service + * @return the next definition stage + */ + WithIfMatch withServiceName(String serviceName); + } + + /** + * The stage of the apiversionsetcontract definition allowing to specify IfMatch. + */ + interface WithIfMatch { + /** + * Specifies ifMatch. + * @param ifMatch ETag of the Entity. Not required when creating an entity, but required when updating an entity + * @return the next definition stage + */ + WithDisplayName withIfMatch(String ifMatch); + } + + /** + * The stage of the apiversionsetcontract definition allowing to specify DisplayName. + */ + interface WithDisplayName { + /** + * Specifies displayName. + * @param displayName Name of API Version Set + * @return the next definition stage + */ + WithVersioningScheme withDisplayName(String displayName); + } + + /** + * The stage of the apiversionsetcontract definition allowing to specify VersioningScheme. + */ + interface WithVersioningScheme { + /** + * Specifies versioningScheme. + * @param versioningScheme An value that determines where the API Version identifer will be located in a HTTP request. Possible values include: 'Segment', 'Query', 'Header' + * @return the next definition stage + */ + WithCreate withVersioningScheme(VersioningScheme versioningScheme); + } + + /** + * The stage of the apiversionsetcontract definition allowing to specify Description. + */ + interface WithDescription { + /** + * Specifies description. + * @param description Description of API Version Set + * @return the next definition stage + */ + WithCreate withDescription(String description); + } + + /** + * The stage of the apiversionsetcontract definition allowing to specify VersionHeaderName. + */ + interface WithVersionHeaderName { + /** + * Specifies versionHeaderName. + * @param versionHeaderName Name of HTTP header parameter that indicates the API Version if versioningScheme is set to `header` + * @return the next definition stage + */ + WithCreate withVersionHeaderName(String versionHeaderName); + } + + /** + * The stage of the apiversionsetcontract definition allowing to specify VersionQueryName. + */ + interface WithVersionQueryName { + /** + * Specifies versionQueryName. + * @param versionQueryName Name of query parameter that indicates the API Version if versioningScheme is set to `query` + * @return the next definition stage + */ + WithCreate withVersionQueryName(String versionQueryName); + } + + /** + * The stage of the definition which contains all the minimum required inputs for + * the resource to be created (via {@link WithCreate#create()}), but also allows + * for any other optional settings to be specified. + */ + interface WithCreate extends Creatable, DefinitionStages.WithDescription, DefinitionStages.WithVersionHeaderName, DefinitionStages.WithVersionQueryName { + } + } + /** + * The template for a ApiVersionSetContract update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithIfMatch, UpdateStages.WithDescription, UpdateStages.WithVersionHeaderName, UpdateStages.WithVersionQueryName { + } + + /** + * Grouping of ApiVersionSetContract update stages. + */ + interface UpdateStages { + /** + * The stage of the apiversionsetcontract update allowing to specify IfMatch. + */ + interface WithIfMatch { + /** + * Specifies ifMatch. + * @param ifMatch ETag of the Entity. Not required when creating an entity, but required when updating an entity + * @return the next update stage + */ + Update withIfMatch(String ifMatch); + } + + /** + * The stage of the apiversionsetcontract update allowing to specify Description. + */ + interface WithDescription { + /** + * Specifies description. + * @param description Description of API Version Set + * @return the next update stage + */ + Update withDescription(String description); + } + + /** + * The stage of the apiversionsetcontract update allowing to specify VersionHeaderName. + */ + interface WithVersionHeaderName { + /** + * Specifies versionHeaderName. + * @param versionHeaderName Name of HTTP header parameter that indicates the API Version if versioningScheme is set to `header` + * @return the next update stage + */ + Update withVersionHeaderName(String versionHeaderName); + } + + /** + * The stage of the apiversionsetcontract update allowing to specify VersionQueryName. + */ + interface WithVersionQueryName { + /** + * Specifies versionQueryName. + * @param versionQueryName Name of query parameter that indicates the API Version if versioningScheme is set to `query` + * @return the next update stage + */ + Update withVersionQueryName(String versionQueryName); + } + + } +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiVersionSetContractDetails.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiVersionSetContractDetails.java new file mode 100644 index 0000000000000..17d99dd16c644 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiVersionSetContractDetails.java @@ -0,0 +1,179 @@ +/** + * 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.apimanagement.v2019_01_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * An API Version Set contains the common configuration for a set of API + * Versions relating. + */ +public class ApiVersionSetContractDetails { + /** + * Identifier for existing API Version Set. Omit this value to create a new + * Version Set. + */ + @JsonProperty(value = "id") + private String id; + + /** + * The display Name of the API Version Set. + */ + @JsonProperty(value = "name") + private String name; + + /** + * Description of API Version Set. + */ + @JsonProperty(value = "description") + private String description; + + /** + * An value that determines where the API Version identifer will be located + * in a HTTP request. Possible values include: 'Segment', 'Query', + * 'Header'. + */ + @JsonProperty(value = "versioningScheme") + private String versioningScheme; + + /** + * Name of query parameter that indicates the API Version if + * versioningScheme is set to `query`. + */ + @JsonProperty(value = "versionQueryName") + private String versionQueryName; + + /** + * Name of HTTP header parameter that indicates the API Version if + * versioningScheme is set to `header`. + */ + @JsonProperty(value = "versionHeaderName") + private String versionHeaderName; + + /** + * Get identifier for existing API Version Set. Omit this value to create a new Version Set. + * + * @return the id value + */ + public String id() { + return this.id; + } + + /** + * Set identifier for existing API Version Set. Omit this value to create a new Version Set. + * + * @param id the id value to set + * @return the ApiVersionSetContractDetails object itself. + */ + public ApiVersionSetContractDetails withId(String id) { + this.id = id; + return this; + } + + /** + * Get the display Name of the API Version Set. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set the display Name of the API Version Set. + * + * @param name the name value to set + * @return the ApiVersionSetContractDetails object itself. + */ + public ApiVersionSetContractDetails withName(String name) { + this.name = name; + return this; + } + + /** + * Get description of API Version Set. + * + * @return the description value + */ + public String description() { + return this.description; + } + + /** + * Set description of API Version Set. + * + * @param description the description value to set + * @return the ApiVersionSetContractDetails object itself. + */ + public ApiVersionSetContractDetails withDescription(String description) { + this.description = description; + return this; + } + + /** + * Get an value that determines where the API Version identifer will be located in a HTTP request. Possible values include: 'Segment', 'Query', 'Header'. + * + * @return the versioningScheme value + */ + public String versioningScheme() { + return this.versioningScheme; + } + + /** + * Set an value that determines where the API Version identifer will be located in a HTTP request. Possible values include: 'Segment', 'Query', 'Header'. + * + * @param versioningScheme the versioningScheme value to set + * @return the ApiVersionSetContractDetails object itself. + */ + public ApiVersionSetContractDetails withVersioningScheme(String versioningScheme) { + this.versioningScheme = versioningScheme; + return this; + } + + /** + * Get name of query parameter that indicates the API Version if versioningScheme is set to `query`. + * + * @return the versionQueryName value + */ + public String versionQueryName() { + return this.versionQueryName; + } + + /** + * Set name of query parameter that indicates the API Version if versioningScheme is set to `query`. + * + * @param versionQueryName the versionQueryName value to set + * @return the ApiVersionSetContractDetails object itself. + */ + public ApiVersionSetContractDetails withVersionQueryName(String versionQueryName) { + this.versionQueryName = versionQueryName; + return this; + } + + /** + * Get name of HTTP header parameter that indicates the API Version if versioningScheme is set to `header`. + * + * @return the versionHeaderName value + */ + public String versionHeaderName() { + return this.versionHeaderName; + } + + /** + * Set name of HTTP header parameter that indicates the API Version if versioningScheme is set to `header`. + * + * @param versionHeaderName the versionHeaderName value to set + * @return the ApiVersionSetContractDetails object itself. + */ + public ApiVersionSetContractDetails withVersionHeaderName(String versionHeaderName) { + this.versionHeaderName = versionHeaderName; + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiVersionSetCreateOrUpdateHeaders.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiVersionSetCreateOrUpdateHeaders.java new file mode 100644 index 0000000000000..4b697ab3f1eed --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiVersionSetCreateOrUpdateHeaders.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.apimanagement.v2019_01_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for CreateOrUpdate operation. + */ +public class ApiVersionSetCreateOrUpdateHeaders { + /** + * Current entity state version. Should be treated as opaque and used to + * make conditional HTTP requests. + */ + @JsonProperty(value = "ETag") + private String eTag; + + /** + * Get current entity state version. Should be treated as opaque and used to make conditional HTTP requests. + * + * @return the eTag value + */ + public String eTag() { + return this.eTag; + } + + /** + * Set current entity state version. Should be treated as opaque and used to make conditional HTTP requests. + * + * @param eTag the eTag value to set + * @return the ApiVersionSetCreateOrUpdateHeaders object itself. + */ + public ApiVersionSetCreateOrUpdateHeaders withETag(String eTag) { + this.eTag = eTag; + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiVersionSetEntityBase.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiVersionSetEntityBase.java new file mode 100644 index 0000000000000..e12d661283c7b --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiVersionSetEntityBase.java @@ -0,0 +1,97 @@ +/** + * 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.apimanagement.v2019_01_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Api Version set base parameters. + */ +public class ApiVersionSetEntityBase { + /** + * Description of API Version Set. + */ + @JsonProperty(value = "description") + private String description; + + /** + * Name of query parameter that indicates the API Version if + * versioningScheme is set to `query`. + */ + @JsonProperty(value = "versionQueryName") + private String versionQueryName; + + /** + * Name of HTTP header parameter that indicates the API Version if + * versioningScheme is set to `header`. + */ + @JsonProperty(value = "versionHeaderName") + private String versionHeaderName; + + /** + * Get description of API Version Set. + * + * @return the description value + */ + public String description() { + return this.description; + } + + /** + * Set description of API Version Set. + * + * @param description the description value to set + * @return the ApiVersionSetEntityBase object itself. + */ + public ApiVersionSetEntityBase withDescription(String description) { + this.description = description; + return this; + } + + /** + * Get name of query parameter that indicates the API Version if versioningScheme is set to `query`. + * + * @return the versionQueryName value + */ + public String versionQueryName() { + return this.versionQueryName; + } + + /** + * Set name of query parameter that indicates the API Version if versioningScheme is set to `query`. + * + * @param versionQueryName the versionQueryName value to set + * @return the ApiVersionSetEntityBase object itself. + */ + public ApiVersionSetEntityBase withVersionQueryName(String versionQueryName) { + this.versionQueryName = versionQueryName; + return this; + } + + /** + * Get name of HTTP header parameter that indicates the API Version if versioningScheme is set to `header`. + * + * @return the versionHeaderName value + */ + public String versionHeaderName() { + return this.versionHeaderName; + } + + /** + * Set name of HTTP header parameter that indicates the API Version if versioningScheme is set to `header`. + * + * @param versionHeaderName the versionHeaderName value to set + * @return the ApiVersionSetEntityBase object itself. + */ + public ApiVersionSetEntityBase withVersionHeaderName(String versionHeaderName) { + this.versionHeaderName = versionHeaderName; + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiVersionSetGetEntityTagHeaders.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiVersionSetGetEntityTagHeaders.java new file mode 100644 index 0000000000000..3fd2e74be3a5b --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiVersionSetGetEntityTagHeaders.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.apimanagement.v2019_01_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for GetEntityTag operation. + */ +public class ApiVersionSetGetEntityTagHeaders { + /** + * Current entity state version. Should be treated as opaque and used to + * make conditional HTTP requests. + */ + @JsonProperty(value = "ETag") + private String eTag; + + /** + * Get current entity state version. Should be treated as opaque and used to make conditional HTTP requests. + * + * @return the eTag value + */ + public String eTag() { + return this.eTag; + } + + /** + * Set current entity state version. Should be treated as opaque and used to make conditional HTTP requests. + * + * @param eTag the eTag value to set + * @return the ApiVersionSetGetEntityTagHeaders object itself. + */ + public ApiVersionSetGetEntityTagHeaders withETag(String eTag) { + this.eTag = eTag; + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiVersionSetGetHeaders.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiVersionSetGetHeaders.java new file mode 100644 index 0000000000000..f5f4d25f04c12 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiVersionSetGetHeaders.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.apimanagement.v2019_01_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for Get operation. + */ +public class ApiVersionSetGetHeaders { + /** + * Current entity state version. Should be treated as opaque and used to + * make conditional HTTP requests. + */ + @JsonProperty(value = "ETag") + private String eTag; + + /** + * Get current entity state version. Should be treated as opaque and used to make conditional HTTP requests. + * + * @return the eTag value + */ + public String eTag() { + return this.eTag; + } + + /** + * Set current entity state version. Should be treated as opaque and used to make conditional HTTP requests. + * + * @param eTag the eTag value to set + * @return the ApiVersionSetGetHeaders object itself. + */ + public ApiVersionSetGetHeaders withETag(String eTag) { + this.eTag = eTag; + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiVersionSetUpdateParameters.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiVersionSetUpdateParameters.java new file mode 100644 index 0000000000000..8fe0d2adb24ff --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiVersionSetUpdateParameters.java @@ -0,0 +1,153 @@ +/** + * 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.apimanagement.v2019_01_01; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; + +/** + * Parameters to update or create an Api Version Set Contract. + */ +@JsonFlatten +public class ApiVersionSetUpdateParameters { + /** + * Description of API Version Set. + */ + @JsonProperty(value = "properties.description") + private String description; + + /** + * Name of query parameter that indicates the API Version if + * versioningScheme is set to `query`. + */ + @JsonProperty(value = "properties.versionQueryName") + private String versionQueryName; + + /** + * Name of HTTP header parameter that indicates the API Version if + * versioningScheme is set to `header`. + */ + @JsonProperty(value = "properties.versionHeaderName") + private String versionHeaderName; + + /** + * Name of API Version Set. + */ + @JsonProperty(value = "properties.displayName") + private String displayName; + + /** + * An value that determines where the API Version identifer will be located + * in a HTTP request. Possible values include: 'Segment', 'Query', + * 'Header'. + */ + @JsonProperty(value = "properties.versioningScheme") + private VersioningScheme versioningScheme; + + /** + * Get description of API Version Set. + * + * @return the description value + */ + public String description() { + return this.description; + } + + /** + * Set description of API Version Set. + * + * @param description the description value to set + * @return the ApiVersionSetUpdateParameters object itself. + */ + public ApiVersionSetUpdateParameters withDescription(String description) { + this.description = description; + return this; + } + + /** + * Get name of query parameter that indicates the API Version if versioningScheme is set to `query`. + * + * @return the versionQueryName value + */ + public String versionQueryName() { + return this.versionQueryName; + } + + /** + * Set name of query parameter that indicates the API Version if versioningScheme is set to `query`. + * + * @param versionQueryName the versionQueryName value to set + * @return the ApiVersionSetUpdateParameters object itself. + */ + public ApiVersionSetUpdateParameters withVersionQueryName(String versionQueryName) { + this.versionQueryName = versionQueryName; + return this; + } + + /** + * Get name of HTTP header parameter that indicates the API Version if versioningScheme is set to `header`. + * + * @return the versionHeaderName value + */ + public String versionHeaderName() { + return this.versionHeaderName; + } + + /** + * Set name of HTTP header parameter that indicates the API Version if versioningScheme is set to `header`. + * + * @param versionHeaderName the versionHeaderName value to set + * @return the ApiVersionSetUpdateParameters object itself. + */ + public ApiVersionSetUpdateParameters withVersionHeaderName(String versionHeaderName) { + this.versionHeaderName = versionHeaderName; + return this; + } + + /** + * Get name of API Version Set. + * + * @return the displayName value + */ + public String displayName() { + return this.displayName; + } + + /** + * Set name of API Version Set. + * + * @param displayName the displayName value to set + * @return the ApiVersionSetUpdateParameters object itself. + */ + public ApiVersionSetUpdateParameters withDisplayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Get an value that determines where the API Version identifer will be located in a HTTP request. Possible values include: 'Segment', 'Query', 'Header'. + * + * @return the versioningScheme value + */ + public VersioningScheme versioningScheme() { + return this.versioningScheme; + } + + /** + * Set an value that determines where the API Version identifer will be located in a HTTP request. Possible values include: 'Segment', 'Query', 'Header'. + * + * @param versioningScheme the versioningScheme value to set + * @return the ApiVersionSetUpdateParameters object itself. + */ + public ApiVersionSetUpdateParameters withVersioningScheme(VersioningScheme versioningScheme) { + this.versioningScheme = versioningScheme; + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiVersionSets.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiVersionSets.java new file mode 100644 index 0000000000000..ad4c098e7f4e9 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiVersionSets.java @@ -0,0 +1,65 @@ +/** + * 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.apimanagement.v2019_01_01; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import rx.Completable; +import rx.Observable; +import com.microsoft.azure.management.apimanagement.v2019_01_01.implementation.ApiVersionSetsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing ApiVersionSets. + */ +public interface ApiVersionSets extends SupportsCreating, HasInner { + /** + * Lists a collection of API Version Sets in the specified service instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByServiceAsync(final String resourceGroupName, final String serviceName); + + /** + * Gets the entity state (Etag) version of the Api Version Set specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param versionSetId Api Version Set identifier. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable getEntityTagAsync(String resourceGroupName, String serviceName, String versionSetId); + + /** + * Gets the details of the Api Version Set specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param versionSetId Api Version Set identifier. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String resourceGroupName, String serviceName, String versionSetId); + + /** + * Deletes specific Api Version Set. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param versionSetId Api Version Set identifier. Must be unique in the current API Management service instance. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable deleteAsync(String resourceGroupName, String serviceName, String versionSetId, String ifMatch); + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApimResource.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApimResource.java new file mode 100644 index 0000000000000..d4883dd497f71 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApimResource.java @@ -0,0 +1,45 @@ +/** + * 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.apimanagement.v2019_01_01; + +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.azure.ProxyResource; + +/** + * The Resource definition. + */ +public class ApimResource extends ProxyResource { + /** + * Resource tags. + */ + @JsonProperty(value = "tags") + private Map tags; + + /** + * Get resource tags. + * + * @return the tags value + */ + public Map tags() { + return this.tags; + } + + /** + * Set resource tags. + * + * @param tags the tags value to set + * @return the ApimResource object itself. + */ + public ApimResource withTags(Map tags) { + this.tags = tags; + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/Apis.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/Apis.java new file mode 100644 index 0000000000000..ba359567dd06c --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/Apis.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.apimanagement.v2019_01_01; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import rx.Completable; +import rx.Observable; +import com.microsoft.azure.management.apimanagement.v2019_01_01.implementation.ApisInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing Apis. + */ +public interface Apis extends SupportsCreating, HasInner { + /** + * Lists all APIs of the API Management service instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByServiceAsync(final String resourceGroupName, final String serviceName); + + /** + * Gets the entity state (Etag) version of the API specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable getEntityTagAsync(String resourceGroupName, String serviceName, String apiId); + + /** + * Gets the details of the API specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String resourceGroupName, String serviceName, String apiId); + + /** + * Deletes the specified API of the API Management service instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable deleteAsync(String resourceGroupName, String serviceName, String apiId, String ifMatch); + + /** + * Lists a collection of apis associated with tags. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByTagsAsync(final String resourceGroupName, final String serviceName); + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/AsyncOperationStatus.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/AsyncOperationStatus.java new file mode 100644 index 0000000000000..74f6b04b3cf2d --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/AsyncOperationStatus.java @@ -0,0 +1,59 @@ +/** + * 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.apimanagement.v2019_01_01; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for AsyncOperationStatus. + */ +public enum AsyncOperationStatus { + /** Enum value Started. */ + STARTED("Started"), + + /** Enum value InProgress. */ + IN_PROGRESS("InProgress"), + + /** Enum value Succeeded. */ + SUCCEEDED("Succeeded"), + + /** Enum value Failed. */ + FAILED("Failed"); + + /** The actual serialized value for a AsyncOperationStatus instance. */ + private String value; + + AsyncOperationStatus(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a AsyncOperationStatus instance. + * + * @param value the serialized value to parse. + * @return the parsed AsyncOperationStatus object, or null if unable to parse. + */ + @JsonCreator + public static AsyncOperationStatus fromString(String value) { + AsyncOperationStatus[] items = AsyncOperationStatus.values(); + for (AsyncOperationStatus item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/AuthenticationSettingsContract.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/AuthenticationSettingsContract.java new file mode 100644 index 0000000000000..46f05245725c3 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/AuthenticationSettingsContract.java @@ -0,0 +1,97 @@ +/** + * 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.apimanagement.v2019_01_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * API Authentication Settings. + */ +public class AuthenticationSettingsContract { + /** + * OAuth2 Authentication settings. + */ + @JsonProperty(value = "oAuth2") + private OAuth2AuthenticationSettingsContract oAuth2; + + /** + * OpenID Connect Authentication Settings. + */ + @JsonProperty(value = "openid") + private OpenIdAuthenticationSettingsContract openid; + + /** + * Specifies whether subscription key is required during call to this API, + * true - API is included into closed products only, false - API is + * included into open products alone, null - there is a mix of products. + */ + @JsonProperty(value = "subscriptionKeyRequired") + private Boolean subscriptionKeyRequired; + + /** + * Get oAuth2 Authentication settings. + * + * @return the oAuth2 value + */ + public OAuth2AuthenticationSettingsContract oAuth2() { + return this.oAuth2; + } + + /** + * Set oAuth2 Authentication settings. + * + * @param oAuth2 the oAuth2 value to set + * @return the AuthenticationSettingsContract object itself. + */ + public AuthenticationSettingsContract withOAuth2(OAuth2AuthenticationSettingsContract oAuth2) { + this.oAuth2 = oAuth2; + return this; + } + + /** + * Get openID Connect Authentication Settings. + * + * @return the openid value + */ + public OpenIdAuthenticationSettingsContract openid() { + return this.openid; + } + + /** + * Set openID Connect Authentication Settings. + * + * @param openid the openid value to set + * @return the AuthenticationSettingsContract object itself. + */ + public AuthenticationSettingsContract withOpenid(OpenIdAuthenticationSettingsContract openid) { + this.openid = openid; + return this; + } + + /** + * Get specifies whether subscription key is required during call to this API, true - API is included into closed products only, false - API is included into open products alone, null - there is a mix of products. + * + * @return the subscriptionKeyRequired value + */ + public Boolean subscriptionKeyRequired() { + return this.subscriptionKeyRequired; + } + + /** + * Set specifies whether subscription key is required during call to this API, true - API is included into closed products only, false - API is included into open products alone, null - there is a mix of products. + * + * @param subscriptionKeyRequired the subscriptionKeyRequired value to set + * @return the AuthenticationSettingsContract object itself. + */ + public AuthenticationSettingsContract withSubscriptionKeyRequired(Boolean subscriptionKeyRequired) { + this.subscriptionKeyRequired = subscriptionKeyRequired; + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/AuthorizationMethod.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/AuthorizationMethod.java new file mode 100644 index 0000000000000..72aafa5ab0954 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/AuthorizationMethod.java @@ -0,0 +1,71 @@ +/** + * 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.apimanagement.v2019_01_01; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for AuthorizationMethod. + */ +public enum AuthorizationMethod { + /** Enum value HEAD. */ + HEAD("HEAD"), + + /** Enum value OPTIONS. */ + OPTIONS("OPTIONS"), + + /** Enum value TRACE. */ + TRACE("TRACE"), + + /** Enum value GET. */ + GET("GET"), + + /** Enum value POST. */ + POST("POST"), + + /** Enum value PUT. */ + PUT("PUT"), + + /** Enum value PATCH. */ + PATCH("PATCH"), + + /** Enum value DELETE. */ + DELETE("DELETE"); + + /** The actual serialized value for a AuthorizationMethod instance. */ + private String value; + + AuthorizationMethod(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a AuthorizationMethod instance. + * + * @param value the serialized value to parse. + * @return the parsed AuthorizationMethod object, or null if unable to parse. + */ + @JsonCreator + public static AuthorizationMethod fromString(String value) { + AuthorizationMethod[] items = AuthorizationMethod.values(); + for (AuthorizationMethod item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/AuthorizationServerContract.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/AuthorizationServerContract.java new file mode 100644 index 0000000000000..edf3892a4192d --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/AuthorizationServerContract.java @@ -0,0 +1,527 @@ +/** + * 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.apimanagement.v2019_01_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.apimanagement.v2019_01_01.implementation.AuthorizationServerContractInner; +import com.microsoft.azure.arm.model.Indexable; +import com.microsoft.azure.arm.model.Creatable; +import com.microsoft.azure.arm.model.Updatable; +import com.microsoft.azure.arm.model.Appliable; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.apimanagement.v2019_01_01.implementation.ApiManagementManager; +import java.util.List; + +/** + * Type representing AuthorizationServerContract. + */ +public interface AuthorizationServerContract extends HasInner, Indexable, Updatable, HasManager { + /** + * @return the authorizationEndpoint value. + */ + String authorizationEndpoint(); + + /** + * @return the authorizationMethods value. + */ + List authorizationMethods(); + + /** + * @return the bearerTokenSendingMethods value. + */ + List bearerTokenSendingMethods(); + + /** + * @return the clientAuthenticationMethod value. + */ + List clientAuthenticationMethod(); + + /** + * @return the clientId value. + */ + String clientId(); + + /** + * @return the clientRegistrationEndpoint value. + */ + String clientRegistrationEndpoint(); + + /** + * @return the clientSecret value. + */ + String clientSecret(); + + /** + * @return the defaultScope value. + */ + String defaultScope(); + + /** + * @return the description value. + */ + String description(); + + /** + * @return the displayName value. + */ + String displayName(); + + /** + * @return the grantTypes value. + */ + List grantTypes(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the resourceOwnerPassword value. + */ + String resourceOwnerPassword(); + + /** + * @return the resourceOwnerUsername value. + */ + String resourceOwnerUsername(); + + /** + * @return the supportState value. + */ + Boolean supportState(); + + /** + * @return the tokenBodyParameters value. + */ + List tokenBodyParameters(); + + /** + * @return the tokenEndpoint value. + */ + String tokenEndpoint(); + + /** + * @return the type value. + */ + String type(); + + /** + * The entirety of the AuthorizationServerContract definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithResourceGroupName, DefinitionStages.WithServiceName, DefinitionStages.WithIfMatch, DefinitionStages.WithAuthorizationEndpoint, DefinitionStages.WithClientId, DefinitionStages.WithClientRegistrationEndpoint, DefinitionStages.WithDisplayName, DefinitionStages.WithGrantTypes, DefinitionStages.WithCreate { + } + + /** + * Grouping of AuthorizationServerContract definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a AuthorizationServerContract definition. + */ + interface Blank extends WithResourceGroupName { + } + + /** + * The stage of the authorizationservercontract definition allowing to specify ResourceGroupName. + */ + interface WithResourceGroupName { + /** + * Specifies resourceGroupName. + * @param resourceGroupName The name of the resource group + * @return the next definition stage + */ + WithServiceName withResourceGroupName(String resourceGroupName); + } + + /** + * The stage of the authorizationservercontract definition allowing to specify ServiceName. + */ + interface WithServiceName { + /** + * Specifies serviceName. + * @param serviceName The name of the API Management service + * @return the next definition stage + */ + WithIfMatch withServiceName(String serviceName); + } + + /** + * The stage of the authorizationservercontract definition allowing to specify IfMatch. + */ + interface WithIfMatch { + /** + * Specifies ifMatch. + * @param ifMatch ETag of the Entity. Not required when creating an entity, but required when updating an entity + * @return the next definition stage + */ + WithAuthorizationEndpoint withIfMatch(String ifMatch); + } + + /** + * The stage of the authorizationservercontract definition allowing to specify AuthorizationEndpoint. + */ + interface WithAuthorizationEndpoint { + /** + * Specifies authorizationEndpoint. + * @param authorizationEndpoint OAuth authorization endpoint. See http://tools.ietf.org/html/rfc6749#section-3.2 + * @return the next definition stage + */ + WithClientId withAuthorizationEndpoint(String authorizationEndpoint); + } + + /** + * The stage of the authorizationservercontract definition allowing to specify ClientId. + */ + interface WithClientId { + /** + * Specifies clientId. + * @param clientId Client or app id registered with this authorization server + * @return the next definition stage + */ + WithClientRegistrationEndpoint withClientId(String clientId); + } + + /** + * The stage of the authorizationservercontract definition allowing to specify ClientRegistrationEndpoint. + */ + interface WithClientRegistrationEndpoint { + /** + * Specifies clientRegistrationEndpoint. + * @param clientRegistrationEndpoint Optional reference to a page where client or app registration for this authorization server is performed. Contains absolute URL to entity being referenced + * @return the next definition stage + */ + WithDisplayName withClientRegistrationEndpoint(String clientRegistrationEndpoint); + } + + /** + * The stage of the authorizationservercontract definition allowing to specify DisplayName. + */ + interface WithDisplayName { + /** + * Specifies displayName. + * @param displayName User-friendly authorization server name + * @return the next definition stage + */ + WithGrantTypes withDisplayName(String displayName); + } + + /** + * The stage of the authorizationservercontract definition allowing to specify GrantTypes. + */ + interface WithGrantTypes { + /** + * Specifies grantTypes. + * @param grantTypes Form of an authorization grant, which the client uses to request the access token + * @return the next definition stage + */ + WithCreate withGrantTypes(List grantTypes); + } + + /** + * The stage of the authorizationservercontract definition allowing to specify AuthorizationMethods. + */ + interface WithAuthorizationMethods { + /** + * Specifies authorizationMethods. + * @param authorizationMethods HTTP verbs supported by the authorization endpoint. GET must be always present. POST is optional + * @return the next definition stage + */ + WithCreate withAuthorizationMethods(List authorizationMethods); + } + + /** + * The stage of the authorizationservercontract definition allowing to specify BearerTokenSendingMethods. + */ + interface WithBearerTokenSendingMethods { + /** + * Specifies bearerTokenSendingMethods. + * @param bearerTokenSendingMethods Specifies the mechanism by which access token is passed to the API + * @return the next definition stage + */ + WithCreate withBearerTokenSendingMethods(List bearerTokenSendingMethods); + } + + /** + * The stage of the authorizationservercontract definition allowing to specify ClientAuthenticationMethod. + */ + interface WithClientAuthenticationMethod { + /** + * Specifies clientAuthenticationMethod. + * @param clientAuthenticationMethod Method of authentication supported by the token endpoint of this authorization server. Possible values are Basic and/or Body. When Body is specified, client credentials and other parameters are passed within the request body in the application/x-www-form-urlencoded format + * @return the next definition stage + */ + WithCreate withClientAuthenticationMethod(List clientAuthenticationMethod); + } + + /** + * The stage of the authorizationservercontract definition allowing to specify ClientSecret. + */ + interface WithClientSecret { + /** + * Specifies clientSecret. + * @param clientSecret Client or app secret registered with this authorization server + * @return the next definition stage + */ + WithCreate withClientSecret(String clientSecret); + } + + /** + * The stage of the authorizationservercontract definition allowing to specify DefaultScope. + */ + interface WithDefaultScope { + /** + * Specifies defaultScope. + * @param defaultScope Access token scope that is going to be requested by default. Can be overridden at the API level. Should be provided in the form of a string containing space-delimited values + * @return the next definition stage + */ + WithCreate withDefaultScope(String defaultScope); + } + + /** + * The stage of the authorizationservercontract definition allowing to specify Description. + */ + interface WithDescription { + /** + * Specifies description. + * @param description Description of the authorization server. Can contain HTML formatting tags + * @return the next definition stage + */ + WithCreate withDescription(String description); + } + + /** + * The stage of the authorizationservercontract definition allowing to specify ResourceOwnerPassword. + */ + interface WithResourceOwnerPassword { + /** + * Specifies resourceOwnerPassword. + * @param resourceOwnerPassword Can be optionally specified when resource owner password grant type is supported by this authorization server. Default resource owner password + * @return the next definition stage + */ + WithCreate withResourceOwnerPassword(String resourceOwnerPassword); + } + + /** + * The stage of the authorizationservercontract definition allowing to specify ResourceOwnerUsername. + */ + interface WithResourceOwnerUsername { + /** + * Specifies resourceOwnerUsername. + * @param resourceOwnerUsername Can be optionally specified when resource owner password grant type is supported by this authorization server. Default resource owner username + * @return the next definition stage + */ + WithCreate withResourceOwnerUsername(String resourceOwnerUsername); + } + + /** + * The stage of the authorizationservercontract definition allowing to specify SupportState. + */ + interface WithSupportState { + /** + * Specifies supportState. + * @param supportState If true, authorization server will include state parameter from the authorization request to its response. Client may use state parameter to raise protocol security + * @return the next definition stage + */ + WithCreate withSupportState(Boolean supportState); + } + + /** + * The stage of the authorizationservercontract definition allowing to specify TokenBodyParameters. + */ + interface WithTokenBodyParameters { + /** + * Specifies tokenBodyParameters. + * @param tokenBodyParameters Additional parameters required by the token endpoint of this authorization server represented as an array of JSON objects with name and value string properties, i.e. {"name" : "name value", "value": "a value"} + * @return the next definition stage + */ + WithCreate withTokenBodyParameters(List tokenBodyParameters); + } + + /** + * The stage of the authorizationservercontract definition allowing to specify TokenEndpoint. + */ + interface WithTokenEndpoint { + /** + * Specifies tokenEndpoint. + * @param tokenEndpoint OAuth token endpoint. Contains absolute URI to entity being referenced + * @return the next definition stage + */ + WithCreate withTokenEndpoint(String tokenEndpoint); + } + + /** + * The stage of the definition which contains all the minimum required inputs for + * the resource to be created (via {@link WithCreate#create()}), but also allows + * for any other optional settings to be specified. + */ + interface WithCreate extends Creatable, DefinitionStages.WithAuthorizationMethods, DefinitionStages.WithBearerTokenSendingMethods, DefinitionStages.WithClientAuthenticationMethod, DefinitionStages.WithClientSecret, DefinitionStages.WithDefaultScope, DefinitionStages.WithDescription, DefinitionStages.WithResourceOwnerPassword, DefinitionStages.WithResourceOwnerUsername, DefinitionStages.WithSupportState, DefinitionStages.WithTokenBodyParameters, DefinitionStages.WithTokenEndpoint { + } + } + /** + * The template for a AuthorizationServerContract update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithIfMatch, UpdateStages.WithAuthorizationMethods, UpdateStages.WithBearerTokenSendingMethods, UpdateStages.WithClientAuthenticationMethod, UpdateStages.WithClientSecret, UpdateStages.WithDefaultScope, UpdateStages.WithDescription, UpdateStages.WithResourceOwnerPassword, UpdateStages.WithResourceOwnerUsername, UpdateStages.WithSupportState, UpdateStages.WithTokenBodyParameters, UpdateStages.WithTokenEndpoint { + } + + /** + * Grouping of AuthorizationServerContract update stages. + */ + interface UpdateStages { + /** + * The stage of the authorizationservercontract update allowing to specify IfMatch. + */ + interface WithIfMatch { + /** + * Specifies ifMatch. + * @param ifMatch ETag of the Entity. Not required when creating an entity, but required when updating an entity + * @return the next update stage + */ + Update withIfMatch(String ifMatch); + } + + /** + * The stage of the authorizationservercontract update allowing to specify AuthorizationMethods. + */ + interface WithAuthorizationMethods { + /** + * Specifies authorizationMethods. + * @param authorizationMethods HTTP verbs supported by the authorization endpoint. GET must be always present. POST is optional + * @return the next update stage + */ + Update withAuthorizationMethods(List authorizationMethods); + } + + /** + * The stage of the authorizationservercontract update allowing to specify BearerTokenSendingMethods. + */ + interface WithBearerTokenSendingMethods { + /** + * Specifies bearerTokenSendingMethods. + * @param bearerTokenSendingMethods Specifies the mechanism by which access token is passed to the API + * @return the next update stage + */ + Update withBearerTokenSendingMethods(List bearerTokenSendingMethods); + } + + /** + * The stage of the authorizationservercontract update allowing to specify ClientAuthenticationMethod. + */ + interface WithClientAuthenticationMethod { + /** + * Specifies clientAuthenticationMethod. + * @param clientAuthenticationMethod Method of authentication supported by the token endpoint of this authorization server. Possible values are Basic and/or Body. When Body is specified, client credentials and other parameters are passed within the request body in the application/x-www-form-urlencoded format + * @return the next update stage + */ + Update withClientAuthenticationMethod(List clientAuthenticationMethod); + } + + /** + * The stage of the authorizationservercontract update allowing to specify ClientSecret. + */ + interface WithClientSecret { + /** + * Specifies clientSecret. + * @param clientSecret Client or app secret registered with this authorization server + * @return the next update stage + */ + Update withClientSecret(String clientSecret); + } + + /** + * The stage of the authorizationservercontract update allowing to specify DefaultScope. + */ + interface WithDefaultScope { + /** + * Specifies defaultScope. + * @param defaultScope Access token scope that is going to be requested by default. Can be overridden at the API level. Should be provided in the form of a string containing space-delimited values + * @return the next update stage + */ + Update withDefaultScope(String defaultScope); + } + + /** + * The stage of the authorizationservercontract update allowing to specify Description. + */ + interface WithDescription { + /** + * Specifies description. + * @param description Description of the authorization server. Can contain HTML formatting tags + * @return the next update stage + */ + Update withDescription(String description); + } + + /** + * The stage of the authorizationservercontract update allowing to specify ResourceOwnerPassword. + */ + interface WithResourceOwnerPassword { + /** + * Specifies resourceOwnerPassword. + * @param resourceOwnerPassword Can be optionally specified when resource owner password grant type is supported by this authorization server. Default resource owner password + * @return the next update stage + */ + Update withResourceOwnerPassword(String resourceOwnerPassword); + } + + /** + * The stage of the authorizationservercontract update allowing to specify ResourceOwnerUsername. + */ + interface WithResourceOwnerUsername { + /** + * Specifies resourceOwnerUsername. + * @param resourceOwnerUsername Can be optionally specified when resource owner password grant type is supported by this authorization server. Default resource owner username + * @return the next update stage + */ + Update withResourceOwnerUsername(String resourceOwnerUsername); + } + + /** + * The stage of the authorizationservercontract update allowing to specify SupportState. + */ + interface WithSupportState { + /** + * Specifies supportState. + * @param supportState If true, authorization server will include state parameter from the authorization request to its response. Client may use state parameter to raise protocol security + * @return the next update stage + */ + Update withSupportState(Boolean supportState); + } + + /** + * The stage of the authorizationservercontract update allowing to specify TokenBodyParameters. + */ + interface WithTokenBodyParameters { + /** + * Specifies tokenBodyParameters. + * @param tokenBodyParameters Additional parameters required by the token endpoint of this authorization server represented as an array of JSON objects with name and value string properties, i.e. {"name" : "name value", "value": "a value"} + * @return the next update stage + */ + Update withTokenBodyParameters(List tokenBodyParameters); + } + + /** + * The stage of the authorizationservercontract update allowing to specify TokenEndpoint. + */ + interface WithTokenEndpoint { + /** + * Specifies tokenEndpoint. + * @param tokenEndpoint OAuth token endpoint. Contains absolute URI to entity being referenced + * @return the next update stage + */ + Update withTokenEndpoint(String tokenEndpoint); + } + + } +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/AuthorizationServerContractBaseProperties.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/AuthorizationServerContractBaseProperties.java new file mode 100644 index 0000000000000..d2ba8eaf0ac71 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/AuthorizationServerContractBaseProperties.java @@ -0,0 +1,318 @@ +/** + * 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.apimanagement.v2019_01_01; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * External OAuth authorization server Update settings contract. + */ +public class AuthorizationServerContractBaseProperties { + /** + * Description of the authorization server. Can contain HTML formatting + * tags. + */ + @JsonProperty(value = "description") + private String description; + + /** + * HTTP verbs supported by the authorization endpoint. GET must be always + * present. POST is optional. + */ + @JsonProperty(value = "authorizationMethods") + private List authorizationMethods; + + /** + * Method of authentication supported by the token endpoint of this + * authorization server. Possible values are Basic and/or Body. When Body + * is specified, client credentials and other parameters are passed within + * the request body in the application/x-www-form-urlencoded format. + */ + @JsonProperty(value = "clientAuthenticationMethod") + private List clientAuthenticationMethod; + + /** + * Additional parameters required by the token endpoint of this + * authorization server represented as an array of JSON objects with name + * and value string properties, i.e. {"name" : "name value", "value": "a + * value"}. + */ + @JsonProperty(value = "tokenBodyParameters") + private List tokenBodyParameters; + + /** + * OAuth token endpoint. Contains absolute URI to entity being referenced. + */ + @JsonProperty(value = "tokenEndpoint") + private String tokenEndpoint; + + /** + * If true, authorization server will include state parameter from the + * authorization request to its response. Client may use state parameter to + * raise protocol security. + */ + @JsonProperty(value = "supportState") + private Boolean supportState; + + /** + * Access token scope that is going to be requested by default. Can be + * overridden at the API level. Should be provided in the form of a string + * containing space-delimited values. + */ + @JsonProperty(value = "defaultScope") + private String defaultScope; + + /** + * Specifies the mechanism by which access token is passed to the API. + */ + @JsonProperty(value = "bearerTokenSendingMethods") + private List bearerTokenSendingMethods; + + /** + * Client or app secret registered with this authorization server. + */ + @JsonProperty(value = "clientSecret") + private String clientSecret; + + /** + * Can be optionally specified when resource owner password grant type is + * supported by this authorization server. Default resource owner username. + */ + @JsonProperty(value = "resourceOwnerUsername") + private String resourceOwnerUsername; + + /** + * Can be optionally specified when resource owner password grant type is + * supported by this authorization server. Default resource owner password. + */ + @JsonProperty(value = "resourceOwnerPassword") + private String resourceOwnerPassword; + + /** + * Get description of the authorization server. Can contain HTML formatting tags. + * + * @return the description value + */ + public String description() { + return this.description; + } + + /** + * Set description of the authorization server. Can contain HTML formatting tags. + * + * @param description the description value to set + * @return the AuthorizationServerContractBaseProperties object itself. + */ + public AuthorizationServerContractBaseProperties withDescription(String description) { + this.description = description; + return this; + } + + /** + * Get hTTP verbs supported by the authorization endpoint. GET must be always present. POST is optional. + * + * @return the authorizationMethods value + */ + public List authorizationMethods() { + return this.authorizationMethods; + } + + /** + * Set hTTP verbs supported by the authorization endpoint. GET must be always present. POST is optional. + * + * @param authorizationMethods the authorizationMethods value to set + * @return the AuthorizationServerContractBaseProperties object itself. + */ + public AuthorizationServerContractBaseProperties withAuthorizationMethods(List authorizationMethods) { + this.authorizationMethods = authorizationMethods; + return this; + } + + /** + * Get method of authentication supported by the token endpoint of this authorization server. Possible values are Basic and/or Body. When Body is specified, client credentials and other parameters are passed within the request body in the application/x-www-form-urlencoded format. + * + * @return the clientAuthenticationMethod value + */ + public List clientAuthenticationMethod() { + return this.clientAuthenticationMethod; + } + + /** + * Set method of authentication supported by the token endpoint of this authorization server. Possible values are Basic and/or Body. When Body is specified, client credentials and other parameters are passed within the request body in the application/x-www-form-urlencoded format. + * + * @param clientAuthenticationMethod the clientAuthenticationMethod value to set + * @return the AuthorizationServerContractBaseProperties object itself. + */ + public AuthorizationServerContractBaseProperties withClientAuthenticationMethod(List clientAuthenticationMethod) { + this.clientAuthenticationMethod = clientAuthenticationMethod; + return this; + } + + /** + * Get additional parameters required by the token endpoint of this authorization server represented as an array of JSON objects with name and value string properties, i.e. {"name" : "name value", "value": "a value"}. + * + * @return the tokenBodyParameters value + */ + public List tokenBodyParameters() { + return this.tokenBodyParameters; + } + + /** + * Set additional parameters required by the token endpoint of this authorization server represented as an array of JSON objects with name and value string properties, i.e. {"name" : "name value", "value": "a value"}. + * + * @param tokenBodyParameters the tokenBodyParameters value to set + * @return the AuthorizationServerContractBaseProperties object itself. + */ + public AuthorizationServerContractBaseProperties withTokenBodyParameters(List tokenBodyParameters) { + this.tokenBodyParameters = tokenBodyParameters; + return this; + } + + /** + * Get oAuth token endpoint. Contains absolute URI to entity being referenced. + * + * @return the tokenEndpoint value + */ + public String tokenEndpoint() { + return this.tokenEndpoint; + } + + /** + * Set oAuth token endpoint. Contains absolute URI to entity being referenced. + * + * @param tokenEndpoint the tokenEndpoint value to set + * @return the AuthorizationServerContractBaseProperties object itself. + */ + public AuthorizationServerContractBaseProperties withTokenEndpoint(String tokenEndpoint) { + this.tokenEndpoint = tokenEndpoint; + return this; + } + + /** + * Get if true, authorization server will include state parameter from the authorization request to its response. Client may use state parameter to raise protocol security. + * + * @return the supportState value + */ + public Boolean supportState() { + return this.supportState; + } + + /** + * Set if true, authorization server will include state parameter from the authorization request to its response. Client may use state parameter to raise protocol security. + * + * @param supportState the supportState value to set + * @return the AuthorizationServerContractBaseProperties object itself. + */ + public AuthorizationServerContractBaseProperties withSupportState(Boolean supportState) { + this.supportState = supportState; + return this; + } + + /** + * Get access token scope that is going to be requested by default. Can be overridden at the API level. Should be provided in the form of a string containing space-delimited values. + * + * @return the defaultScope value + */ + public String defaultScope() { + return this.defaultScope; + } + + /** + * Set access token scope that is going to be requested by default. Can be overridden at the API level. Should be provided in the form of a string containing space-delimited values. + * + * @param defaultScope the defaultScope value to set + * @return the AuthorizationServerContractBaseProperties object itself. + */ + public AuthorizationServerContractBaseProperties withDefaultScope(String defaultScope) { + this.defaultScope = defaultScope; + return this; + } + + /** + * Get specifies the mechanism by which access token is passed to the API. + * + * @return the bearerTokenSendingMethods value + */ + public List bearerTokenSendingMethods() { + return this.bearerTokenSendingMethods; + } + + /** + * Set specifies the mechanism by which access token is passed to the API. + * + * @param bearerTokenSendingMethods the bearerTokenSendingMethods value to set + * @return the AuthorizationServerContractBaseProperties object itself. + */ + public AuthorizationServerContractBaseProperties withBearerTokenSendingMethods(List bearerTokenSendingMethods) { + this.bearerTokenSendingMethods = bearerTokenSendingMethods; + return this; + } + + /** + * Get client or app secret registered with this authorization server. + * + * @return the clientSecret value + */ + public String clientSecret() { + return this.clientSecret; + } + + /** + * Set client or app secret registered with this authorization server. + * + * @param clientSecret the clientSecret value to set + * @return the AuthorizationServerContractBaseProperties object itself. + */ + public AuthorizationServerContractBaseProperties withClientSecret(String clientSecret) { + this.clientSecret = clientSecret; + return this; + } + + /** + * Get can be optionally specified when resource owner password grant type is supported by this authorization server. Default resource owner username. + * + * @return the resourceOwnerUsername value + */ + public String resourceOwnerUsername() { + return this.resourceOwnerUsername; + } + + /** + * Set can be optionally specified when resource owner password grant type is supported by this authorization server. Default resource owner username. + * + * @param resourceOwnerUsername the resourceOwnerUsername value to set + * @return the AuthorizationServerContractBaseProperties object itself. + */ + public AuthorizationServerContractBaseProperties withResourceOwnerUsername(String resourceOwnerUsername) { + this.resourceOwnerUsername = resourceOwnerUsername; + return this; + } + + /** + * Get can be optionally specified when resource owner password grant type is supported by this authorization server. Default resource owner password. + * + * @return the resourceOwnerPassword value + */ + public String resourceOwnerPassword() { + return this.resourceOwnerPassword; + } + + /** + * Set can be optionally specified when resource owner password grant type is supported by this authorization server. Default resource owner password. + * + * @param resourceOwnerPassword the resourceOwnerPassword value to set + * @return the AuthorizationServerContractBaseProperties object itself. + */ + public AuthorizationServerContractBaseProperties withResourceOwnerPassword(String resourceOwnerPassword) { + this.resourceOwnerPassword = resourceOwnerPassword; + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/AuthorizationServerCreateOrUpdateHeaders.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/AuthorizationServerCreateOrUpdateHeaders.java new file mode 100644 index 0000000000000..dd7ee33c6d103 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/AuthorizationServerCreateOrUpdateHeaders.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.apimanagement.v2019_01_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for CreateOrUpdate operation. + */ +public class AuthorizationServerCreateOrUpdateHeaders { + /** + * Current entity state version. Should be treated as opaque and used to + * make conditional HTTP requests. + */ + @JsonProperty(value = "ETag") + private String eTag; + + /** + * Get current entity state version. Should be treated as opaque and used to make conditional HTTP requests. + * + * @return the eTag value + */ + public String eTag() { + return this.eTag; + } + + /** + * Set current entity state version. Should be treated as opaque and used to make conditional HTTP requests. + * + * @param eTag the eTag value to set + * @return the AuthorizationServerCreateOrUpdateHeaders object itself. + */ + public AuthorizationServerCreateOrUpdateHeaders withETag(String eTag) { + this.eTag = eTag; + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/AuthorizationServerGetEntityTagHeaders.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/AuthorizationServerGetEntityTagHeaders.java new file mode 100644 index 0000000000000..8d4fe44e3ab79 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/AuthorizationServerGetEntityTagHeaders.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.apimanagement.v2019_01_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for GetEntityTag operation. + */ +public class AuthorizationServerGetEntityTagHeaders { + /** + * Current entity state version. Should be treated as opaque and used to + * make conditional HTTP requests. + */ + @JsonProperty(value = "ETag") + private String eTag; + + /** + * Get current entity state version. Should be treated as opaque and used to make conditional HTTP requests. + * + * @return the eTag value + */ + public String eTag() { + return this.eTag; + } + + /** + * Set current entity state version. Should be treated as opaque and used to make conditional HTTP requests. + * + * @param eTag the eTag value to set + * @return the AuthorizationServerGetEntityTagHeaders object itself. + */ + public AuthorizationServerGetEntityTagHeaders withETag(String eTag) { + this.eTag = eTag; + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/AuthorizationServerGetHeaders.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/AuthorizationServerGetHeaders.java new file mode 100644 index 0000000000000..fb18bda25f869 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/AuthorizationServerGetHeaders.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.apimanagement.v2019_01_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for Get operation. + */ +public class AuthorizationServerGetHeaders { + /** + * Current entity state version. Should be treated as opaque and used to + * make conditional HTTP requests. + */ + @JsonProperty(value = "ETag") + private String eTag; + + /** + * Get current entity state version. Should be treated as opaque and used to make conditional HTTP requests. + * + * @return the eTag value + */ + public String eTag() { + return this.eTag; + } + + /** + * Set current entity state version. Should be treated as opaque and used to make conditional HTTP requests. + * + * @param eTag the eTag value to set + * @return the AuthorizationServerGetHeaders object itself. + */ + public AuthorizationServerGetHeaders withETag(String eTag) { + this.eTag = eTag; + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/AuthorizationServerUpdateContract.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/AuthorizationServerUpdateContract.java new file mode 100644 index 0000000000000..5af0ebd8cf608 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/AuthorizationServerUpdateContract.java @@ -0,0 +1,455 @@ +/** + * 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.apimanagement.v2019_01_01; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * External OAuth authorization server settings. + */ +@JsonFlatten +public class AuthorizationServerUpdateContract extends ProxyResource { + /** + * Description of the authorization server. Can contain HTML formatting + * tags. + */ + @JsonProperty(value = "properties.description") + private String description; + + /** + * HTTP verbs supported by the authorization endpoint. GET must be always + * present. POST is optional. + */ + @JsonProperty(value = "properties.authorizationMethods") + private List authorizationMethods; + + /** + * Method of authentication supported by the token endpoint of this + * authorization server. Possible values are Basic and/or Body. When Body + * is specified, client credentials and other parameters are passed within + * the request body in the application/x-www-form-urlencoded format. + */ + @JsonProperty(value = "properties.clientAuthenticationMethod") + private List clientAuthenticationMethod; + + /** + * Additional parameters required by the token endpoint of this + * authorization server represented as an array of JSON objects with name + * and value string properties, i.e. {"name" : "name value", "value": "a + * value"}. + */ + @JsonProperty(value = "properties.tokenBodyParameters") + private List tokenBodyParameters; + + /** + * OAuth token endpoint. Contains absolute URI to entity being referenced. + */ + @JsonProperty(value = "properties.tokenEndpoint") + private String tokenEndpoint; + + /** + * If true, authorization server will include state parameter from the + * authorization request to its response. Client may use state parameter to + * raise protocol security. + */ + @JsonProperty(value = "properties.supportState") + private Boolean supportState; + + /** + * Access token scope that is going to be requested by default. Can be + * overridden at the API level. Should be provided in the form of a string + * containing space-delimited values. + */ + @JsonProperty(value = "properties.defaultScope") + private String defaultScope; + + /** + * Specifies the mechanism by which access token is passed to the API. + */ + @JsonProperty(value = "properties.bearerTokenSendingMethods") + private List bearerTokenSendingMethods; + + /** + * Client or app secret registered with this authorization server. + */ + @JsonProperty(value = "properties.clientSecret") + private String clientSecret; + + /** + * Can be optionally specified when resource owner password grant type is + * supported by this authorization server. Default resource owner username. + */ + @JsonProperty(value = "properties.resourceOwnerUsername") + private String resourceOwnerUsername; + + /** + * Can be optionally specified when resource owner password grant type is + * supported by this authorization server. Default resource owner password. + */ + @JsonProperty(value = "properties.resourceOwnerPassword") + private String resourceOwnerPassword; + + /** + * User-friendly authorization server name. + */ + @JsonProperty(value = "properties.displayName") + private String displayName; + + /** + * Optional reference to a page where client or app registration for this + * authorization server is performed. Contains absolute URL to entity being + * referenced. + */ + @JsonProperty(value = "properties.clientRegistrationEndpoint") + private String clientRegistrationEndpoint; + + /** + * OAuth authorization endpoint. See + * http://tools.ietf.org/html/rfc6749#section-3.2. + */ + @JsonProperty(value = "properties.authorizationEndpoint") + private String authorizationEndpoint; + + /** + * Form of an authorization grant, which the client uses to request the + * access token. + */ + @JsonProperty(value = "properties.grantTypes") + private List grantTypes; + + /** + * Client or app id registered with this authorization server. + */ + @JsonProperty(value = "properties.clientId") + private String clientId; + + /** + * Get description of the authorization server. Can contain HTML formatting tags. + * + * @return the description value + */ + public String description() { + return this.description; + } + + /** + * Set description of the authorization server. Can contain HTML formatting tags. + * + * @param description the description value to set + * @return the AuthorizationServerUpdateContract object itself. + */ + public AuthorizationServerUpdateContract withDescription(String description) { + this.description = description; + return this; + } + + /** + * Get hTTP verbs supported by the authorization endpoint. GET must be always present. POST is optional. + * + * @return the authorizationMethods value + */ + public List authorizationMethods() { + return this.authorizationMethods; + } + + /** + * Set hTTP verbs supported by the authorization endpoint. GET must be always present. POST is optional. + * + * @param authorizationMethods the authorizationMethods value to set + * @return the AuthorizationServerUpdateContract object itself. + */ + public AuthorizationServerUpdateContract withAuthorizationMethods(List authorizationMethods) { + this.authorizationMethods = authorizationMethods; + return this; + } + + /** + * Get method of authentication supported by the token endpoint of this authorization server. Possible values are Basic and/or Body. When Body is specified, client credentials and other parameters are passed within the request body in the application/x-www-form-urlencoded format. + * + * @return the clientAuthenticationMethod value + */ + public List clientAuthenticationMethod() { + return this.clientAuthenticationMethod; + } + + /** + * Set method of authentication supported by the token endpoint of this authorization server. Possible values are Basic and/or Body. When Body is specified, client credentials and other parameters are passed within the request body in the application/x-www-form-urlencoded format. + * + * @param clientAuthenticationMethod the clientAuthenticationMethod value to set + * @return the AuthorizationServerUpdateContract object itself. + */ + public AuthorizationServerUpdateContract withClientAuthenticationMethod(List clientAuthenticationMethod) { + this.clientAuthenticationMethod = clientAuthenticationMethod; + return this; + } + + /** + * Get additional parameters required by the token endpoint of this authorization server represented as an array of JSON objects with name and value string properties, i.e. {"name" : "name value", "value": "a value"}. + * + * @return the tokenBodyParameters value + */ + public List tokenBodyParameters() { + return this.tokenBodyParameters; + } + + /** + * Set additional parameters required by the token endpoint of this authorization server represented as an array of JSON objects with name and value string properties, i.e. {"name" : "name value", "value": "a value"}. + * + * @param tokenBodyParameters the tokenBodyParameters value to set + * @return the AuthorizationServerUpdateContract object itself. + */ + public AuthorizationServerUpdateContract withTokenBodyParameters(List tokenBodyParameters) { + this.tokenBodyParameters = tokenBodyParameters; + return this; + } + + /** + * Get oAuth token endpoint. Contains absolute URI to entity being referenced. + * + * @return the tokenEndpoint value + */ + public String tokenEndpoint() { + return this.tokenEndpoint; + } + + /** + * Set oAuth token endpoint. Contains absolute URI to entity being referenced. + * + * @param tokenEndpoint the tokenEndpoint value to set + * @return the AuthorizationServerUpdateContract object itself. + */ + public AuthorizationServerUpdateContract withTokenEndpoint(String tokenEndpoint) { + this.tokenEndpoint = tokenEndpoint; + return this; + } + + /** + * Get if true, authorization server will include state parameter from the authorization request to its response. Client may use state parameter to raise protocol security. + * + * @return the supportState value + */ + public Boolean supportState() { + return this.supportState; + } + + /** + * Set if true, authorization server will include state parameter from the authorization request to its response. Client may use state parameter to raise protocol security. + * + * @param supportState the supportState value to set + * @return the AuthorizationServerUpdateContract object itself. + */ + public AuthorizationServerUpdateContract withSupportState(Boolean supportState) { + this.supportState = supportState; + return this; + } + + /** + * Get access token scope that is going to be requested by default. Can be overridden at the API level. Should be provided in the form of a string containing space-delimited values. + * + * @return the defaultScope value + */ + public String defaultScope() { + return this.defaultScope; + } + + /** + * Set access token scope that is going to be requested by default. Can be overridden at the API level. Should be provided in the form of a string containing space-delimited values. + * + * @param defaultScope the defaultScope value to set + * @return the AuthorizationServerUpdateContract object itself. + */ + public AuthorizationServerUpdateContract withDefaultScope(String defaultScope) { + this.defaultScope = defaultScope; + return this; + } + + /** + * Get specifies the mechanism by which access token is passed to the API. + * + * @return the bearerTokenSendingMethods value + */ + public List bearerTokenSendingMethods() { + return this.bearerTokenSendingMethods; + } + + /** + * Set specifies the mechanism by which access token is passed to the API. + * + * @param bearerTokenSendingMethods the bearerTokenSendingMethods value to set + * @return the AuthorizationServerUpdateContract object itself. + */ + public AuthorizationServerUpdateContract withBearerTokenSendingMethods(List bearerTokenSendingMethods) { + this.bearerTokenSendingMethods = bearerTokenSendingMethods; + return this; + } + + /** + * Get client or app secret registered with this authorization server. + * + * @return the clientSecret value + */ + public String clientSecret() { + return this.clientSecret; + } + + /** + * Set client or app secret registered with this authorization server. + * + * @param clientSecret the clientSecret value to set + * @return the AuthorizationServerUpdateContract object itself. + */ + public AuthorizationServerUpdateContract withClientSecret(String clientSecret) { + this.clientSecret = clientSecret; + return this; + } + + /** + * Get can be optionally specified when resource owner password grant type is supported by this authorization server. Default resource owner username. + * + * @return the resourceOwnerUsername value + */ + public String resourceOwnerUsername() { + return this.resourceOwnerUsername; + } + + /** + * Set can be optionally specified when resource owner password grant type is supported by this authorization server. Default resource owner username. + * + * @param resourceOwnerUsername the resourceOwnerUsername value to set + * @return the AuthorizationServerUpdateContract object itself. + */ + public AuthorizationServerUpdateContract withResourceOwnerUsername(String resourceOwnerUsername) { + this.resourceOwnerUsername = resourceOwnerUsername; + return this; + } + + /** + * Get can be optionally specified when resource owner password grant type is supported by this authorization server. Default resource owner password. + * + * @return the resourceOwnerPassword value + */ + public String resourceOwnerPassword() { + return this.resourceOwnerPassword; + } + + /** + * Set can be optionally specified when resource owner password grant type is supported by this authorization server. Default resource owner password. + * + * @param resourceOwnerPassword the resourceOwnerPassword value to set + * @return the AuthorizationServerUpdateContract object itself. + */ + public AuthorizationServerUpdateContract withResourceOwnerPassword(String resourceOwnerPassword) { + this.resourceOwnerPassword = resourceOwnerPassword; + return this; + } + + /** + * Get user-friendly authorization server name. + * + * @return the displayName value + */ + public String displayName() { + return this.displayName; + } + + /** + * Set user-friendly authorization server name. + * + * @param displayName the displayName value to set + * @return the AuthorizationServerUpdateContract object itself. + */ + public AuthorizationServerUpdateContract withDisplayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Get optional reference to a page where client or app registration for this authorization server is performed. Contains absolute URL to entity being referenced. + * + * @return the clientRegistrationEndpoint value + */ + public String clientRegistrationEndpoint() { + return this.clientRegistrationEndpoint; + } + + /** + * Set optional reference to a page where client or app registration for this authorization server is performed. Contains absolute URL to entity being referenced. + * + * @param clientRegistrationEndpoint the clientRegistrationEndpoint value to set + * @return the AuthorizationServerUpdateContract object itself. + */ + public AuthorizationServerUpdateContract withClientRegistrationEndpoint(String clientRegistrationEndpoint) { + this.clientRegistrationEndpoint = clientRegistrationEndpoint; + return this; + } + + /** + * Get oAuth authorization endpoint. See http://tools.ietf.org/html/rfc6749#section-3.2. + * + * @return the authorizationEndpoint value + */ + public String authorizationEndpoint() { + return this.authorizationEndpoint; + } + + /** + * Set oAuth authorization endpoint. See http://tools.ietf.org/html/rfc6749#section-3.2. + * + * @param authorizationEndpoint the authorizationEndpoint value to set + * @return the AuthorizationServerUpdateContract object itself. + */ + public AuthorizationServerUpdateContract withAuthorizationEndpoint(String authorizationEndpoint) { + this.authorizationEndpoint = authorizationEndpoint; + return this; + } + + /** + * Get form of an authorization grant, which the client uses to request the access token. + * + * @return the grantTypes value + */ + public List grantTypes() { + return this.grantTypes; + } + + /** + * Set form of an authorization grant, which the client uses to request the access token. + * + * @param grantTypes the grantTypes value to set + * @return the AuthorizationServerUpdateContract object itself. + */ + public AuthorizationServerUpdateContract withGrantTypes(List grantTypes) { + this.grantTypes = grantTypes; + return this; + } + + /** + * Get client or app id registered with this authorization server. + * + * @return the clientId value + */ + public String clientId() { + return this.clientId; + } + + /** + * Set client or app id registered with this authorization server. + * + * @param clientId the clientId value to set + * @return the AuthorizationServerUpdateContract object itself. + */ + public AuthorizationServerUpdateContract withClientId(String clientId) { + this.clientId = clientId; + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/AuthorizationServers.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/AuthorizationServers.java new file mode 100644 index 0000000000000..7f21a03cbfc46 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/AuthorizationServers.java @@ -0,0 +1,65 @@ +/** + * 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.apimanagement.v2019_01_01; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import rx.Completable; +import rx.Observable; +import com.microsoft.azure.management.apimanagement.v2019_01_01.implementation.AuthorizationServersInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing AuthorizationServers. + */ +public interface AuthorizationServers extends SupportsCreating, HasInner { + /** + * Lists a collection of authorization servers defined within a service instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByServiceAsync(final String resourceGroupName, final String serviceName); + + /** + * Gets the entity state (Etag) version of the authorizationServer specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param authsid Identifier of the authorization server. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable getEntityTagAsync(String resourceGroupName, String serviceName, String authsid); + + /** + * Gets the details of the authorization server specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param authsid Identifier of the authorization server. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String resourceGroupName, String serviceName, String authsid); + + /** + * Deletes specific authorization server instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param authsid Identifier of the authorization server. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable deleteAsync(String resourceGroupName, String serviceName, String authsid, String ifMatch); + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/BackendAuthorizationHeaderCredentials.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/BackendAuthorizationHeaderCredentials.java new file mode 100644 index 0000000000000..02b77455dfbae --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/BackendAuthorizationHeaderCredentials.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.apimanagement.v2019_01_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Authorization header information. + */ +public class BackendAuthorizationHeaderCredentials { + /** + * Authentication Scheme name. + */ + @JsonProperty(value = "scheme", required = true) + private String scheme; + + /** + * Authentication Parameter value. + */ + @JsonProperty(value = "parameter", required = true) + private String parameter; + + /** + * Get authentication Scheme name. + * + * @return the scheme value + */ + public String scheme() { + return this.scheme; + } + + /** + * Set authentication Scheme name. + * + * @param scheme the scheme value to set + * @return the BackendAuthorizationHeaderCredentials object itself. + */ + public BackendAuthorizationHeaderCredentials withScheme(String scheme) { + this.scheme = scheme; + return this; + } + + /** + * Get authentication Parameter value. + * + * @return the parameter value + */ + public String parameter() { + return this.parameter; + } + + /** + * Set authentication Parameter value. + * + * @param parameter the parameter value to set + * @return the BackendAuthorizationHeaderCredentials object itself. + */ + public BackendAuthorizationHeaderCredentials withParameter(String parameter) { + this.parameter = parameter; + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/BackendBaseParameters.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/BackendBaseParameters.java new file mode 100644 index 0000000000000..ebd4d741e92b0 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/BackendBaseParameters.java @@ -0,0 +1,200 @@ +/** + * 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.apimanagement.v2019_01_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Backend entity base Parameter set. + */ +public class BackendBaseParameters { + /** + * Backend Title. + */ + @JsonProperty(value = "title") + private String title; + + /** + * Backend Description. + */ + @JsonProperty(value = "description") + private String description; + + /** + * Management Uri of the Resource in External System. This url can be the + * Arm Resource Id of Logic Apps, Function Apps or Api Apps. + */ + @JsonProperty(value = "resourceId") + private String resourceId; + + /** + * Backend Properties contract. + */ + @JsonProperty(value = "properties") + private BackendProperties properties; + + /** + * Backend Credentials Contract Properties. + */ + @JsonProperty(value = "credentials") + private BackendCredentialsContract credentials; + + /** + * Backend Proxy Contract Properties. + */ + @JsonProperty(value = "proxy") + private BackendProxyContract proxy; + + /** + * Backend TLS Properties. + */ + @JsonProperty(value = "tls") + private BackendTlsProperties tls; + + /** + * Get backend Title. + * + * @return the title value + */ + public String title() { + return this.title; + } + + /** + * Set backend Title. + * + * @param title the title value to set + * @return the BackendBaseParameters object itself. + */ + public BackendBaseParameters withTitle(String title) { + this.title = title; + return this; + } + + /** + * Get backend Description. + * + * @return the description value + */ + public String description() { + return this.description; + } + + /** + * Set backend Description. + * + * @param description the description value to set + * @return the BackendBaseParameters object itself. + */ + public BackendBaseParameters withDescription(String description) { + this.description = description; + return this; + } + + /** + * Get management Uri of the Resource in External System. This url can be the Arm Resource Id of Logic Apps, Function Apps or Api Apps. + * + * @return the resourceId value + */ + public String resourceId() { + return this.resourceId; + } + + /** + * Set management Uri of the Resource in External System. This url can be the Arm Resource Id of Logic Apps, Function Apps or Api Apps. + * + * @param resourceId the resourceId value to set + * @return the BackendBaseParameters object itself. + */ + public BackendBaseParameters withResourceId(String resourceId) { + this.resourceId = resourceId; + return this; + } + + /** + * Get backend Properties contract. + * + * @return the properties value + */ + public BackendProperties properties() { + return this.properties; + } + + /** + * Set backend Properties contract. + * + * @param properties the properties value to set + * @return the BackendBaseParameters object itself. + */ + public BackendBaseParameters withProperties(BackendProperties properties) { + this.properties = properties; + return this; + } + + /** + * Get backend Credentials Contract Properties. + * + * @return the credentials value + */ + public BackendCredentialsContract credentials() { + return this.credentials; + } + + /** + * Set backend Credentials Contract Properties. + * + * @param credentials the credentials value to set + * @return the BackendBaseParameters object itself. + */ + public BackendBaseParameters withCredentials(BackendCredentialsContract credentials) { + this.credentials = credentials; + return this; + } + + /** + * Get backend Proxy Contract Properties. + * + * @return the proxy value + */ + public BackendProxyContract proxy() { + return this.proxy; + } + + /** + * Set backend Proxy Contract Properties. + * + * @param proxy the proxy value to set + * @return the BackendBaseParameters object itself. + */ + public BackendBaseParameters withProxy(BackendProxyContract proxy) { + this.proxy = proxy; + return this; + } + + /** + * Get backend TLS Properties. + * + * @return the tls value + */ + public BackendTlsProperties tls() { + return this.tls; + } + + /** + * Set backend TLS Properties. + * + * @param tls the tls value to set + * @return the BackendBaseParameters object itself. + */ + public BackendBaseParameters withTls(BackendTlsProperties tls) { + this.tls = tls; + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/BackendContract.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/BackendContract.java new file mode 100644 index 0000000000000..4007185c1b4ce --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/BackendContract.java @@ -0,0 +1,359 @@ +/** + * 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.apimanagement.v2019_01_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.apimanagement.v2019_01_01.implementation.BackendContractInner; +import com.microsoft.azure.arm.model.Indexable; +import com.microsoft.azure.arm.model.Creatable; +import com.microsoft.azure.arm.model.Updatable; +import com.microsoft.azure.arm.model.Appliable; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.apimanagement.v2019_01_01.implementation.ApiManagementManager; + +/** + * Type representing BackendContract. + */ +public interface BackendContract extends HasInner, Indexable, Updatable, HasManager { + /** + * @return the credentials value. + */ + BackendCredentialsContract credentials(); + + /** + * @return the description value. + */ + String description(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the properties value. + */ + BackendProperties properties(); + + /** + * @return the protocol value. + */ + BackendProtocol protocol(); + + /** + * @return the proxy value. + */ + BackendProxyContract proxy(); + + /** + * @return the resourceId value. + */ + String resourceId(); + + /** + * @return the title value. + */ + String title(); + + /** + * @return the tls value. + */ + BackendTlsProperties tls(); + + /** + * @return the type value. + */ + String type(); + + /** + * @return the url value. + */ + String url(); + + /** + * The entirety of the BackendContract definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithResourceGroupName, DefinitionStages.WithServiceName, DefinitionStages.WithIfMatch, DefinitionStages.WithProtocol, DefinitionStages.WithUrl, DefinitionStages.WithCreate { + } + + /** + * Grouping of BackendContract definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a BackendContract definition. + */ + interface Blank extends WithResourceGroupName { + } + + /** + * The stage of the backendcontract definition allowing to specify ResourceGroupName. + */ + interface WithResourceGroupName { + /** + * Specifies resourceGroupName. + * @param resourceGroupName The name of the resource group + * @return the next definition stage + */ + WithServiceName withResourceGroupName(String resourceGroupName); + } + + /** + * The stage of the backendcontract definition allowing to specify ServiceName. + */ + interface WithServiceName { + /** + * Specifies serviceName. + * @param serviceName The name of the API Management service + * @return the next definition stage + */ + WithIfMatch withServiceName(String serviceName); + } + + /** + * The stage of the backendcontract definition allowing to specify IfMatch. + */ + interface WithIfMatch { + /** + * Specifies ifMatch. + * @param ifMatch ETag of the Entity. Not required when creating an entity, but required when updating an entity + * @return the next definition stage + */ + WithProtocol withIfMatch(String ifMatch); + } + + /** + * The stage of the backendcontract definition allowing to specify Protocol. + */ + interface WithProtocol { + /** + * Specifies protocol. + * @param protocol Backend communication protocol. Possible values include: 'http', 'soap' + * @return the next definition stage + */ + WithUrl withProtocol(BackendProtocol protocol); + } + + /** + * The stage of the backendcontract definition allowing to specify Url. + */ + interface WithUrl { + /** + * Specifies url. + * @param url Runtime Url of the Backend + * @return the next definition stage + */ + WithCreate withUrl(String url); + } + + /** + * The stage of the backendcontract definition allowing to specify Credentials. + */ + interface WithCredentials { + /** + * Specifies credentials. + * @param credentials Backend Credentials Contract Properties + * @return the next definition stage + */ + WithCreate withCredentials(BackendCredentialsContract credentials); + } + + /** + * The stage of the backendcontract definition allowing to specify Description. + */ + interface WithDescription { + /** + * Specifies description. + * @param description Backend Description + * @return the next definition stage + */ + WithCreate withDescription(String description); + } + + /** + * The stage of the backendcontract definition allowing to specify Properties. + */ + interface WithProperties { + /** + * Specifies properties. + * @param properties Backend Properties contract + * @return the next definition stage + */ + WithCreate withProperties(BackendProperties properties); + } + + /** + * The stage of the backendcontract definition allowing to specify Proxy. + */ + interface WithProxy { + /** + * Specifies proxy. + * @param proxy Backend Proxy Contract Properties + * @return the next definition stage + */ + WithCreate withProxy(BackendProxyContract proxy); + } + + /** + * The stage of the backendcontract definition allowing to specify ResourceId. + */ + interface WithResourceId { + /** + * Specifies resourceId. + * @param resourceId Management Uri of the Resource in External System. This url can be the Arm Resource Id of Logic Apps, Function Apps or Api Apps + * @return the next definition stage + */ + WithCreate withResourceId(String resourceId); + } + + /** + * The stage of the backendcontract definition allowing to specify Title. + */ + interface WithTitle { + /** + * Specifies title. + * @param title Backend Title + * @return the next definition stage + */ + WithCreate withTitle(String title); + } + + /** + * The stage of the backendcontract definition allowing to specify Tls. + */ + interface WithTls { + /** + * Specifies tls. + * @param tls Backend TLS Properties + * @return the next definition stage + */ + WithCreate withTls(BackendTlsProperties tls); + } + + /** + * The stage of the definition which contains all the minimum required inputs for + * the resource to be created (via {@link WithCreate#create()}), but also allows + * for any other optional settings to be specified. + */ + interface WithCreate extends Creatable, DefinitionStages.WithCredentials, DefinitionStages.WithDescription, DefinitionStages.WithProperties, DefinitionStages.WithProxy, DefinitionStages.WithResourceId, DefinitionStages.WithTitle, DefinitionStages.WithTls { + } + } + /** + * The template for a BackendContract update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithIfMatch, UpdateStages.WithCredentials, UpdateStages.WithDescription, UpdateStages.WithProperties, UpdateStages.WithProxy, UpdateStages.WithResourceId, UpdateStages.WithTitle, UpdateStages.WithTls { + } + + /** + * Grouping of BackendContract update stages. + */ + interface UpdateStages { + /** + * The stage of the backendcontract update allowing to specify IfMatch. + */ + interface WithIfMatch { + /** + * Specifies ifMatch. + * @param ifMatch ETag of the Entity. Not required when creating an entity, but required when updating an entity + * @return the next update stage + */ + Update withIfMatch(String ifMatch); + } + + /** + * The stage of the backendcontract update allowing to specify Credentials. + */ + interface WithCredentials { + /** + * Specifies credentials. + * @param credentials Backend Credentials Contract Properties + * @return the next update stage + */ + Update withCredentials(BackendCredentialsContract credentials); + } + + /** + * The stage of the backendcontract update allowing to specify Description. + */ + interface WithDescription { + /** + * Specifies description. + * @param description Backend Description + * @return the next update stage + */ + Update withDescription(String description); + } + + /** + * The stage of the backendcontract update allowing to specify Properties. + */ + interface WithProperties { + /** + * Specifies properties. + * @param properties Backend Properties contract + * @return the next update stage + */ + Update withProperties(BackendProperties properties); + } + + /** + * The stage of the backendcontract update allowing to specify Proxy. + */ + interface WithProxy { + /** + * Specifies proxy. + * @param proxy Backend Proxy Contract Properties + * @return the next update stage + */ + Update withProxy(BackendProxyContract proxy); + } + + /** + * The stage of the backendcontract update allowing to specify ResourceId. + */ + interface WithResourceId { + /** + * Specifies resourceId. + * @param resourceId Management Uri of the Resource in External System. This url can be the Arm Resource Id of Logic Apps, Function Apps or Api Apps + * @return the next update stage + */ + Update withResourceId(String resourceId); + } + + /** + * The stage of the backendcontract update allowing to specify Title. + */ + interface WithTitle { + /** + * Specifies title. + * @param title Backend Title + * @return the next update stage + */ + Update withTitle(String title); + } + + /** + * The stage of the backendcontract update allowing to specify Tls. + */ + interface WithTls { + /** + * Specifies tls. + * @param tls Backend TLS Properties + * @return the next update stage + */ + Update withTls(BackendTlsProperties tls); + } + + } +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/BackendCreateOrUpdateHeaders.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/BackendCreateOrUpdateHeaders.java new file mode 100644 index 0000000000000..cbaaea7e9aac1 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/BackendCreateOrUpdateHeaders.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.apimanagement.v2019_01_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for CreateOrUpdate operation. + */ +public class BackendCreateOrUpdateHeaders { + /** + * Current entity state version. Should be treated as opaque and used to + * make conditional HTTP requests. + */ + @JsonProperty(value = "ETag") + private String eTag; + + /** + * Get current entity state version. Should be treated as opaque and used to make conditional HTTP requests. + * + * @return the eTag value + */ + public String eTag() { + return this.eTag; + } + + /** + * Set current entity state version. Should be treated as opaque and used to make conditional HTTP requests. + * + * @param eTag the eTag value to set + * @return the BackendCreateOrUpdateHeaders object itself. + */ + public BackendCreateOrUpdateHeaders withETag(String eTag) { + this.eTag = eTag; + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/BackendCredentialsContract.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/BackendCredentialsContract.java new file mode 100644 index 0000000000000..06a8fec50414a --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/BackendCredentialsContract.java @@ -0,0 +1,123 @@ +/** + * 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.apimanagement.v2019_01_01; + +import java.util.List; +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Details of the Credentials used to connect to Backend. + */ +public class BackendCredentialsContract { + /** + * List of Client Certificate Thumbprint. + */ + @JsonProperty(value = "certificate") + private List certificate; + + /** + * Query Parameter description. + */ + @JsonProperty(value = "query") + private Map> query; + + /** + * Header Parameter description. + */ + @JsonProperty(value = "header") + private Map> headerProperty; + + /** + * Authorization header authentication. + */ + @JsonProperty(value = "authorization") + private BackendAuthorizationHeaderCredentials authorization; + + /** + * Get list of Client Certificate Thumbprint. + * + * @return the certificate value + */ + public List certificate() { + return this.certificate; + } + + /** + * Set list of Client Certificate Thumbprint. + * + * @param certificate the certificate value to set + * @return the BackendCredentialsContract object itself. + */ + public BackendCredentialsContract withCertificate(List certificate) { + this.certificate = certificate; + return this; + } + + /** + * Get query Parameter description. + * + * @return the query value + */ + public Map> query() { + return this.query; + } + + /** + * Set query Parameter description. + * + * @param query the query value to set + * @return the BackendCredentialsContract object itself. + */ + public BackendCredentialsContract withQuery(Map> query) { + this.query = query; + return this; + } + + /** + * Get header Parameter description. + * + * @return the headerProperty value + */ + public Map> headerProperty() { + return this.headerProperty; + } + + /** + * Set header Parameter description. + * + * @param headerProperty the headerProperty value to set + * @return the BackendCredentialsContract object itself. + */ + public BackendCredentialsContract withHeaderProperty(Map> headerProperty) { + this.headerProperty = headerProperty; + return this; + } + + /** + * Get authorization header authentication. + * + * @return the authorization value + */ + public BackendAuthorizationHeaderCredentials authorization() { + return this.authorization; + } + + /** + * Set authorization header authentication. + * + * @param authorization the authorization value to set + * @return the BackendCredentialsContract object itself. + */ + public BackendCredentialsContract withAuthorization(BackendAuthorizationHeaderCredentials authorization) { + this.authorization = authorization; + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/BackendGetEntityTagHeaders.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/BackendGetEntityTagHeaders.java new file mode 100644 index 0000000000000..aa1255c813c35 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/BackendGetEntityTagHeaders.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.apimanagement.v2019_01_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for GetEntityTag operation. + */ +public class BackendGetEntityTagHeaders { + /** + * Current entity state version. Should be treated as opaque and used to + * make conditional HTTP requests. + */ + @JsonProperty(value = "ETag") + private String eTag; + + /** + * Get current entity state version. Should be treated as opaque and used to make conditional HTTP requests. + * + * @return the eTag value + */ + public String eTag() { + return this.eTag; + } + + /** + * Set current entity state version. Should be treated as opaque and used to make conditional HTTP requests. + * + * @param eTag the eTag value to set + * @return the BackendGetEntityTagHeaders object itself. + */ + public BackendGetEntityTagHeaders withETag(String eTag) { + this.eTag = eTag; + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/BackendGetHeaders.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/BackendGetHeaders.java new file mode 100644 index 0000000000000..0b735490a54e0 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/BackendGetHeaders.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.apimanagement.v2019_01_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for Get operation. + */ +public class BackendGetHeaders { + /** + * Current entity state version. Should be treated as opaque and used to + * make conditional HTTP requests. + */ + @JsonProperty(value = "ETag") + private String eTag; + + /** + * Get current entity state version. Should be treated as opaque and used to make conditional HTTP requests. + * + * @return the eTag value + */ + public String eTag() { + return this.eTag; + } + + /** + * Set current entity state version. Should be treated as opaque and used to make conditional HTTP requests. + * + * @param eTag the eTag value to set + * @return the BackendGetHeaders object itself. + */ + public BackendGetHeaders withETag(String eTag) { + this.eTag = eTag; + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/BackendProperties.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/BackendProperties.java new file mode 100644 index 0000000000000..030a99126077d --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/BackendProperties.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.apimanagement.v2019_01_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Properties specific to the Backend Type. + */ +public class BackendProperties { + /** + * Backend Service Fabric Cluster Properties. + */ + @JsonProperty(value = "serviceFabricCluster") + private BackendServiceFabricClusterProperties serviceFabricCluster; + + /** + * Get backend Service Fabric Cluster Properties. + * + * @return the serviceFabricCluster value + */ + public BackendServiceFabricClusterProperties serviceFabricCluster() { + return this.serviceFabricCluster; + } + + /** + * Set backend Service Fabric Cluster Properties. + * + * @param serviceFabricCluster the serviceFabricCluster value to set + * @return the BackendProperties object itself. + */ + public BackendProperties withServiceFabricCluster(BackendServiceFabricClusterProperties serviceFabricCluster) { + this.serviceFabricCluster = serviceFabricCluster; + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/BackendProtocol.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/BackendProtocol.java new file mode 100644 index 0000000000000..ace531b4de4b2 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/BackendProtocol.java @@ -0,0 +1,41 @@ +/** + * 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.apimanagement.v2019_01_01; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for BackendProtocol. + */ +public final class BackendProtocol extends ExpandableStringEnum { + /** Static value http for BackendProtocol. */ + public static final BackendProtocol HTTP = fromString("http"); + + /** Static value soap for BackendProtocol. */ + public static final BackendProtocol SOAP = fromString("soap"); + + /** + * Creates or finds a BackendProtocol from its string representation. + * @param name a name to look for + * @return the corresponding BackendProtocol + */ + @JsonCreator + public static BackendProtocol fromString(String name) { + return fromString(name, BackendProtocol.class); + } + + /** + * @return known BackendProtocol values + */ + public static Collection values() { + return values(BackendProtocol.class); + } +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/BackendProxyContract.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/BackendProxyContract.java new file mode 100644 index 0000000000000..bb927d2f46a0a --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/BackendProxyContract.java @@ -0,0 +1,96 @@ +/** + * 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.apimanagement.v2019_01_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Details of the Backend WebProxy Server to use in the Request to Backend. + */ +public class BackendProxyContract { + /** + * WebProxy Server AbsoluteUri property which includes the entire URI + * stored in the Uri instance, including all fragments and query strings. + */ + @JsonProperty(value = "url", required = true) + private String url; + + /** + * Username to connect to the WebProxy server. + */ + @JsonProperty(value = "username") + private String username; + + /** + * Password to connect to the WebProxy Server. + */ + @JsonProperty(value = "password") + private String password; + + /** + * Get webProxy Server AbsoluteUri property which includes the entire URI stored in the Uri instance, including all fragments and query strings. + * + * @return the url value + */ + public String url() { + return this.url; + } + + /** + * Set webProxy Server AbsoluteUri property which includes the entire URI stored in the Uri instance, including all fragments and query strings. + * + * @param url the url value to set + * @return the BackendProxyContract object itself. + */ + public BackendProxyContract withUrl(String url) { + this.url = url; + return this; + } + + /** + * Get username to connect to the WebProxy server. + * + * @return the username value + */ + public String username() { + return this.username; + } + + /** + * Set username to connect to the WebProxy server. + * + * @param username the username value to set + * @return the BackendProxyContract object itself. + */ + public BackendProxyContract withUsername(String username) { + this.username = username; + return this; + } + + /** + * Get password to connect to the WebProxy Server. + * + * @return the password value + */ + public String password() { + return this.password; + } + + /** + * Set password to connect to the WebProxy Server. + * + * @param password the password value to set + * @return the BackendProxyContract object itself. + */ + public BackendProxyContract withPassword(String password) { + this.password = password; + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/BackendReconnectContract.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/BackendReconnectContract.java new file mode 100644 index 0000000000000..5bf70ffddf2b2 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/BackendReconnectContract.java @@ -0,0 +1,48 @@ +/** + * 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.apimanagement.v2019_01_01; + +import org.joda.time.Period; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * Reconnect request parameters. + */ +@JsonFlatten +public class BackendReconnectContract extends ProxyResource { + /** + * Duration in ISO8601 format after which reconnect will be initiated. + * Minimum duration of the Reconnect is PT2M. + */ + @JsonProperty(value = "properties.after") + private Period after; + + /** + * Get duration in ISO8601 format after which reconnect will be initiated. Minimum duration of the Reconnect is PT2M. + * + * @return the after value + */ + public Period after() { + return this.after; + } + + /** + * Set duration in ISO8601 format after which reconnect will be initiated. Minimum duration of the Reconnect is PT2M. + * + * @param after the after value to set + * @return the BackendReconnectContract object itself. + */ + public BackendReconnectContract withAfter(Period after) { + this.after = after; + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/BackendServiceFabricClusterProperties.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/BackendServiceFabricClusterProperties.java new file mode 100644 index 0000000000000..04f78d30dd712 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/BackendServiceFabricClusterProperties.java @@ -0,0 +1,149 @@ +/** + * 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.apimanagement.v2019_01_01; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Properties of the Service Fabric Type Backend. + */ +public class BackendServiceFabricClusterProperties { + /** + * The client certificate thumbprint for the management endpoint. + */ + @JsonProperty(value = "clientCertificatethumbprint", required = true) + private String clientCertificatethumbprint; + + /** + * Maximum number of retries while attempting resolve the partition. + */ + @JsonProperty(value = "maxPartitionResolutionRetries") + private Integer maxPartitionResolutionRetries; + + /** + * The cluster management endpoint. + */ + @JsonProperty(value = "managementEndpoints", required = true) + private List managementEndpoints; + + /** + * Thumbprints of certificates cluster management service uses for tls + * communication. + */ + @JsonProperty(value = "serverCertificateThumbprints") + private List serverCertificateThumbprints; + + /** + * Server X509 Certificate Names Collection. + */ + @JsonProperty(value = "serverX509Names") + private List serverX509Names; + + /** + * Get the client certificate thumbprint for the management endpoint. + * + * @return the clientCertificatethumbprint value + */ + public String clientCertificatethumbprint() { + return this.clientCertificatethumbprint; + } + + /** + * Set the client certificate thumbprint for the management endpoint. + * + * @param clientCertificatethumbprint the clientCertificatethumbprint value to set + * @return the BackendServiceFabricClusterProperties object itself. + */ + public BackendServiceFabricClusterProperties withClientCertificatethumbprint(String clientCertificatethumbprint) { + this.clientCertificatethumbprint = clientCertificatethumbprint; + return this; + } + + /** + * Get maximum number of retries while attempting resolve the partition. + * + * @return the maxPartitionResolutionRetries value + */ + public Integer maxPartitionResolutionRetries() { + return this.maxPartitionResolutionRetries; + } + + /** + * Set maximum number of retries while attempting resolve the partition. + * + * @param maxPartitionResolutionRetries the maxPartitionResolutionRetries value to set + * @return the BackendServiceFabricClusterProperties object itself. + */ + public BackendServiceFabricClusterProperties withMaxPartitionResolutionRetries(Integer maxPartitionResolutionRetries) { + this.maxPartitionResolutionRetries = maxPartitionResolutionRetries; + return this; + } + + /** + * Get the cluster management endpoint. + * + * @return the managementEndpoints value + */ + public List managementEndpoints() { + return this.managementEndpoints; + } + + /** + * Set the cluster management endpoint. + * + * @param managementEndpoints the managementEndpoints value to set + * @return the BackendServiceFabricClusterProperties object itself. + */ + public BackendServiceFabricClusterProperties withManagementEndpoints(List managementEndpoints) { + this.managementEndpoints = managementEndpoints; + return this; + } + + /** + * Get thumbprints of certificates cluster management service uses for tls communication. + * + * @return the serverCertificateThumbprints value + */ + public List serverCertificateThumbprints() { + return this.serverCertificateThumbprints; + } + + /** + * Set thumbprints of certificates cluster management service uses for tls communication. + * + * @param serverCertificateThumbprints the serverCertificateThumbprints value to set + * @return the BackendServiceFabricClusterProperties object itself. + */ + public BackendServiceFabricClusterProperties withServerCertificateThumbprints(List serverCertificateThumbprints) { + this.serverCertificateThumbprints = serverCertificateThumbprints; + return this; + } + + /** + * Get server X509 Certificate Names Collection. + * + * @return the serverX509Names value + */ + public List serverX509Names() { + return this.serverX509Names; + } + + /** + * Set server X509 Certificate Names Collection. + * + * @param serverX509Names the serverX509Names value to set + * @return the BackendServiceFabricClusterProperties object itself. + */ + public BackendServiceFabricClusterProperties withServerX509Names(List serverX509Names) { + this.serverX509Names = serverX509Names; + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/BackendTlsProperties.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/BackendTlsProperties.java new file mode 100644 index 0000000000000..80dc5561555dc --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/BackendTlsProperties.java @@ -0,0 +1,71 @@ +/** + * 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.apimanagement.v2019_01_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Properties controlling TLS Certificate Validation. + */ +public class BackendTlsProperties { + /** + * Flag indicating whether SSL certificate chain validation should be done + * when using self-signed certificates for this backend host. + */ + @JsonProperty(value = "validateCertificateChain") + private Boolean validateCertificateChain; + + /** + * Flag indicating whether SSL certificate name validation should be done + * when using self-signed certificates for this backend host. + */ + @JsonProperty(value = "validateCertificateName") + private Boolean validateCertificateName; + + /** + * Get flag indicating whether SSL certificate chain validation should be done when using self-signed certificates for this backend host. + * + * @return the validateCertificateChain value + */ + public Boolean validateCertificateChain() { + return this.validateCertificateChain; + } + + /** + * Set flag indicating whether SSL certificate chain validation should be done when using self-signed certificates for this backend host. + * + * @param validateCertificateChain the validateCertificateChain value to set + * @return the BackendTlsProperties object itself. + */ + public BackendTlsProperties withValidateCertificateChain(Boolean validateCertificateChain) { + this.validateCertificateChain = validateCertificateChain; + return this; + } + + /** + * Get flag indicating whether SSL certificate name validation should be done when using self-signed certificates for this backend host. + * + * @return the validateCertificateName value + */ + public Boolean validateCertificateName() { + return this.validateCertificateName; + } + + /** + * Set flag indicating whether SSL certificate name validation should be done when using self-signed certificates for this backend host. + * + * @param validateCertificateName the validateCertificateName value to set + * @return the BackendTlsProperties object itself. + */ + public BackendTlsProperties withValidateCertificateName(Boolean validateCertificateName) { + this.validateCertificateName = validateCertificateName; + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/BackendUpdateParameters.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/BackendUpdateParameters.java new file mode 100644 index 0000000000000..753ab124c79d3 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/BackendUpdateParameters.java @@ -0,0 +1,254 @@ +/** + * 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.apimanagement.v2019_01_01; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; + +/** + * Backend update parameters. + */ +@JsonFlatten +public class BackendUpdateParameters { + /** + * Backend Title. + */ + @JsonProperty(value = "properties.title") + private String title; + + /** + * Backend Description. + */ + @JsonProperty(value = "properties.description") + private String description; + + /** + * Management Uri of the Resource in External System. This url can be the + * Arm Resource Id of Logic Apps, Function Apps or Api Apps. + */ + @JsonProperty(value = "properties.resourceId") + private String resourceId; + + /** + * Backend Properties contract. + */ + @JsonProperty(value = "properties.properties") + private BackendProperties properties; + + /** + * Backend Credentials Contract Properties. + */ + @JsonProperty(value = "properties.credentials") + private BackendCredentialsContract credentials; + + /** + * Backend Proxy Contract Properties. + */ + @JsonProperty(value = "properties.proxy") + private BackendProxyContract proxy; + + /** + * Backend TLS Properties. + */ + @JsonProperty(value = "properties.tls") + private BackendTlsProperties tls; + + /** + * Runtime Url of the Backend. + */ + @JsonProperty(value = "properties.url") + private String url; + + /** + * Backend communication protocol. Possible values include: 'http', 'soap'. + */ + @JsonProperty(value = "properties.protocol") + private BackendProtocol protocol; + + /** + * Get backend Title. + * + * @return the title value + */ + public String title() { + return this.title; + } + + /** + * Set backend Title. + * + * @param title the title value to set + * @return the BackendUpdateParameters object itself. + */ + public BackendUpdateParameters withTitle(String title) { + this.title = title; + return this; + } + + /** + * Get backend Description. + * + * @return the description value + */ + public String description() { + return this.description; + } + + /** + * Set backend Description. + * + * @param description the description value to set + * @return the BackendUpdateParameters object itself. + */ + public BackendUpdateParameters withDescription(String description) { + this.description = description; + return this; + } + + /** + * Get management Uri of the Resource in External System. This url can be the Arm Resource Id of Logic Apps, Function Apps or Api Apps. + * + * @return the resourceId value + */ + public String resourceId() { + return this.resourceId; + } + + /** + * Set management Uri of the Resource in External System. This url can be the Arm Resource Id of Logic Apps, Function Apps or Api Apps. + * + * @param resourceId the resourceId value to set + * @return the BackendUpdateParameters object itself. + */ + public BackendUpdateParameters withResourceId(String resourceId) { + this.resourceId = resourceId; + return this; + } + + /** + * Get backend Properties contract. + * + * @return the properties value + */ + public BackendProperties properties() { + return this.properties; + } + + /** + * Set backend Properties contract. + * + * @param properties the properties value to set + * @return the BackendUpdateParameters object itself. + */ + public BackendUpdateParameters withProperties(BackendProperties properties) { + this.properties = properties; + return this; + } + + /** + * Get backend Credentials Contract Properties. + * + * @return the credentials value + */ + public BackendCredentialsContract credentials() { + return this.credentials; + } + + /** + * Set backend Credentials Contract Properties. + * + * @param credentials the credentials value to set + * @return the BackendUpdateParameters object itself. + */ + public BackendUpdateParameters withCredentials(BackendCredentialsContract credentials) { + this.credentials = credentials; + return this; + } + + /** + * Get backend Proxy Contract Properties. + * + * @return the proxy value + */ + public BackendProxyContract proxy() { + return this.proxy; + } + + /** + * Set backend Proxy Contract Properties. + * + * @param proxy the proxy value to set + * @return the BackendUpdateParameters object itself. + */ + public BackendUpdateParameters withProxy(BackendProxyContract proxy) { + this.proxy = proxy; + return this; + } + + /** + * Get backend TLS Properties. + * + * @return the tls value + */ + public BackendTlsProperties tls() { + return this.tls; + } + + /** + * Set backend TLS Properties. + * + * @param tls the tls value to set + * @return the BackendUpdateParameters object itself. + */ + public BackendUpdateParameters withTls(BackendTlsProperties tls) { + this.tls = tls; + return this; + } + + /** + * Get runtime Url of the Backend. + * + * @return the url value + */ + public String url() { + return this.url; + } + + /** + * Set runtime Url of the Backend. + * + * @param url the url value to set + * @return the BackendUpdateParameters object itself. + */ + public BackendUpdateParameters withUrl(String url) { + this.url = url; + return this; + } + + /** + * Get backend communication protocol. Possible values include: 'http', 'soap'. + * + * @return the protocol value + */ + public BackendProtocol protocol() { + return this.protocol; + } + + /** + * Set backend communication protocol. Possible values include: 'http', 'soap'. + * + * @param protocol the protocol value to set + * @return the BackendUpdateParameters object itself. + */ + public BackendUpdateParameters withProtocol(BackendProtocol protocol) { + this.protocol = protocol; + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/Backends.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/Backends.java new file mode 100644 index 0000000000000..59033e855981b --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/Backends.java @@ -0,0 +1,76 @@ +/** + * 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.apimanagement.v2019_01_01; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import rx.Completable; +import rx.Observable; +import com.microsoft.azure.management.apimanagement.v2019_01_01.implementation.BackendsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing Backends. + */ +public interface Backends extends SupportsCreating, HasInner { + /** + * Lists a collection of backends in the specified service instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByServiceAsync(final String resourceGroupName, final String serviceName); + + /** + * Gets the entity state (Etag) version of the backend specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param backendId Identifier of the Backend entity. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable getEntityTagAsync(String resourceGroupName, String serviceName, String backendId); + + /** + * Gets the details of the backend specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param backendId Identifier of the Backend entity. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String resourceGroupName, String serviceName, String backendId); + + /** + * Deletes the specified backend. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param backendId Identifier of the Backend entity. Must be unique in the current API Management service instance. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable deleteAsync(String resourceGroupName, String serviceName, String backendId, String ifMatch); + + /** + * Notifies the APIM proxy to create a new connection to the backend after the specified timeout. If no timeout was specified, timeout of 2 minutes is used. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param backendId Identifier of the Backend entity. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable reconnectAsync(String resourceGroupName, String serviceName, String backendId); + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/BearerTokenSendingMethod.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/BearerTokenSendingMethod.java new file mode 100644 index 0000000000000..4265d3bb7f0f6 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/BearerTokenSendingMethod.java @@ -0,0 +1,41 @@ +/** + * 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.apimanagement.v2019_01_01; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for BearerTokenSendingMethod. + */ +public final class BearerTokenSendingMethod extends ExpandableStringEnum { + /** Static value authorizationHeader for BearerTokenSendingMethod. */ + public static final BearerTokenSendingMethod AUTHORIZATION_HEADER = fromString("authorizationHeader"); + + /** Static value query for BearerTokenSendingMethod. */ + public static final BearerTokenSendingMethod QUERY = fromString("query"); + + /** + * Creates or finds a BearerTokenSendingMethod from its string representation. + * @param name a name to look for + * @return the corresponding BearerTokenSendingMethod + */ + @JsonCreator + public static BearerTokenSendingMethod fromString(String name) { + return fromString(name, BearerTokenSendingMethod.class); + } + + /** + * @return known BearerTokenSendingMethod values + */ + public static Collection values() { + return values(BearerTokenSendingMethod.class); + } +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/BearerTokenSendingMethods.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/BearerTokenSendingMethods.java new file mode 100644 index 0000000000000..472bc55ca5bbe --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/BearerTokenSendingMethods.java @@ -0,0 +1,41 @@ +/** + * 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.apimanagement.v2019_01_01; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for BearerTokenSendingMethods. + */ +public final class BearerTokenSendingMethods extends ExpandableStringEnum { + /** Static value authorizationHeader for BearerTokenSendingMethods. */ + public static final BearerTokenSendingMethods AUTHORIZATION_HEADER = fromString("authorizationHeader"); + + /** Static value query for BearerTokenSendingMethods. */ + public static final BearerTokenSendingMethods QUERY = fromString("query"); + + /** + * Creates or finds a BearerTokenSendingMethods from its string representation. + * @param name a name to look for + * @return the corresponding BearerTokenSendingMethods + */ + @JsonCreator + public static BearerTokenSendingMethods fromString(String name) { + return fromString(name, BearerTokenSendingMethods.class); + } + + /** + * @return known BearerTokenSendingMethods values + */ + public static Collection values() { + return values(BearerTokenSendingMethods.class); + } +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/BodyDiagnosticSettings.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/BodyDiagnosticSettings.java new file mode 100644 index 0000000000000..0803b8182f57d --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/BodyDiagnosticSettings.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.apimanagement.v2019_01_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Body logging settings. + */ +public class BodyDiagnosticSettings { + /** + * Number of request body bytes to log. + */ + @JsonProperty(value = "bytes") + private Integer bytes; + + /** + * Get number of request body bytes to log. + * + * @return the bytes value + */ + public Integer bytes() { + return this.bytes; + } + + /** + * Set number of request body bytes to log. + * + * @param bytes the bytes value to set + * @return the BodyDiagnosticSettings object itself. + */ + public BodyDiagnosticSettings withBytes(Integer bytes) { + this.bytes = bytes; + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/CacheContract.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/CacheContract.java new file mode 100644 index 0000000000000..9edb16d886454 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/CacheContract.java @@ -0,0 +1,197 @@ +/** + * 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.apimanagement.v2019_01_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.apimanagement.v2019_01_01.implementation.CacheContractInner; +import com.microsoft.azure.arm.model.Indexable; +import com.microsoft.azure.arm.model.Creatable; +import com.microsoft.azure.arm.model.Updatable; +import com.microsoft.azure.arm.model.Appliable; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.apimanagement.v2019_01_01.implementation.ApiManagementManager; + +/** + * Type representing CacheContract. + */ +public interface CacheContract extends HasInner, Indexable, Updatable, HasManager { + /** + * @return the connectionString value. + */ + String connectionString(); + + /** + * @return the description value. + */ + String description(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the resourceId value. + */ + String resourceId(); + + /** + * @return the type value. + */ + String type(); + + /** + * The entirety of the CacheContract definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithResourceGroupName, DefinitionStages.WithServiceName, DefinitionStages.WithIfMatch, DefinitionStages.WithConnectionString, DefinitionStages.WithCreate { + } + + /** + * Grouping of CacheContract definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a CacheContract definition. + */ + interface Blank extends WithResourceGroupName { + } + + /** + * The stage of the cachecontract definition allowing to specify ResourceGroupName. + */ + interface WithResourceGroupName { + /** + * Specifies resourceGroupName. + * @param resourceGroupName The name of the resource group + * @return the next definition stage + */ + WithServiceName withResourceGroupName(String resourceGroupName); + } + + /** + * The stage of the cachecontract definition allowing to specify ServiceName. + */ + interface WithServiceName { + /** + * Specifies serviceName. + * @param serviceName The name of the API Management service + * @return the next definition stage + */ + WithIfMatch withServiceName(String serviceName); + } + + /** + * The stage of the cachecontract definition allowing to specify IfMatch. + */ + interface WithIfMatch { + /** + * Specifies ifMatch. + * @param ifMatch ETag of the Entity. Not required when creating an entity, but required when updating an entity + * @return the next definition stage + */ + WithConnectionString withIfMatch(String ifMatch); + } + + /** + * The stage of the cachecontract definition allowing to specify ConnectionString. + */ + interface WithConnectionString { + /** + * Specifies connectionString. + * @param connectionString Runtime connection string to cache + * @return the next definition stage + */ + WithCreate withConnectionString(String connectionString); + } + + /** + * The stage of the cachecontract definition allowing to specify Description. + */ + interface WithDescription { + /** + * Specifies description. + * @param description Cache description + * @return the next definition stage + */ + WithCreate withDescription(String description); + } + + /** + * The stage of the cachecontract definition allowing to specify ResourceId. + */ + interface WithResourceId { + /** + * Specifies resourceId. + * @param resourceId Original uri of entity in external system cache points to + * @return the next definition stage + */ + WithCreate withResourceId(String resourceId); + } + + /** + * The stage of the definition which contains all the minimum required inputs for + * the resource to be created (via {@link WithCreate#create()}), but also allows + * for any other optional settings to be specified. + */ + interface WithCreate extends Creatable, DefinitionStages.WithDescription, DefinitionStages.WithResourceId { + } + } + /** + * The template for a CacheContract update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithIfMatch, UpdateStages.WithDescription, UpdateStages.WithResourceId { + } + + /** + * Grouping of CacheContract update stages. + */ + interface UpdateStages { + /** + * The stage of the cachecontract update allowing to specify IfMatch. + */ + interface WithIfMatch { + /** + * Specifies ifMatch. + * @param ifMatch ETag of the Entity. Not required when creating an entity, but required when updating an entity + * @return the next update stage + */ + Update withIfMatch(String ifMatch); + } + + /** + * The stage of the cachecontract update allowing to specify Description. + */ + interface WithDescription { + /** + * Specifies description. + * @param description Cache description + * @return the next update stage + */ + Update withDescription(String description); + } + + /** + * The stage of the cachecontract update allowing to specify ResourceId. + */ + interface WithResourceId { + /** + * Specifies resourceId. + * @param resourceId Original uri of entity in external system cache points to + * @return the next update stage + */ + Update withResourceId(String resourceId); + } + + } +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/CacheCreateOrUpdateHeaders.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/CacheCreateOrUpdateHeaders.java new file mode 100644 index 0000000000000..35ad4194476ae --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/CacheCreateOrUpdateHeaders.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.apimanagement.v2019_01_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for CreateOrUpdate operation. + */ +public class CacheCreateOrUpdateHeaders { + /** + * Current entity state version. Should be treated as opaque and used to + * make conditional HTTP requests. + */ + @JsonProperty(value = "ETag") + private String eTag; + + /** + * Get current entity state version. Should be treated as opaque and used to make conditional HTTP requests. + * + * @return the eTag value + */ + public String eTag() { + return this.eTag; + } + + /** + * Set current entity state version. Should be treated as opaque and used to make conditional HTTP requests. + * + * @param eTag the eTag value to set + * @return the CacheCreateOrUpdateHeaders object itself. + */ + public CacheCreateOrUpdateHeaders withETag(String eTag) { + this.eTag = eTag; + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/CacheGetEntityTagHeaders.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/CacheGetEntityTagHeaders.java new file mode 100644 index 0000000000000..b3a6322287491 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/CacheGetEntityTagHeaders.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.apimanagement.v2019_01_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for GetEntityTag operation. + */ +public class CacheGetEntityTagHeaders { + /** + * Current entity state version. Should be treated as opaque and used to + * make conditional HTTP requests. + */ + @JsonProperty(value = "ETag") + private String eTag; + + /** + * Get current entity state version. Should be treated as opaque and used to make conditional HTTP requests. + * + * @return the eTag value + */ + public String eTag() { + return this.eTag; + } + + /** + * Set current entity state version. Should be treated as opaque and used to make conditional HTTP requests. + * + * @param eTag the eTag value to set + * @return the CacheGetEntityTagHeaders object itself. + */ + public CacheGetEntityTagHeaders withETag(String eTag) { + this.eTag = eTag; + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/CacheGetHeaders.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/CacheGetHeaders.java new file mode 100644 index 0000000000000..4c1030fde7e51 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/CacheGetHeaders.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.apimanagement.v2019_01_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for Get operation. + */ +public class CacheGetHeaders { + /** + * Current entity state version. Should be treated as opaque and used to + * make conditional HTTP requests. + */ + @JsonProperty(value = "ETag") + private String eTag; + + /** + * Get current entity state version. Should be treated as opaque and used to make conditional HTTP requests. + * + * @return the eTag value + */ + public String eTag() { + return this.eTag; + } + + /** + * Set current entity state version. Should be treated as opaque and used to make conditional HTTP requests. + * + * @param eTag the eTag value to set + * @return the CacheGetHeaders object itself. + */ + public CacheGetHeaders withETag(String eTag) { + this.eTag = eTag; + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/CacheUpdateParameters.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/CacheUpdateParameters.java new file mode 100644 index 0000000000000..886e89e1cfd03 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/CacheUpdateParameters.java @@ -0,0 +1,97 @@ +/** + * 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.apimanagement.v2019_01_01; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; + +/** + * Cache update details. + */ +@JsonFlatten +public class CacheUpdateParameters { + /** + * Cache description. + */ + @JsonProperty(value = "properties.description") + private String description; + + /** + * Runtime connection string to cache. + */ + @JsonProperty(value = "properties.connectionString") + private String connectionString; + + /** + * Original uri of entity in external system cache points to. + */ + @JsonProperty(value = "properties.resourceId") + private String resourceId; + + /** + * Get cache description. + * + * @return the description value + */ + public String description() { + return this.description; + } + + /** + * Set cache description. + * + * @param description the description value to set + * @return the CacheUpdateParameters object itself. + */ + public CacheUpdateParameters withDescription(String description) { + this.description = description; + return this; + } + + /** + * Get runtime connection string to cache. + * + * @return the connectionString value + */ + public String connectionString() { + return this.connectionString; + } + + /** + * Set runtime connection string to cache. + * + * @param connectionString the connectionString value to set + * @return the CacheUpdateParameters object itself. + */ + public CacheUpdateParameters withConnectionString(String connectionString) { + this.connectionString = connectionString; + return this; + } + + /** + * Get original uri of entity in external system cache points to. + * + * @return the resourceId value + */ + public String resourceId() { + return this.resourceId; + } + + /** + * Set original uri of entity in external system cache points to. + * + * @param resourceId the resourceId value to set + * @return the CacheUpdateParameters object itself. + */ + public CacheUpdateParameters withResourceId(String resourceId) { + this.resourceId = resourceId; + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/Caches.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/Caches.java new file mode 100644 index 0000000000000..a5370d813eb24 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/Caches.java @@ -0,0 +1,65 @@ +/** + * 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.apimanagement.v2019_01_01; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import rx.Completable; +import rx.Observable; +import com.microsoft.azure.management.apimanagement.v2019_01_01.implementation.CachesInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing Caches. + */ +public interface Caches extends SupportsCreating, HasInner { + /** + * Lists a collection of all external Caches in the specified service instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByServiceAsync(final String resourceGroupName, final String serviceName); + + /** + * Gets the entity state (Etag) version of the Cache specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param cacheId Identifier of the Cache entity. Cache identifier (should be either 'default' or valid Azure region identifier). + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable getEntityTagAsync(String resourceGroupName, String serviceName, String cacheId); + + /** + * Gets the details of the Cache specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param cacheId Identifier of the Cache entity. Cache identifier (should be either 'default' or valid Azure region identifier). + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String resourceGroupName, String serviceName, String cacheId); + + /** + * Deletes specific Cache. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param cacheId Identifier of the Cache entity. Cache identifier (should be either 'default' or valid Azure region identifier). + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable deleteAsync(String resourceGroupName, String serviceName, String cacheId, String ifMatch); + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/CertificateConfiguration.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/CertificateConfiguration.java new file mode 100644 index 0000000000000..471669e6570a4 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/CertificateConfiguration.java @@ -0,0 +1,124 @@ +/** + * 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.apimanagement.v2019_01_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Certificate configuration which consist of non-trusted intermediates and + * root certificates. + */ +public class CertificateConfiguration { + /** + * Base64 Encoded certificate. + */ + @JsonProperty(value = "encodedCertificate") + private String encodedCertificate; + + /** + * Certificate Password. + */ + @JsonProperty(value = "certificatePassword") + private String certificatePassword; + + /** + * The System.Security.Cryptography.x509certificates.StoreName certificate + * store location. Only Root and CertificateAuthority are valid locations. + * Possible values include: 'CertificateAuthority', 'Root'. + */ + @JsonProperty(value = "storeName", required = true) + private String storeName; + + /** + * Certificate information. + */ + @JsonProperty(value = "certificate") + private CertificateInformation certificate; + + /** + * Get base64 Encoded certificate. + * + * @return the encodedCertificate value + */ + public String encodedCertificate() { + return this.encodedCertificate; + } + + /** + * Set base64 Encoded certificate. + * + * @param encodedCertificate the encodedCertificate value to set + * @return the CertificateConfiguration object itself. + */ + public CertificateConfiguration withEncodedCertificate(String encodedCertificate) { + this.encodedCertificate = encodedCertificate; + return this; + } + + /** + * Get certificate Password. + * + * @return the certificatePassword value + */ + public String certificatePassword() { + return this.certificatePassword; + } + + /** + * Set certificate Password. + * + * @param certificatePassword the certificatePassword value to set + * @return the CertificateConfiguration object itself. + */ + public CertificateConfiguration withCertificatePassword(String certificatePassword) { + this.certificatePassword = certificatePassword; + return this; + } + + /** + * Get the System.Security.Cryptography.x509certificates.StoreName certificate store location. Only Root and CertificateAuthority are valid locations. Possible values include: 'CertificateAuthority', 'Root'. + * + * @return the storeName value + */ + public String storeName() { + return this.storeName; + } + + /** + * Set the System.Security.Cryptography.x509certificates.StoreName certificate store location. Only Root and CertificateAuthority are valid locations. Possible values include: 'CertificateAuthority', 'Root'. + * + * @param storeName the storeName value to set + * @return the CertificateConfiguration object itself. + */ + public CertificateConfiguration withStoreName(String storeName) { + this.storeName = storeName; + return this; + } + + /** + * Get certificate information. + * + * @return the certificate value + */ + public CertificateInformation certificate() { + return this.certificate; + } + + /** + * Set certificate information. + * + * @param certificate the certificate value to set + * @return the CertificateConfiguration object itself. + */ + public CertificateConfiguration withCertificate(CertificateInformation certificate) { + this.certificate = certificate; + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/CertificateContract.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/CertificateContract.java new file mode 100644 index 0000000000000..91134aea93017 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/CertificateContract.java @@ -0,0 +1,162 @@ +/** + * 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.apimanagement.v2019_01_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.apimanagement.v2019_01_01.implementation.CertificateContractInner; +import com.microsoft.azure.arm.model.Indexable; +import com.microsoft.azure.arm.model.Creatable; +import com.microsoft.azure.arm.model.Updatable; +import com.microsoft.azure.arm.model.Appliable; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.apimanagement.v2019_01_01.implementation.ApiManagementManager; +import org.joda.time.DateTime; + +/** + * Type representing CertificateContract. + */ +public interface CertificateContract extends HasInner, Indexable, Updatable, HasManager { + /** + * @return the expirationDate value. + */ + DateTime expirationDate(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the subject value. + */ + String subject(); + + /** + * @return the thumbprint value. + */ + String thumbprint(); + + /** + * @return the type value. + */ + String type(); + + /** + * The entirety of the CertificateContract definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithResourceGroupName, DefinitionStages.WithServiceName, DefinitionStages.WithIfMatch, DefinitionStages.WithData, DefinitionStages.WithPassword, DefinitionStages.WithCreate { + } + + /** + * Grouping of CertificateContract definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a CertificateContract definition. + */ + interface Blank extends WithResourceGroupName { + } + + /** + * The stage of the certificatecontract definition allowing to specify ResourceGroupName. + */ + interface WithResourceGroupName { + /** + * Specifies resourceGroupName. + * @param resourceGroupName The name of the resource group + * @return the next definition stage + */ + WithServiceName withResourceGroupName(String resourceGroupName); + } + + /** + * The stage of the certificatecontract definition allowing to specify ServiceName. + */ + interface WithServiceName { + /** + * Specifies serviceName. + * @param serviceName The name of the API Management service + * @return the next definition stage + */ + WithIfMatch withServiceName(String serviceName); + } + + /** + * The stage of the certificatecontract definition allowing to specify IfMatch. + */ + interface WithIfMatch { + /** + * Specifies ifMatch. + * @param ifMatch ETag of the Entity. Not required when creating an entity, but required when updating an entity + * @return the next definition stage + */ + WithData withIfMatch(String ifMatch); + } + + /** + * The stage of the certificatecontract definition allowing to specify Data. + */ + interface WithData { + /** + * Specifies data. + * @param data Base 64 encoded certificate using the application/x-pkcs12 representation + * @return the next definition stage + */ + WithPassword withData(String data); + } + + /** + * The stage of the certificatecontract definition allowing to specify Password. + */ + interface WithPassword { + /** + * Specifies password. + * @param password Password for the Certificate + * @return the next definition stage + */ + WithCreate withPassword(String password); + } + + /** + * The stage of the definition which contains all the minimum required inputs for + * the resource to be created (via {@link WithCreate#create()}), but also allows + * for any other optional settings to be specified. + */ + interface WithCreate extends Creatable { + } + } + /** + * The template for a CertificateContract update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithIfMatch { + } + + /** + * Grouping of CertificateContract update stages. + */ + interface UpdateStages { + /** + * The stage of the certificatecontract update allowing to specify IfMatch. + */ + interface WithIfMatch { + /** + * Specifies ifMatch. + * @param ifMatch ETag of the Entity. Not required when creating an entity, but required when updating an entity + * @return the next update stage + */ + Update withIfMatch(String ifMatch); + } + + } +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/CertificateCreateOrUpdateHeaders.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/CertificateCreateOrUpdateHeaders.java new file mode 100644 index 0000000000000..64129103d8608 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/CertificateCreateOrUpdateHeaders.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.apimanagement.v2019_01_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for CreateOrUpdate operation. + */ +public class CertificateCreateOrUpdateHeaders { + /** + * Current entity state version. Should be treated as opaque and used to + * make conditional HTTP requests. + */ + @JsonProperty(value = "ETag") + private String eTag; + + /** + * Get current entity state version. Should be treated as opaque and used to make conditional HTTP requests. + * + * @return the eTag value + */ + public String eTag() { + return this.eTag; + } + + /** + * Set current entity state version. Should be treated as opaque and used to make conditional HTTP requests. + * + * @param eTag the eTag value to set + * @return the CertificateCreateOrUpdateHeaders object itself. + */ + public CertificateCreateOrUpdateHeaders withETag(String eTag) { + this.eTag = eTag; + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/CertificateCreateOrUpdateParameters.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/CertificateCreateOrUpdateParameters.java new file mode 100644 index 0000000000000..3f45de83a10c1 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/CertificateCreateOrUpdateParameters.java @@ -0,0 +1,72 @@ +/** + * 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.apimanagement.v2019_01_01; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; + +/** + * Certificate create or update details. + */ +@JsonFlatten +public class CertificateCreateOrUpdateParameters { + /** + * Base 64 encoded certificate using the application/x-pkcs12 + * representation. + */ + @JsonProperty(value = "properties.data", required = true) + private String data; + + /** + * Password for the Certificate. + */ + @JsonProperty(value = "properties.password", required = true) + private String password; + + /** + * Get base 64 encoded certificate using the application/x-pkcs12 representation. + * + * @return the data value + */ + public String data() { + return this.data; + } + + /** + * Set base 64 encoded certificate using the application/x-pkcs12 representation. + * + * @param data the data value to set + * @return the CertificateCreateOrUpdateParameters object itself. + */ + public CertificateCreateOrUpdateParameters withData(String data) { + this.data = data; + return this; + } + + /** + * Get password for the Certificate. + * + * @return the password value + */ + public String password() { + return this.password; + } + + /** + * Set password for the Certificate. + * + * @param password the password value to set + * @return the CertificateCreateOrUpdateParameters object itself. + */ + public CertificateCreateOrUpdateParameters withPassword(String password) { + this.password = password; + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/CertificateGetEntityTagHeaders.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/CertificateGetEntityTagHeaders.java new file mode 100644 index 0000000000000..086cd340f4732 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/CertificateGetEntityTagHeaders.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.apimanagement.v2019_01_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for GetEntityTag operation. + */ +public class CertificateGetEntityTagHeaders { + /** + * Current entity state version. Should be treated as opaque and used to + * make conditional HTTP requests. + */ + @JsonProperty(value = "ETag") + private String eTag; + + /** + * Get current entity state version. Should be treated as opaque and used to make conditional HTTP requests. + * + * @return the eTag value + */ + public String eTag() { + return this.eTag; + } + + /** + * Set current entity state version. Should be treated as opaque and used to make conditional HTTP requests. + * + * @param eTag the eTag value to set + * @return the CertificateGetEntityTagHeaders object itself. + */ + public CertificateGetEntityTagHeaders withETag(String eTag) { + this.eTag = eTag; + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/CertificateGetHeaders.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/CertificateGetHeaders.java new file mode 100644 index 0000000000000..69e20a7b83014 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/CertificateGetHeaders.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.apimanagement.v2019_01_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for Get operation. + */ +public class CertificateGetHeaders { + /** + * Current entity state version. Should be treated as opaque and used to + * make conditional HTTP requests. + */ + @JsonProperty(value = "ETag") + private String eTag; + + /** + * Get current entity state version. Should be treated as opaque and used to make conditional HTTP requests. + * + * @return the eTag value + */ + public String eTag() { + return this.eTag; + } + + /** + * Set current entity state version. Should be treated as opaque and used to make conditional HTTP requests. + * + * @param eTag the eTag value to set + * @return the CertificateGetHeaders object itself. + */ + public CertificateGetHeaders withETag(String eTag) { + this.eTag = eTag; + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/CertificateInformation.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/CertificateInformation.java new file mode 100644 index 0000000000000..707e762fc50ab --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/CertificateInformation.java @@ -0,0 +1,97 @@ +/** + * 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.apimanagement.v2019_01_01; + +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * SSL certificate information. + */ +public class CertificateInformation { + /** + * Expiration date of the certificate. The date conforms to the following + * format: `yyyy-MM-ddTHH:mm:ssZ` as specified by the ISO 8601 standard. + */ + @JsonProperty(value = "expiry", required = true) + private DateTime expiry; + + /** + * Thumbprint of the certificate. + */ + @JsonProperty(value = "thumbprint", required = true) + private String thumbprint; + + /** + * Subject of the certificate. + */ + @JsonProperty(value = "subject", required = true) + private String subject; + + /** + * Get expiration date of the certificate. The date conforms to the following format: `yyyy-MM-ddTHH:mm:ssZ` as specified by the ISO 8601 standard. + * + * @return the expiry value + */ + public DateTime expiry() { + return this.expiry; + } + + /** + * Set expiration date of the certificate. The date conforms to the following format: `yyyy-MM-ddTHH:mm:ssZ` as specified by the ISO 8601 standard. + * + * @param expiry the expiry value to set + * @return the CertificateInformation object itself. + */ + public CertificateInformation withExpiry(DateTime expiry) { + this.expiry = expiry; + return this; + } + + /** + * Get thumbprint of the certificate. + * + * @return the thumbprint value + */ + public String thumbprint() { + return this.thumbprint; + } + + /** + * Set thumbprint of the certificate. + * + * @param thumbprint the thumbprint value to set + * @return the CertificateInformation object itself. + */ + public CertificateInformation withThumbprint(String thumbprint) { + this.thumbprint = thumbprint; + return this; + } + + /** + * Get subject of the certificate. + * + * @return the subject value + */ + public String subject() { + return this.subject; + } + + /** + * Set subject of the certificate. + * + * @param subject the subject value to set + * @return the CertificateInformation object itself. + */ + public CertificateInformation withSubject(String subject) { + this.subject = subject; + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/Certificates.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/Certificates.java new file mode 100644 index 0000000000000..1677b0e5b1244 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/Certificates.java @@ -0,0 +1,65 @@ +/** + * 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.apimanagement.v2019_01_01; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import rx.Completable; +import rx.Observable; +import com.microsoft.azure.management.apimanagement.v2019_01_01.implementation.CertificatesInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing Certificates. + */ +public interface Certificates extends SupportsCreating, HasInner { + /** + * Lists a collection of all certificates in the specified service instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByServiceAsync(final String resourceGroupName, final String serviceName); + + /** + * Gets the entity state (Etag) version of the certificate specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param certificateId Identifier of the certificate entity. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable getEntityTagAsync(String resourceGroupName, String serviceName, String certificateId); + + /** + * Gets the details of the certificate specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param certificateId Identifier of the certificate entity. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String resourceGroupName, String serviceName, String certificateId); + + /** + * Deletes specific certificate. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param certificateId Identifier of the certificate entity. Must be unique in the current API Management service instance. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable deleteAsync(String resourceGroupName, String serviceName, String certificateId, String ifMatch); + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ClientAuthenticationMethod.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ClientAuthenticationMethod.java new file mode 100644 index 0000000000000..7e8d78192614f --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ClientAuthenticationMethod.java @@ -0,0 +1,41 @@ +/** + * 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.apimanagement.v2019_01_01; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for ClientAuthenticationMethod. + */ +public final class ClientAuthenticationMethod extends ExpandableStringEnum { + /** Static value Basic for ClientAuthenticationMethod. */ + public static final ClientAuthenticationMethod BASIC = fromString("Basic"); + + /** Static value Body for ClientAuthenticationMethod. */ + public static final ClientAuthenticationMethod BODY = fromString("Body"); + + /** + * Creates or finds a ClientAuthenticationMethod from its string representation. + * @param name a name to look for + * @return the corresponding ClientAuthenticationMethod + */ + @JsonCreator + public static ClientAuthenticationMethod fromString(String name) { + return fromString(name, ClientAuthenticationMethod.class); + } + + /** + * @return known ClientAuthenticationMethod values + */ + public static Collection values() { + return values(ClientAuthenticationMethod.class); + } +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/Confirmation.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/Confirmation.java new file mode 100644 index 0000000000000..928b74ab2dd2b --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/Confirmation.java @@ -0,0 +1,41 @@ +/** + * 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.apimanagement.v2019_01_01; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for Confirmation. + */ +public final class Confirmation extends ExpandableStringEnum { + /** Static value signup for Confirmation. */ + public static final Confirmation SIGNUP = fromString("signup"); + + /** Static value invite for Confirmation. */ + public static final Confirmation INVITE = fromString("invite"); + + /** + * Creates or finds a Confirmation from its string representation. + * @param name a name to look for + * @return the corresponding Confirmation + */ + @JsonCreator + public static Confirmation fromString(String name) { + return fromString(name, Confirmation.class); + } + + /** + * @return known Confirmation values + */ + public static Collection values() { + return values(Confirmation.class); + } +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ConnectivityStatusContract.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ConnectivityStatusContract.java new file mode 100644 index 0000000000000..6f8050f57c1ae --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ConnectivityStatusContract.java @@ -0,0 +1,158 @@ +/** + * 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.apimanagement.v2019_01_01; + +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Details about connectivity to a resource. + */ +public class ConnectivityStatusContract { + /** + * The hostname of the resource which the service depends on. This can be + * the database, storage or any other azure resource on which the service + * depends upon. + */ + @JsonProperty(value = "name", required = true) + private String name; + + /** + * Resource Connectivity Status Type identifier. Possible values include: + * 'initializing', 'success', 'failure'. + */ + @JsonProperty(value = "status", required = true) + private ConnectivityStatusType status; + + /** + * Error details of the connectivity to the resource. + */ + @JsonProperty(value = "error") + private String error; + + /** + * The date when the resource connectivity status was last updated. This + * status should be updated every 15 minutes. If this status has not been + * updated, then it means that the service has lost network connectivity to + * the resource, from inside the Virtual Network.The date conforms to the + * following format: `yyyy-MM-ddTHH:mm:ssZ` as specified by the ISO 8601 + * standard. + */ + @JsonProperty(value = "lastUpdated", required = true) + private DateTime lastUpdated; + + /** + * The date when the resource connectivity status last Changed from success + * to failure or vice-versa. The date conforms to the following format: + * `yyyy-MM-ddTHH:mm:ssZ` as specified by the ISO 8601 standard. + */ + @JsonProperty(value = "lastStatusChange", required = true) + private DateTime lastStatusChange; + + /** + * Get the hostname of the resource which the service depends on. This can be the database, storage or any other azure resource on which the service depends upon. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set the hostname of the resource which the service depends on. This can be the database, storage or any other azure resource on which the service depends upon. + * + * @param name the name value to set + * @return the ConnectivityStatusContract object itself. + */ + public ConnectivityStatusContract withName(String name) { + this.name = name; + return this; + } + + /** + * Get resource Connectivity Status Type identifier. Possible values include: 'initializing', 'success', 'failure'. + * + * @return the status value + */ + public ConnectivityStatusType status() { + return this.status; + } + + /** + * Set resource Connectivity Status Type identifier. Possible values include: 'initializing', 'success', 'failure'. + * + * @param status the status value to set + * @return the ConnectivityStatusContract object itself. + */ + public ConnectivityStatusContract withStatus(ConnectivityStatusType status) { + this.status = status; + return this; + } + + /** + * Get error details of the connectivity to the resource. + * + * @return the error value + */ + public String error() { + return this.error; + } + + /** + * Set error details of the connectivity to the resource. + * + * @param error the error value to set + * @return the ConnectivityStatusContract object itself. + */ + public ConnectivityStatusContract withError(String error) { + this.error = error; + return this; + } + + /** + * Get the date when the resource connectivity status was last updated. This status should be updated every 15 minutes. If this status has not been updated, then it means that the service has lost network connectivity to the resource, from inside the Virtual Network.The date conforms to the following format: `yyyy-MM-ddTHH:mm:ssZ` as specified by the ISO 8601 standard. + * + * @return the lastUpdated value + */ + public DateTime lastUpdated() { + return this.lastUpdated; + } + + /** + * Set the date when the resource connectivity status was last updated. This status should be updated every 15 minutes. If this status has not been updated, then it means that the service has lost network connectivity to the resource, from inside the Virtual Network.The date conforms to the following format: `yyyy-MM-ddTHH:mm:ssZ` as specified by the ISO 8601 standard. + * + * @param lastUpdated the lastUpdated value to set + * @return the ConnectivityStatusContract object itself. + */ + public ConnectivityStatusContract withLastUpdated(DateTime lastUpdated) { + this.lastUpdated = lastUpdated; + return this; + } + + /** + * Get the date when the resource connectivity status last Changed from success to failure or vice-versa. The date conforms to the following format: `yyyy-MM-ddTHH:mm:ssZ` as specified by the ISO 8601 standard. + * + * @return the lastStatusChange value + */ + public DateTime lastStatusChange() { + return this.lastStatusChange; + } + + /** + * Set the date when the resource connectivity status last Changed from success to failure or vice-versa. The date conforms to the following format: `yyyy-MM-ddTHH:mm:ssZ` as specified by the ISO 8601 standard. + * + * @param lastStatusChange the lastStatusChange value to set + * @return the ConnectivityStatusContract object itself. + */ + public ConnectivityStatusContract withLastStatusChange(DateTime lastStatusChange) { + this.lastStatusChange = lastStatusChange; + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ConnectivityStatusType.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ConnectivityStatusType.java new file mode 100644 index 0000000000000..e31a784950467 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ConnectivityStatusType.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.apimanagement.v2019_01_01; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for ConnectivityStatusType. + */ +public final class ConnectivityStatusType extends ExpandableStringEnum { + /** Static value initializing for ConnectivityStatusType. */ + public static final ConnectivityStatusType INITIALIZING = fromString("initializing"); + + /** Static value success for ConnectivityStatusType. */ + public static final ConnectivityStatusType SUCCESS = fromString("success"); + + /** Static value failure for ConnectivityStatusType. */ + public static final ConnectivityStatusType FAILURE = fromString("failure"); + + /** + * Creates or finds a ConnectivityStatusType from its string representation. + * @param name a name to look for + * @return the corresponding ConnectivityStatusType + */ + @JsonCreator + public static ConnectivityStatusType fromString(String name) { + return fromString(name, ConnectivityStatusType.class); + } + + /** + * @return known ConnectivityStatusType values + */ + public static Collection values() { + return values(ConnectivityStatusType.class); + } +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ContentFormat.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ContentFormat.java new file mode 100644 index 0000000000000..dc58721ca17bd --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ContentFormat.java @@ -0,0 +1,62 @@ +/** + * 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.apimanagement.v2019_01_01; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for ContentFormat. + */ +public final class ContentFormat extends ExpandableStringEnum { + /** Static value wadl-xml for ContentFormat. */ + public static final ContentFormat WADL_XML = fromString("wadl-xml"); + + /** Static value wadl-link-json for ContentFormat. */ + public static final ContentFormat WADL_LINK_JSON = fromString("wadl-link-json"); + + /** Static value swagger-json for ContentFormat. */ + public static final ContentFormat SWAGGER_JSON = fromString("swagger-json"); + + /** Static value swagger-link-json for ContentFormat. */ + public static final ContentFormat SWAGGER_LINK_JSON = fromString("swagger-link-json"); + + /** Static value wsdl for ContentFormat. */ + public static final ContentFormat WSDL = fromString("wsdl"); + + /** Static value wsdl-link for ContentFormat. */ + public static final ContentFormat WSDL_LINK = fromString("wsdl-link"); + + /** Static value openapi for ContentFormat. */ + public static final ContentFormat OPENAPI = fromString("openapi"); + + /** Static value openapi+json for ContentFormat. */ + public static final ContentFormat OPENAPIJSON = fromString("openapi+json"); + + /** Static value openapi-link for ContentFormat. */ + public static final ContentFormat OPENAPI_LINK = fromString("openapi-link"); + + /** + * Creates or finds a ContentFormat from its string representation. + * @param name a name to look for + * @return the corresponding ContentFormat + */ + @JsonCreator + public static ContentFormat fromString(String name) { + return fromString(name, ContentFormat.class); + } + + /** + * @return known ContentFormat values + */ + public static Collection values() { + return values(ContentFormat.class); + } +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/DelegationSettings.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/DelegationSettings.java new file mode 100644 index 0000000000000..6eafe580f3892 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/DelegationSettings.java @@ -0,0 +1,64 @@ +/** + * 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.apimanagement.v2019_01_01; + +import rx.Completable; +import rx.Observable; +import com.microsoft.azure.management.apimanagement.v2019_01_01.implementation.PortalDelegationSettingsInner; +import com.microsoft.azure.management.apimanagement.v2019_01_01.implementation.DelegationSettingsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing DelegationSettings. + */ +public interface DelegationSettings extends HasInner { + /** + * Gets the entity state (Etag) version of the DelegationSettings. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable getEntityTagAsync(String resourceGroupName, String serviceName); + + /** + * Get Delegation Settings for the Portal. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String resourceGroupName, String serviceName); + + /** + * Update Delegation settings. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param parameters Update Delegation settings. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable updateAsync(String resourceGroupName, String serviceName, PortalDelegationSettingsInner parameters, String ifMatch); + + /** + * Create or Update Delegation settings. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param parameters Create or update parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable createOrUpdateAsync(String resourceGroupName, String serviceName, PortalDelegationSettingsInner parameters); + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/DelegationSettingsGetEntityTagHeaders.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/DelegationSettingsGetEntityTagHeaders.java new file mode 100644 index 0000000000000..608044360bc14 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/DelegationSettingsGetEntityTagHeaders.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.apimanagement.v2019_01_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for GetEntityTag operation. + */ +public class DelegationSettingsGetEntityTagHeaders { + /** + * Current entity state version. Should be treated as opaque and used to + * make conditional HTTP requests. + */ + @JsonProperty(value = "ETag") + private String eTag; + + /** + * Get current entity state version. Should be treated as opaque and used to make conditional HTTP requests. + * + * @return the eTag value + */ + public String eTag() { + return this.eTag; + } + + /** + * Set current entity state version. Should be treated as opaque and used to make conditional HTTP requests. + * + * @param eTag the eTag value to set + * @return the DelegationSettingsGetEntityTagHeaders object itself. + */ + public DelegationSettingsGetEntityTagHeaders withETag(String eTag) { + this.eTag = eTag; + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/DelegationSettingsGetHeaders.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/DelegationSettingsGetHeaders.java new file mode 100644 index 0000000000000..199781a46fd2d --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/DelegationSettingsGetHeaders.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.apimanagement.v2019_01_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for Get operation. + */ +public class DelegationSettingsGetHeaders { + /** + * Current entity state version. Should be treated as opaque and used to + * make conditional HTTP requests. + */ + @JsonProperty(value = "ETag") + private String eTag; + + /** + * Get current entity state version. Should be treated as opaque and used to make conditional HTTP requests. + * + * @return the eTag value + */ + public String eTag() { + return this.eTag; + } + + /** + * Set current entity state version. Should be treated as opaque and used to make conditional HTTP requests. + * + * @param eTag the eTag value to set + * @return the DelegationSettingsGetHeaders object itself. + */ + public DelegationSettingsGetHeaders withETag(String eTag) { + this.eTag = eTag; + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/DeployConfigurationParameters.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/DeployConfigurationParameters.java new file mode 100644 index 0000000000000..a04f0f111b4e7 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/DeployConfigurationParameters.java @@ -0,0 +1,73 @@ +/** + * 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.apimanagement.v2019_01_01; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; + +/** + * Deploy Tenant Configuration Contract. + */ +@JsonFlatten +public class DeployConfigurationParameters { + /** + * The name of the Git branch from which the configuration is to be + * deployed to the configuration database. + */ + @JsonProperty(value = "properties.branch", required = true) + private String branch; + + /** + * The value enforcing deleting subscriptions to products that are deleted + * in this update. + */ + @JsonProperty(value = "properties.force") + private Boolean force; + + /** + * Get the name of the Git branch from which the configuration is to be deployed to the configuration database. + * + * @return the branch value + */ + public String branch() { + return this.branch; + } + + /** + * Set the name of the Git branch from which the configuration is to be deployed to the configuration database. + * + * @param branch the branch value to set + * @return the DeployConfigurationParameters object itself. + */ + public DeployConfigurationParameters withBranch(String branch) { + this.branch = branch; + return this; + } + + /** + * Get the value enforcing deleting subscriptions to products that are deleted in this update. + * + * @return the force value + */ + public Boolean force() { + return this.force; + } + + /** + * Set the value enforcing deleting subscriptions to products that are deleted in this update. + * + * @param force the force value to set + * @return the DeployConfigurationParameters object itself. + */ + public DeployConfigurationParameters withForce(Boolean force) { + this.force = force; + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/DiagnosticContract.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/DiagnosticContract.java new file mode 100644 index 0000000000000..01d8b67f9112c --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/DiagnosticContract.java @@ -0,0 +1,284 @@ +/** + * 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.apimanagement.v2019_01_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.apimanagement.v2019_01_01.implementation.DiagnosticContractInner; +import com.microsoft.azure.arm.model.Indexable; +import com.microsoft.azure.arm.model.Creatable; +import com.microsoft.azure.arm.model.Updatable; +import com.microsoft.azure.arm.model.Appliable; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.apimanagement.v2019_01_01.implementation.ApiManagementManager; + +/** + * Type representing DiagnosticContract. + */ +public interface DiagnosticContract extends HasInner, Indexable, Updatable, HasManager { + /** + * @return the alwaysLog value. + */ + AlwaysLog alwaysLog(); + + /** + * @return the backend value. + */ + PipelineDiagnosticSettings backend(); + + /** + * @return the enableHttpCorrelationHeaders value. + */ + Boolean enableHttpCorrelationHeaders(); + + /** + * @return the frontend value. + */ + PipelineDiagnosticSettings frontend(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the loggerId value. + */ + String loggerId(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the sampling value. + */ + SamplingSettings sampling(); + + /** + * @return the type value. + */ + String type(); + + /** + * The entirety of the DiagnosticContract definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithResourceGroupName, DefinitionStages.WithServiceName, DefinitionStages.WithIfMatch, DefinitionStages.WithLoggerId, DefinitionStages.WithCreate { + } + + /** + * Grouping of DiagnosticContract definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a DiagnosticContract definition. + */ + interface Blank extends WithResourceGroupName { + } + + /** + * The stage of the diagnosticcontract definition allowing to specify ResourceGroupName. + */ + interface WithResourceGroupName { + /** + * Specifies resourceGroupName. + * @param resourceGroupName The name of the resource group + * @return the next definition stage + */ + WithServiceName withResourceGroupName(String resourceGroupName); + } + + /** + * The stage of the diagnosticcontract definition allowing to specify ServiceName. + */ + interface WithServiceName { + /** + * Specifies serviceName. + * @param serviceName The name of the API Management service + * @return the next definition stage + */ + WithIfMatch withServiceName(String serviceName); + } + + /** + * The stage of the diagnosticcontract definition allowing to specify IfMatch. + */ + interface WithIfMatch { + /** + * Specifies ifMatch. + * @param ifMatch ETag of the Entity. Not required when creating an entity, but required when updating an entity + * @return the next definition stage + */ + WithLoggerId withIfMatch(String ifMatch); + } + + /** + * The stage of the diagnosticcontract definition allowing to specify LoggerId. + */ + interface WithLoggerId { + /** + * Specifies loggerId. + * @param loggerId Resource Id of a target logger + * @return the next definition stage + */ + WithCreate withLoggerId(String loggerId); + } + + /** + * The stage of the diagnosticcontract definition allowing to specify AlwaysLog. + */ + interface WithAlwaysLog { + /** + * Specifies alwaysLog. + * @param alwaysLog Specifies for what type of messages sampling settings should not apply. Possible values include: 'allErrors' + * @return the next definition stage + */ + WithCreate withAlwaysLog(AlwaysLog alwaysLog); + } + + /** + * The stage of the diagnosticcontract definition allowing to specify Backend. + */ + interface WithBackend { + /** + * Specifies backend. + * @param backend Diagnostic settings for incoming/outgoing HTTP messages to the Backend + * @return the next definition stage + */ + WithCreate withBackend(PipelineDiagnosticSettings backend); + } + + /** + * The stage of the diagnosticcontract definition allowing to specify EnableHttpCorrelationHeaders. + */ + interface WithEnableHttpCorrelationHeaders { + /** + * Specifies enableHttpCorrelationHeaders. + * @param enableHttpCorrelationHeaders Whether to process Correlation Headers coming to Api Management Service. Only applicable to Application Insights diagnostics. Default is true + * @return the next definition stage + */ + WithCreate withEnableHttpCorrelationHeaders(Boolean enableHttpCorrelationHeaders); + } + + /** + * The stage of the diagnosticcontract definition allowing to specify Frontend. + */ + interface WithFrontend { + /** + * Specifies frontend. + * @param frontend Diagnostic settings for incoming/outgoing HTTP messages to the Gateway + * @return the next definition stage + */ + WithCreate withFrontend(PipelineDiagnosticSettings frontend); + } + + /** + * The stage of the diagnosticcontract definition allowing to specify Sampling. + */ + interface WithSampling { + /** + * Specifies sampling. + * @param sampling Sampling settings for Diagnostic + * @return the next definition stage + */ + WithCreate withSampling(SamplingSettings sampling); + } + + /** + * The stage of the definition which contains all the minimum required inputs for + * the resource to be created (via {@link WithCreate#create()}), but also allows + * for any other optional settings to be specified. + */ + interface WithCreate extends Creatable, DefinitionStages.WithAlwaysLog, DefinitionStages.WithBackend, DefinitionStages.WithEnableHttpCorrelationHeaders, DefinitionStages.WithFrontend, DefinitionStages.WithSampling { + } + } + /** + * The template for a DiagnosticContract update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithIfMatch, UpdateStages.WithAlwaysLog, UpdateStages.WithBackend, UpdateStages.WithEnableHttpCorrelationHeaders, UpdateStages.WithFrontend, UpdateStages.WithSampling { + } + + /** + * Grouping of DiagnosticContract update stages. + */ + interface UpdateStages { + /** + * The stage of the diagnosticcontract update allowing to specify IfMatch. + */ + interface WithIfMatch { + /** + * Specifies ifMatch. + * @param ifMatch ETag of the Entity. Not required when creating an entity, but required when updating an entity + * @return the next update stage + */ + Update withIfMatch(String ifMatch); + } + + /** + * The stage of the diagnosticcontract update allowing to specify AlwaysLog. + */ + interface WithAlwaysLog { + /** + * Specifies alwaysLog. + * @param alwaysLog Specifies for what type of messages sampling settings should not apply. Possible values include: 'allErrors' + * @return the next update stage + */ + Update withAlwaysLog(AlwaysLog alwaysLog); + } + + /** + * The stage of the diagnosticcontract update allowing to specify Backend. + */ + interface WithBackend { + /** + * Specifies backend. + * @param backend Diagnostic settings for incoming/outgoing HTTP messages to the Backend + * @return the next update stage + */ + Update withBackend(PipelineDiagnosticSettings backend); + } + + /** + * The stage of the diagnosticcontract update allowing to specify EnableHttpCorrelationHeaders. + */ + interface WithEnableHttpCorrelationHeaders { + /** + * Specifies enableHttpCorrelationHeaders. + * @param enableHttpCorrelationHeaders Whether to process Correlation Headers coming to Api Management Service. Only applicable to Application Insights diagnostics. Default is true + * @return the next update stage + */ + Update withEnableHttpCorrelationHeaders(Boolean enableHttpCorrelationHeaders); + } + + /** + * The stage of the diagnosticcontract update allowing to specify Frontend. + */ + interface WithFrontend { + /** + * Specifies frontend. + * @param frontend Diagnostic settings for incoming/outgoing HTTP messages to the Gateway + * @return the next update stage + */ + Update withFrontend(PipelineDiagnosticSettings frontend); + } + + /** + * The stage of the diagnosticcontract update allowing to specify Sampling. + */ + interface WithSampling { + /** + * Specifies sampling. + * @param sampling Sampling settings for Diagnostic + * @return the next update stage + */ + Update withSampling(SamplingSettings sampling); + } + + } +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/DiagnosticCreateOrUpdateHeaders.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/DiagnosticCreateOrUpdateHeaders.java new file mode 100644 index 0000000000000..fabee563647d6 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/DiagnosticCreateOrUpdateHeaders.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.apimanagement.v2019_01_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for CreateOrUpdate operation. + */ +public class DiagnosticCreateOrUpdateHeaders { + /** + * Current entity state version. Should be treated as opaque and used to + * make conditional HTTP requests. + */ + @JsonProperty(value = "ETag") + private String eTag; + + /** + * Get current entity state version. Should be treated as opaque and used to make conditional HTTP requests. + * + * @return the eTag value + */ + public String eTag() { + return this.eTag; + } + + /** + * Set current entity state version. Should be treated as opaque and used to make conditional HTTP requests. + * + * @param eTag the eTag value to set + * @return the DiagnosticCreateOrUpdateHeaders object itself. + */ + public DiagnosticCreateOrUpdateHeaders withETag(String eTag) { + this.eTag = eTag; + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/DiagnosticGetEntityTagHeaders.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/DiagnosticGetEntityTagHeaders.java new file mode 100644 index 0000000000000..ab5c51f8dff37 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/DiagnosticGetEntityTagHeaders.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.apimanagement.v2019_01_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for GetEntityTag operation. + */ +public class DiagnosticGetEntityTagHeaders { + /** + * Current entity state version. Should be treated as opaque and used to + * make conditional HTTP requests. + */ + @JsonProperty(value = "ETag") + private String eTag; + + /** + * Get current entity state version. Should be treated as opaque and used to make conditional HTTP requests. + * + * @return the eTag value + */ + public String eTag() { + return this.eTag; + } + + /** + * Set current entity state version. Should be treated as opaque and used to make conditional HTTP requests. + * + * @param eTag the eTag value to set + * @return the DiagnosticGetEntityTagHeaders object itself. + */ + public DiagnosticGetEntityTagHeaders withETag(String eTag) { + this.eTag = eTag; + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/DiagnosticGetHeaders.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/DiagnosticGetHeaders.java new file mode 100644 index 0000000000000..6bbeaa3a83f3a --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/DiagnosticGetHeaders.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.apimanagement.v2019_01_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for Get operation. + */ +public class DiagnosticGetHeaders { + /** + * Current entity state version. Should be treated as opaque and used to + * make conditional HTTP requests. + */ + @JsonProperty(value = "ETag") + private String eTag; + + /** + * Get current entity state version. Should be treated as opaque and used to make conditional HTTP requests. + * + * @return the eTag value + */ + public String eTag() { + return this.eTag; + } + + /** + * Set current entity state version. Should be treated as opaque and used to make conditional HTTP requests. + * + * @param eTag the eTag value to set + * @return the DiagnosticGetHeaders object itself. + */ + public DiagnosticGetHeaders withETag(String eTag) { + this.eTag = eTag; + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/Diagnostics.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/Diagnostics.java new file mode 100644 index 0000000000000..7b69a0768ee6a --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/Diagnostics.java @@ -0,0 +1,65 @@ +/** + * 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.apimanagement.v2019_01_01; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import rx.Completable; +import rx.Observable; +import com.microsoft.azure.management.apimanagement.v2019_01_01.implementation.DiagnosticsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing Diagnostics. + */ +public interface Diagnostics extends SupportsCreating, HasInner { + /** + * Lists all diagnostics of the API Management service instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByServiceAsync(final String resourceGroupName, final String serviceName); + + /** + * Gets the entity state (Etag) version of the Diagnostic specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param diagnosticId Diagnostic identifier. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable getEntityTagAsync(String resourceGroupName, String serviceName, String diagnosticId); + + /** + * Gets the details of the Diagnostic specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param diagnosticId Diagnostic identifier. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String resourceGroupName, String serviceName, String diagnosticId); + + /** + * Deletes the specified Diagnostic. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param diagnosticId Diagnostic identifier. Must be unique in the current API Management service instance. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable deleteAsync(String resourceGroupName, String serviceName, String diagnosticId, String ifMatch); + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/EmailTemplateContract.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/EmailTemplateContract.java new file mode 100644 index 0000000000000..897a96eb79de2 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/EmailTemplateContract.java @@ -0,0 +1,273 @@ +/** + * 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.apimanagement.v2019_01_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.apimanagement.v2019_01_01.implementation.EmailTemplateContractInner; +import com.microsoft.azure.arm.model.Indexable; +import com.microsoft.azure.arm.model.Creatable; +import com.microsoft.azure.arm.model.Updatable; +import com.microsoft.azure.arm.model.Appliable; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.apimanagement.v2019_01_01.implementation.ApiManagementManager; +import java.util.List; + +/** + * Type representing EmailTemplateContract. + */ +public interface EmailTemplateContract extends HasInner, Indexable, Updatable, HasManager { + /** + * @return the body value. + */ + String body(); + + /** + * @return the description value. + */ + String description(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the isDefault value. + */ + Boolean isDefault(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the parameters value. + */ + List parameters(); + + /** + * @return the subject value. + */ + String subject(); + + /** + * @return the title value. + */ + String title(); + + /** + * @return the type value. + */ + String type(); + + /** + * The entirety of the EmailTemplateContract definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithResourceGroupName, DefinitionStages.WithServiceName, DefinitionStages.WithIfMatch, DefinitionStages.WithCreate { + } + + /** + * Grouping of EmailTemplateContract definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a EmailTemplateContract definition. + */ + interface Blank extends WithResourceGroupName { + } + + /** + * The stage of the emailtemplatecontract definition allowing to specify ResourceGroupName. + */ + interface WithResourceGroupName { + /** + * Specifies resourceGroupName. + * @param resourceGroupName The name of the resource group + * @return the next definition stage + */ + WithServiceName withResourceGroupName(String resourceGroupName); + } + + /** + * The stage of the emailtemplatecontract definition allowing to specify ServiceName. + */ + interface WithServiceName { + /** + * Specifies serviceName. + * @param serviceName The name of the API Management service + * @return the next definition stage + */ + WithIfMatch withServiceName(String serviceName); + } + + /** + * The stage of the emailtemplatecontract definition allowing to specify IfMatch. + */ + interface WithIfMatch { + /** + * Specifies ifMatch. + * @param ifMatch ETag of the Entity. Not required when creating an entity, but required when updating an entity + * @return the next definition stage + */ + WithCreate withIfMatch(String ifMatch); + } + + /** + * The stage of the emailtemplatecontract definition allowing to specify Body. + */ + interface WithBody { + /** + * Specifies body. + * @param body Email Template Body. This should be a valid XDocument + * @return the next definition stage + */ + WithCreate withBody(String body); + } + + /** + * The stage of the emailtemplatecontract definition allowing to specify Description. + */ + interface WithDescription { + /** + * Specifies description. + * @param description Description of the Email Template + * @return the next definition stage + */ + WithCreate withDescription(String description); + } + + /** + * The stage of the emailtemplatecontract definition allowing to specify Parameters. + */ + interface WithParameters { + /** + * Specifies parameters. + * @param parameters Email Template Parameter values + * @return the next definition stage + */ + WithCreate withParameters(List parameters); + } + + /** + * The stage of the emailtemplatecontract definition allowing to specify Subject. + */ + interface WithSubject { + /** + * Specifies subject. + * @param subject Subject of the Template + * @return the next definition stage + */ + WithCreate withSubject(String subject); + } + + /** + * The stage of the emailtemplatecontract definition allowing to specify Title. + */ + interface WithTitle { + /** + * Specifies title. + * @param title Title of the Template + * @return the next definition stage + */ + WithCreate withTitle(String title); + } + + /** + * The stage of the definition which contains all the minimum required inputs for + * the resource to be created (via {@link WithCreate#create()}), but also allows + * for any other optional settings to be specified. + */ + interface WithCreate extends Creatable, DefinitionStages.WithBody, DefinitionStages.WithDescription, DefinitionStages.WithParameters, DefinitionStages.WithSubject, DefinitionStages.WithTitle { + } + } + /** + * The template for a EmailTemplateContract update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithIfMatch, UpdateStages.WithBody, UpdateStages.WithDescription, UpdateStages.WithParameters, UpdateStages.WithSubject, UpdateStages.WithTitle { + } + + /** + * Grouping of EmailTemplateContract update stages. + */ + interface UpdateStages { + /** + * The stage of the emailtemplatecontract update allowing to specify IfMatch. + */ + interface WithIfMatch { + /** + * Specifies ifMatch. + * @param ifMatch ETag of the Entity. Not required when creating an entity, but required when updating an entity + * @return the next update stage + */ + Update withIfMatch(String ifMatch); + } + + /** + * The stage of the emailtemplatecontract update allowing to specify Body. + */ + interface WithBody { + /** + * Specifies body. + * @param body Email Template Body. This should be a valid XDocument + * @return the next update stage + */ + Update withBody(String body); + } + + /** + * The stage of the emailtemplatecontract update allowing to specify Description. + */ + interface WithDescription { + /** + * Specifies description. + * @param description Description of the Email Template + * @return the next update stage + */ + Update withDescription(String description); + } + + /** + * The stage of the emailtemplatecontract update allowing to specify Parameters. + */ + interface WithParameters { + /** + * Specifies parameters. + * @param parameters Email Template Parameter values + * @return the next update stage + */ + Update withParameters(List parameters); + } + + /** + * The stage of the emailtemplatecontract update allowing to specify Subject. + */ + interface WithSubject { + /** + * Specifies subject. + * @param subject Subject of the Template + * @return the next update stage + */ + Update withSubject(String subject); + } + + /** + * The stage of the emailtemplatecontract update allowing to specify Title. + */ + interface WithTitle { + /** + * Specifies title. + * @param title Title of the Template + * @return the next update stage + */ + Update withTitle(String title); + } + + } +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/EmailTemplateGetEntityTagHeaders.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/EmailTemplateGetEntityTagHeaders.java new file mode 100644 index 0000000000000..09280f16a33b7 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/EmailTemplateGetEntityTagHeaders.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.apimanagement.v2019_01_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for GetEntityTag operation. + */ +public class EmailTemplateGetEntityTagHeaders { + /** + * Current entity state version. Should be treated as opaque and used to + * make conditional HTTP requests. + */ + @JsonProperty(value = "ETag") + private String eTag; + + /** + * Get current entity state version. Should be treated as opaque and used to make conditional HTTP requests. + * + * @return the eTag value + */ + public String eTag() { + return this.eTag; + } + + /** + * Set current entity state version. Should be treated as opaque and used to make conditional HTTP requests. + * + * @param eTag the eTag value to set + * @return the EmailTemplateGetEntityTagHeaders object itself. + */ + public EmailTemplateGetEntityTagHeaders withETag(String eTag) { + this.eTag = eTag; + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/EmailTemplateGetHeaders.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/EmailTemplateGetHeaders.java new file mode 100644 index 0000000000000..5726600805827 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/EmailTemplateGetHeaders.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.apimanagement.v2019_01_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for Get operation. + */ +public class EmailTemplateGetHeaders { + /** + * Current entity state version. Should be treated as opaque and used to + * make conditional HTTP requests. + */ + @JsonProperty(value = "ETag") + private String eTag; + + /** + * Get current entity state version. Should be treated as opaque and used to make conditional HTTP requests. + * + * @return the eTag value + */ + public String eTag() { + return this.eTag; + } + + /** + * Set current entity state version. Should be treated as opaque and used to make conditional HTTP requests. + * + * @param eTag the eTag value to set + * @return the EmailTemplateGetHeaders object itself. + */ + public EmailTemplateGetHeaders withETag(String eTag) { + this.eTag = eTag; + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/EmailTemplateParametersContractProperties.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/EmailTemplateParametersContractProperties.java new file mode 100644 index 0000000000000..6f55966af013a --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/EmailTemplateParametersContractProperties.java @@ -0,0 +1,95 @@ +/** + * 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.apimanagement.v2019_01_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Email Template Parameter contract. + */ +public class EmailTemplateParametersContractProperties { + /** + * Template parameter name. + */ + @JsonProperty(value = "name") + private String name; + + /** + * Template parameter title. + */ + @JsonProperty(value = "title") + private String title; + + /** + * Template parameter description. + */ + @JsonProperty(value = "description") + private String description; + + /** + * Get template parameter name. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set template parameter name. + * + * @param name the name value to set + * @return the EmailTemplateParametersContractProperties object itself. + */ + public EmailTemplateParametersContractProperties withName(String name) { + this.name = name; + return this; + } + + /** + * Get template parameter title. + * + * @return the title value + */ + public String title() { + return this.title; + } + + /** + * Set template parameter title. + * + * @param title the title value to set + * @return the EmailTemplateParametersContractProperties object itself. + */ + public EmailTemplateParametersContractProperties withTitle(String title) { + this.title = title; + return this; + } + + /** + * Get template parameter description. + * + * @return the description value + */ + public String description() { + return this.description; + } + + /** + * Set template parameter description. + * + * @param description the description value to set + * @return the EmailTemplateParametersContractProperties object itself. + */ + public EmailTemplateParametersContractProperties withDescription(String description) { + this.description = description; + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/EmailTemplateUpdateParameters.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/EmailTemplateUpdateParameters.java new file mode 100644 index 0000000000000..5141189e23ee8 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/EmailTemplateUpdateParameters.java @@ -0,0 +1,150 @@ +/** + * 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.apimanagement.v2019_01_01; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; + +/** + * Email Template update Parameters. + */ +@JsonFlatten +public class EmailTemplateUpdateParameters { + /** + * Subject of the Template. + */ + @JsonProperty(value = "properties.subject") + private String subject; + + /** + * Title of the Template. + */ + @JsonProperty(value = "properties.title") + private String title; + + /** + * Description of the Email Template. + */ + @JsonProperty(value = "properties.description") + private String description; + + /** + * Email Template Body. This should be a valid XDocument. + */ + @JsonProperty(value = "properties.body") + private String body; + + /** + * Email Template Parameter values. + */ + @JsonProperty(value = "properties.parameters") + private List parameters; + + /** + * Get subject of the Template. + * + * @return the subject value + */ + public String subject() { + return this.subject; + } + + /** + * Set subject of the Template. + * + * @param subject the subject value to set + * @return the EmailTemplateUpdateParameters object itself. + */ + public EmailTemplateUpdateParameters withSubject(String subject) { + this.subject = subject; + return this; + } + + /** + * Get title of the Template. + * + * @return the title value + */ + public String title() { + return this.title; + } + + /** + * Set title of the Template. + * + * @param title the title value to set + * @return the EmailTemplateUpdateParameters object itself. + */ + public EmailTemplateUpdateParameters withTitle(String title) { + this.title = title; + return this; + } + + /** + * Get description of the Email Template. + * + * @return the description value + */ + public String description() { + return this.description; + } + + /** + * Set description of the Email Template. + * + * @param description the description value to set + * @return the EmailTemplateUpdateParameters object itself. + */ + public EmailTemplateUpdateParameters withDescription(String description) { + this.description = description; + return this; + } + + /** + * Get email Template Body. This should be a valid XDocument. + * + * @return the body value + */ + public String body() { + return this.body; + } + + /** + * Set email Template Body. This should be a valid XDocument. + * + * @param body the body value to set + * @return the EmailTemplateUpdateParameters object itself. + */ + public EmailTemplateUpdateParameters withBody(String body) { + this.body = body; + return this; + } + + /** + * Get email Template Parameter values. + * + * @return the parameters value + */ + public List parameters() { + return this.parameters; + } + + /** + * Set email Template Parameter values. + * + * @param parameters the parameters value to set + * @return the EmailTemplateUpdateParameters object itself. + */ + public EmailTemplateUpdateParameters withParameters(List parameters) { + this.parameters = parameters; + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/EmailTemplates.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/EmailTemplates.java new file mode 100644 index 0000000000000..779b25bb6c35b --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/EmailTemplates.java @@ -0,0 +1,65 @@ +/** + * 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.apimanagement.v2019_01_01; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import rx.Completable; +import rx.Observable; +import com.microsoft.azure.management.apimanagement.v2019_01_01.implementation.EmailTemplatesInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing EmailTemplates. + */ +public interface EmailTemplates extends SupportsCreating, HasInner { + /** + * Lists a collection of properties defined within a service instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByServiceAsync(final String resourceGroupName, final String serviceName); + + /** + * Gets the entity state (Etag) version of the email template specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param templateName Email Template Name Identifier. Possible values include: 'applicationApprovedNotificationMessage', 'accountClosedDeveloper', 'quotaLimitApproachingDeveloperNotificationMessage', 'newDeveloperNotificationMessage', 'emailChangeIdentityDefault', 'inviteUserNotificationMessage', 'newCommentNotificationMessage', 'confirmSignUpIdentityDefault', 'newIssueNotificationMessage', 'purchaseDeveloperNotificationMessage', 'passwordResetIdentityDefault', 'passwordResetByAdminNotificationMessage', 'rejectDeveloperNotificationMessage', 'requestDeveloperNotificationMessage' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable getEntityTagAsync(String resourceGroupName, String serviceName, TemplateName templateName); + + /** + * Gets the details of the email template specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param templateName Email Template Name Identifier. Possible values include: 'applicationApprovedNotificationMessage', 'accountClosedDeveloper', 'quotaLimitApproachingDeveloperNotificationMessage', 'newDeveloperNotificationMessage', 'emailChangeIdentityDefault', 'inviteUserNotificationMessage', 'newCommentNotificationMessage', 'confirmSignUpIdentityDefault', 'newIssueNotificationMessage', 'purchaseDeveloperNotificationMessage', 'passwordResetIdentityDefault', 'passwordResetByAdminNotificationMessage', 'rejectDeveloperNotificationMessage', 'requestDeveloperNotificationMessage' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String resourceGroupName, String serviceName, TemplateName templateName); + + /** + * Reset the Email Template to default template provided by the API Management service instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param templateName Email Template Name Identifier. Possible values include: 'applicationApprovedNotificationMessage', 'accountClosedDeveloper', 'quotaLimitApproachingDeveloperNotificationMessage', 'newDeveloperNotificationMessage', 'emailChangeIdentityDefault', 'inviteUserNotificationMessage', 'newCommentNotificationMessage', 'confirmSignUpIdentityDefault', 'newIssueNotificationMessage', 'purchaseDeveloperNotificationMessage', 'passwordResetIdentityDefault', 'passwordResetByAdminNotificationMessage', 'rejectDeveloperNotificationMessage', 'requestDeveloperNotificationMessage' + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable deleteAsync(String resourceGroupName, String serviceName, TemplateName templateName, String ifMatch); + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ErrorFieldContract.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ErrorFieldContract.java new file mode 100644 index 0000000000000..8f9687cba273e --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ErrorFieldContract.java @@ -0,0 +1,95 @@ +/** + * 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.apimanagement.v2019_01_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Error Field contract. + */ +public class ErrorFieldContract { + /** + * Property level error code. + */ + @JsonProperty(value = "code") + private String code; + + /** + * Human-readable representation of property-level error. + */ + @JsonProperty(value = "message") + private String message; + + /** + * Property name. + */ + @JsonProperty(value = "target") + private String target; + + /** + * Get property level error code. + * + * @return the code value + */ + public String code() { + return this.code; + } + + /** + * Set property level error code. + * + * @param code the code value to set + * @return the ErrorFieldContract object itself. + */ + public ErrorFieldContract withCode(String code) { + this.code = code; + return this; + } + + /** + * Get human-readable representation of property-level error. + * + * @return the message value + */ + public String message() { + return this.message; + } + + /** + * Set human-readable representation of property-level error. + * + * @param message the message value to set + * @return the ErrorFieldContract object itself. + */ + public ErrorFieldContract withMessage(String message) { + this.message = message; + return this; + } + + /** + * Get property name. + * + * @return the target value + */ + public String target() { + return this.target; + } + + /** + * Set property name. + * + * @param target the target value to set + * @return the ErrorFieldContract object itself. + */ + public ErrorFieldContract withTarget(String target) { + this.target = target; + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ErrorResponse.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ErrorResponse.java new file mode 100644 index 0000000000000..0b13c692bb744 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ErrorResponse.java @@ -0,0 +1,99 @@ +/** + * 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.apimanagement.v2019_01_01; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; + +/** + * Error Response. + */ +@JsonFlatten +public class ErrorResponse { + /** + * Service-defined error code. This code serves as a sub-status for the + * HTTP error code specified in the response. + */ + @JsonProperty(value = "error.code") + private String code; + + /** + * Human-readable representation of the error. + */ + @JsonProperty(value = "error.message") + private String message; + + /** + * The list of invalid fields send in request, in case of validation error. + */ + @JsonProperty(value = "error.details") + private List details; + + /** + * Get service-defined error code. This code serves as a sub-status for the HTTP error code specified in the response. + * + * @return the code value + */ + public String code() { + return this.code; + } + + /** + * Set service-defined error code. This code serves as a sub-status for the HTTP error code specified in the response. + * + * @param code the code value to set + * @return the ErrorResponse object itself. + */ + public ErrorResponse withCode(String code) { + this.code = code; + return this; + } + + /** + * Get human-readable representation of the error. + * + * @return the message value + */ + public String message() { + return this.message; + } + + /** + * Set human-readable representation of the error. + * + * @param message the message value to set + * @return the ErrorResponse object itself. + */ + public ErrorResponse withMessage(String message) { + this.message = message; + return this; + } + + /** + * Get the list of invalid fields send in request, in case of validation error. + * + * @return the details value + */ + public List details() { + return this.details; + } + + /** + * Set the list of invalid fields send in request, in case of validation error. + * + * @param details the details value to set + * @return the ErrorResponse object itself. + */ + public ErrorResponse withDetails(List details) { + this.details = details; + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ErrorResponseBody.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ErrorResponseBody.java new file mode 100644 index 0000000000000..b6fb832b9ccb9 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ErrorResponseBody.java @@ -0,0 +1,97 @@ +/** + * 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.apimanagement.v2019_01_01; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Error Body contract. + */ +public class ErrorResponseBody { + /** + * Service-defined error code. This code serves as a sub-status for the + * HTTP error code specified in the response. + */ + @JsonProperty(value = "code") + private String code; + + /** + * Human-readable representation of the error. + */ + @JsonProperty(value = "message") + private String message; + + /** + * The list of invalid fields send in request, in case of validation error. + */ + @JsonProperty(value = "details") + private List details; + + /** + * Get service-defined error code. This code serves as a sub-status for the HTTP error code specified in the response. + * + * @return the code value + */ + public String code() { + return this.code; + } + + /** + * Set service-defined error code. This code serves as a sub-status for the HTTP error code specified in the response. + * + * @param code the code value to set + * @return the ErrorResponseBody object itself. + */ + public ErrorResponseBody withCode(String code) { + this.code = code; + return this; + } + + /** + * Get human-readable representation of the error. + * + * @return the message value + */ + public String message() { + return this.message; + } + + /** + * Set human-readable representation of the error. + * + * @param message the message value to set + * @return the ErrorResponseBody object itself. + */ + public ErrorResponseBody withMessage(String message) { + this.message = message; + return this; + } + + /** + * Get the list of invalid fields send in request, in case of validation error. + * + * @return the details value + */ + public List details() { + return this.details; + } + + /** + * Set the list of invalid fields send in request, in case of validation error. + * + * @param details the details value to set + * @return the ErrorResponseBody object itself. + */ + public ErrorResponseBody withDetails(List details) { + this.details = details; + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ErrorResponseException.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ErrorResponseException.java new file mode 100644 index 0000000000000..714a550ba404f --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ErrorResponseException.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.apimanagement.v2019_01_01; + +import com.microsoft.rest.RestException; +import okhttp3.ResponseBody; +import retrofit2.Response; + +/** + * Exception thrown for an invalid response with ErrorResponse information. + */ +public class ErrorResponseException extends RestException { + /** + * Initializes a new instance of the ErrorResponseException class. + * + * @param message the exception message or the response content if a message is not available + * @param response the HTTP response + */ + public ErrorResponseException(final String message, final Response response) { + super(message, response); + } + + /** + * Initializes a new instance of the ErrorResponseException 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 ErrorResponseException(final String message, final Response response, final ErrorResponse body) { + super(message, response, body); + } + + @Override + public ErrorResponse body() { + return (ErrorResponse) super.body(); + } +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ExportFormat.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ExportFormat.java new file mode 100644 index 0000000000000..4d5c39c3caa16 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ExportFormat.java @@ -0,0 +1,47 @@ +/** + * 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.apimanagement.v2019_01_01; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for ExportFormat. + */ +public final class ExportFormat extends ExpandableStringEnum { + /** Static value swagger-link for ExportFormat. */ + public static final ExportFormat SWAGGER = fromString("swagger-link"); + + /** Static value wsdl-link for ExportFormat. */ + public static final ExportFormat WSDL = fromString("wsdl-link"); + + /** Static value wadl-link for ExportFormat. */ + public static final ExportFormat WADL = fromString("wadl-link"); + + /** Static value openapi-link for ExportFormat. */ + public static final ExportFormat OPENAPI = fromString("openapi-link"); + + /** + * Creates or finds a ExportFormat from its string representation. + * @param name a name to look for + * @return the corresponding ExportFormat + */ + @JsonCreator + public static ExportFormat fromString(String name) { + return fromString(name, ExportFormat.class); + } + + /** + * @return known ExportFormat values + */ + public static Collection values() { + return values(ExportFormat.class); + } +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ExportResultFormat.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ExportResultFormat.java new file mode 100644 index 0000000000000..4643df0b36ee6 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ExportResultFormat.java @@ -0,0 +1,47 @@ +/** + * 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.apimanagement.v2019_01_01; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for ExportResultFormat. + */ +public final class ExportResultFormat extends ExpandableStringEnum { + /** Static value swagger-link-json for ExportResultFormat. */ + public static final ExportResultFormat SWAGGER = fromString("swagger-link-json"); + + /** Static value wsdl-link+xml for ExportResultFormat. */ + public static final ExportResultFormat WSDL = fromString("wsdl-link+xml"); + + /** Static value wadl-link-json for ExportResultFormat. */ + public static final ExportResultFormat WADL = fromString("wadl-link-json"); + + /** Static value openapi-link for ExportResultFormat. */ + public static final ExportResultFormat OPEN_API = fromString("openapi-link"); + + /** + * Creates or finds a ExportResultFormat from its string representation. + * @param name a name to look for + * @return the corresponding ExportResultFormat + */ + @JsonCreator + public static ExportResultFormat fromString(String name) { + return fromString(name, ExportResultFormat.class); + } + + /** + * @return known ExportResultFormat values + */ + public static Collection values() { + return values(ExportResultFormat.class); + } +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/GenerateSsoUrlResult.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/GenerateSsoUrlResult.java new file mode 100644 index 0000000000000..a863ba291534a --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/GenerateSsoUrlResult.java @@ -0,0 +1,25 @@ +/** + * 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.apimanagement.v2019_01_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.apimanagement.v2019_01_01.implementation.ApiManagementManager; +import com.microsoft.azure.management.apimanagement.v2019_01_01.implementation.GenerateSsoUrlResultInner; + +/** + * Type representing GenerateSsoUrlResult. + */ +public interface GenerateSsoUrlResult extends HasInner, HasManager { + /** + * @return the value value. + */ + String value(); + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/GrantType.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/GrantType.java new file mode 100644 index 0000000000000..5402f3dca1668 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/GrantType.java @@ -0,0 +1,47 @@ +/** + * 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.apimanagement.v2019_01_01; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for GrantType. + */ +public final class GrantType extends ExpandableStringEnum { + /** Static value authorizationCode for GrantType. */ + public static final GrantType AUTHORIZATION_CODE = fromString("authorizationCode"); + + /** Static value implicit for GrantType. */ + public static final GrantType IMPLICIT = fromString("implicit"); + + /** Static value resourceOwnerPassword for GrantType. */ + public static final GrantType RESOURCE_OWNER_PASSWORD = fromString("resourceOwnerPassword"); + + /** Static value clientCredentials for GrantType. */ + public static final GrantType CLIENT_CREDENTIALS = fromString("clientCredentials"); + + /** + * Creates or finds a GrantType from its string representation. + * @param name a name to look for + * @return the corresponding GrantType + */ + @JsonCreator + public static GrantType fromString(String name) { + return fromString(name, GrantType.class); + } + + /** + * @return known GrantType values + */ + public static Collection values() { + return values(GrantType.class); + } +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/GroupContract.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/GroupContract.java new file mode 100644 index 0000000000000..eff3ed2f68fe8 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/GroupContract.java @@ -0,0 +1,231 @@ +/** + * 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.apimanagement.v2019_01_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.apimanagement.v2019_01_01.implementation.GroupContractInner; +import com.microsoft.azure.arm.model.Indexable; +import com.microsoft.azure.arm.model.Creatable; +import com.microsoft.azure.arm.model.Updatable; +import com.microsoft.azure.arm.model.Appliable; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.apimanagement.v2019_01_01.implementation.ApiManagementManager; + +/** + * Type representing GroupContract. + */ +public interface GroupContract extends HasInner, Indexable, Updatable, HasManager { + /** + * @return the builtIn value. + */ + Boolean builtIn(); + + /** + * @return the description value. + */ + String description(); + + /** + * @return the displayName value. + */ + String displayName(); + + /** + * @return the externalId value. + */ + String externalId(); + + /** + * @return the groupContractType value. + */ + GroupType groupContractType(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the type value. + */ + String type(); + + /** + * The entirety of the GroupContract definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithResourceGroupName, DefinitionStages.WithServiceName, DefinitionStages.WithIfMatch, DefinitionStages.WithDisplayName, DefinitionStages.WithCreate { + } + + /** + * Grouping of GroupContract definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a GroupContract definition. + */ + interface Blank extends WithResourceGroupName { + } + + /** + * The stage of the groupcontract definition allowing to specify ResourceGroupName. + */ + interface WithResourceGroupName { + /** + * Specifies resourceGroupName. + * @param resourceGroupName The name of the resource group + * @return the next definition stage + */ + WithServiceName withResourceGroupName(String resourceGroupName); + } + + /** + * The stage of the groupcontract definition allowing to specify ServiceName. + */ + interface WithServiceName { + /** + * Specifies serviceName. + * @param serviceName The name of the API Management service + * @return the next definition stage + */ + WithIfMatch withServiceName(String serviceName); + } + + /** + * The stage of the groupcontract definition allowing to specify IfMatch. + */ + interface WithIfMatch { + /** + * Specifies ifMatch. + * @param ifMatch ETag of the Entity. Not required when creating an entity, but required when updating an entity + * @return the next definition stage + */ + WithDisplayName withIfMatch(String ifMatch); + } + + /** + * The stage of the groupcontract definition allowing to specify DisplayName. + */ + interface WithDisplayName { + /** + * Specifies displayName. + * @param displayName Group name + * @return the next definition stage + */ + WithCreate withDisplayName(String displayName); + } + + /** + * The stage of the groupcontract definition allowing to specify Description. + */ + interface WithDescription { + /** + * Specifies description. + * @param description Group description + * @return the next definition stage + */ + WithCreate withDescription(String description); + } + + /** + * The stage of the groupcontract definition allowing to specify ExternalId. + */ + interface WithExternalId { + /** + * Specifies externalId. + * @param externalId Identifier of the external groups, this property contains the id of the group from the external identity provider, e.g. for Azure Active Directory `aad://<tenant>.onmicrosoft.com/groups/<group object id>`; otherwise the value is null + * @return the next definition stage + */ + WithCreate withExternalId(String externalId); + } + + /** + * The stage of the groupcontract definition allowing to specify Type. + */ + interface WithType { + /** + * Specifies type. + * @param type Group type. Possible values include: 'custom', 'system', 'external' + * @return the next definition stage + */ + WithCreate withType(GroupType type); + } + + /** + * The stage of the definition which contains all the minimum required inputs for + * the resource to be created (via {@link WithCreate#create()}), but also allows + * for any other optional settings to be specified. + */ + interface WithCreate extends Creatable, DefinitionStages.WithDescription, DefinitionStages.WithExternalId, DefinitionStages.WithType { + } + } + /** + * The template for a GroupContract update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithIfMatch, UpdateStages.WithDescription, UpdateStages.WithExternalId, UpdateStages.WithType { + } + + /** + * Grouping of GroupContract update stages. + */ + interface UpdateStages { + /** + * The stage of the groupcontract update allowing to specify IfMatch. + */ + interface WithIfMatch { + /** + * Specifies ifMatch. + * @param ifMatch ETag of the Entity. Not required when creating an entity, but required when updating an entity + * @return the next update stage + */ + Update withIfMatch(String ifMatch); + } + + /** + * The stage of the groupcontract update allowing to specify Description. + */ + interface WithDescription { + /** + * Specifies description. + * @param description Group description + * @return the next update stage + */ + Update withDescription(String description); + } + + /** + * The stage of the groupcontract update allowing to specify ExternalId. + */ + interface WithExternalId { + /** + * Specifies externalId. + * @param externalId Identifier of the external groups, this property contains the id of the group from the external identity provider, e.g. for Azure Active Directory `aad://<tenant>.onmicrosoft.com/groups/<group object id>`; otherwise the value is null + * @return the next update stage + */ + Update withExternalId(String externalId); + } + + /** + * The stage of the groupcontract update allowing to specify Type. + */ + interface WithType { + /** + * Specifies type. + * @param type Group type. Possible values include: 'custom', 'system', 'external' + * @return the next update stage + */ + Update withType(GroupType type); + } + + } +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/GroupContractProperties.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/GroupContractProperties.java new file mode 100644 index 0000000000000..e1c3a054c5051 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/GroupContractProperties.java @@ -0,0 +1,140 @@ +/** + * 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.apimanagement.v2019_01_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Group contract Properties. + */ +public class GroupContractProperties { + /** + * Group name. + */ + @JsonProperty(value = "displayName", required = true) + private String displayName; + + /** + * Group description. Can contain HTML formatting tags. + */ + @JsonProperty(value = "description") + private String description; + + /** + * true if the group is one of the three system groups (Administrators, + * Developers, or Guests); otherwise false. + */ + @JsonProperty(value = "builtIn", access = JsonProperty.Access.WRITE_ONLY) + private Boolean builtIn; + + /** + * Group type. Possible values include: 'custom', 'system', 'external'. + */ + @JsonProperty(value = "type") + private GroupType type; + + /** + * For external groups, this property contains the id of the group from the + * external identity provider, e.g. for Azure Active Directory + * `aad://<tenant>.onmicrosoft.com/groups/<group object id>`; + * otherwise the value is null. + */ + @JsonProperty(value = "externalId") + private String externalId; + + /** + * Get group name. + * + * @return the displayName value + */ + public String displayName() { + return this.displayName; + } + + /** + * Set group name. + * + * @param displayName the displayName value to set + * @return the GroupContractProperties object itself. + */ + public GroupContractProperties withDisplayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Get group description. Can contain HTML formatting tags. + * + * @return the description value + */ + public String description() { + return this.description; + } + + /** + * Set group description. Can contain HTML formatting tags. + * + * @param description the description value to set + * @return the GroupContractProperties object itself. + */ + public GroupContractProperties withDescription(String description) { + this.description = description; + return this; + } + + /** + * Get true if the group is one of the three system groups (Administrators, Developers, or Guests); otherwise false. + * + * @return the builtIn value + */ + public Boolean builtIn() { + return this.builtIn; + } + + /** + * Get group type. Possible values include: 'custom', 'system', 'external'. + * + * @return the type value + */ + public GroupType type() { + return this.type; + } + + /** + * Set group type. Possible values include: 'custom', 'system', 'external'. + * + * @param type the type value to set + * @return the GroupContractProperties object itself. + */ + public GroupContractProperties withType(GroupType type) { + this.type = type; + return this; + } + + /** + * Get for external groups, this property contains the id of the group from the external identity provider, e.g. for Azure Active Directory `aad://<tenant>.onmicrosoft.com/groups/<group object id>`; otherwise the value is null. + * + * @return the externalId value + */ + public String externalId() { + return this.externalId; + } + + /** + * Set for external groups, this property contains the id of the group from the external identity provider, e.g. for Azure Active Directory `aad://<tenant>.onmicrosoft.com/groups/<group object id>`; otherwise the value is null. + * + * @param externalId the externalId value to set + * @return the GroupContractProperties object itself. + */ + public GroupContractProperties withExternalId(String externalId) { + this.externalId = externalId; + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/GroupCreateOrUpdateHeaders.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/GroupCreateOrUpdateHeaders.java new file mode 100644 index 0000000000000..195acc1d5bc52 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/GroupCreateOrUpdateHeaders.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.apimanagement.v2019_01_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for CreateOrUpdate operation. + */ +public class GroupCreateOrUpdateHeaders { + /** + * Current entity state version. Should be treated as opaque and used to + * make conditional HTTP requests. + */ + @JsonProperty(value = "ETag") + private String eTag; + + /** + * Get current entity state version. Should be treated as opaque and used to make conditional HTTP requests. + * + * @return the eTag value + */ + public String eTag() { + return this.eTag; + } + + /** + * Set current entity state version. Should be treated as opaque and used to make conditional HTTP requests. + * + * @param eTag the eTag value to set + * @return the GroupCreateOrUpdateHeaders object itself. + */ + public GroupCreateOrUpdateHeaders withETag(String eTag) { + this.eTag = eTag; + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/GroupCreateParameters.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/GroupCreateParameters.java new file mode 100644 index 0000000000000..549a26932f5ba --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/GroupCreateParameters.java @@ -0,0 +1,126 @@ +/** + * 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.apimanagement.v2019_01_01; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; + +/** + * Parameters supplied to the Create Group operation. + */ +@JsonFlatten +public class GroupCreateParameters { + /** + * Group name. + */ + @JsonProperty(value = "properties.displayName", required = true) + private String displayName; + + /** + * Group description. + */ + @JsonProperty(value = "properties.description") + private String description; + + /** + * Group type. Possible values include: 'custom', 'system', 'external'. + */ + @JsonProperty(value = "properties.type") + private GroupType type; + + /** + * Identifier of the external groups, this property contains the id of the + * group from the external identity provider, e.g. for Azure Active + * Directory `aad://<tenant>.onmicrosoft.com/groups/<group object + * id>`; otherwise the value is null. + */ + @JsonProperty(value = "properties.externalId") + private String externalId; + + /** + * Get group name. + * + * @return the displayName value + */ + public String displayName() { + return this.displayName; + } + + /** + * Set group name. + * + * @param displayName the displayName value to set + * @return the GroupCreateParameters object itself. + */ + public GroupCreateParameters withDisplayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Get group description. + * + * @return the description value + */ + public String description() { + return this.description; + } + + /** + * Set group description. + * + * @param description the description value to set + * @return the GroupCreateParameters object itself. + */ + public GroupCreateParameters withDescription(String description) { + this.description = description; + return this; + } + + /** + * Get group type. Possible values include: 'custom', 'system', 'external'. + * + * @return the type value + */ + public GroupType type() { + return this.type; + } + + /** + * Set group type. Possible values include: 'custom', 'system', 'external'. + * + * @param type the type value to set + * @return the GroupCreateParameters object itself. + */ + public GroupCreateParameters withType(GroupType type) { + this.type = type; + return this; + } + + /** + * Get identifier of the external groups, this property contains the id of the group from the external identity provider, e.g. for Azure Active Directory `aad://<tenant>.onmicrosoft.com/groups/<group object id>`; otherwise the value is null. + * + * @return the externalId value + */ + public String externalId() { + return this.externalId; + } + + /** + * Set identifier of the external groups, this property contains the id of the group from the external identity provider, e.g. for Azure Active Directory `aad://<tenant>.onmicrosoft.com/groups/<group object id>`; otherwise the value is null. + * + * @param externalId the externalId value to set + * @return the GroupCreateParameters object itself. + */ + public GroupCreateParameters withExternalId(String externalId) { + this.externalId = externalId; + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/GroupGetEntityTagHeaders.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/GroupGetEntityTagHeaders.java new file mode 100644 index 0000000000000..14dfebc09df93 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/GroupGetEntityTagHeaders.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.apimanagement.v2019_01_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for GetEntityTag operation. + */ +public class GroupGetEntityTagHeaders { + /** + * Current entity state version. Should be treated as opaque and used to + * make conditional HTTP requests. + */ + @JsonProperty(value = "ETag") + private String eTag; + + /** + * Get current entity state version. Should be treated as opaque and used to make conditional HTTP requests. + * + * @return the eTag value + */ + public String eTag() { + return this.eTag; + } + + /** + * Set current entity state version. Should be treated as opaque and used to make conditional HTTP requests. + * + * @param eTag the eTag value to set + * @return the GroupGetEntityTagHeaders object itself. + */ + public GroupGetEntityTagHeaders withETag(String eTag) { + this.eTag = eTag; + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/GroupGetHeaders.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/GroupGetHeaders.java new file mode 100644 index 0000000000000..00025a2b3969e --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/GroupGetHeaders.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.apimanagement.v2019_01_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for Get operation. + */ +public class GroupGetHeaders { + /** + * Current entity state version. Should be treated as opaque and used to + * make conditional HTTP requests. + */ + @JsonProperty(value = "ETag") + private String eTag; + + /** + * Get current entity state version. Should be treated as opaque and used to make conditional HTTP requests. + * + * @return the eTag value + */ + public String eTag() { + return this.eTag; + } + + /** + * Set current entity state version. Should be treated as opaque and used to make conditional HTTP requests. + * + * @param eTag the eTag value to set + * @return the GroupGetHeaders object itself. + */ + public GroupGetHeaders withETag(String eTag) { + this.eTag = eTag; + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/GroupType.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/GroupType.java new file mode 100644 index 0000000000000..d8727f228045a --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/GroupType.java @@ -0,0 +1,56 @@ +/** + * 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.apimanagement.v2019_01_01; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for GroupType. + */ +public enum GroupType { + /** Enum value custom. */ + CUSTOM("custom"), + + /** Enum value system. */ + SYSTEM("system"), + + /** Enum value external. */ + EXTERNAL("external"); + + /** The actual serialized value for a GroupType instance. */ + private String value; + + GroupType(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a GroupType instance. + * + * @param value the serialized value to parse. + * @return the parsed GroupType object, or null if unable to parse. + */ + @JsonCreator + public static GroupType fromString(String value) { + GroupType[] items = GroupType.values(); + for (GroupType item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/GroupUpdateParameters.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/GroupUpdateParameters.java new file mode 100644 index 0000000000000..a4b8563ead99c --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/GroupUpdateParameters.java @@ -0,0 +1,126 @@ +/** + * 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.apimanagement.v2019_01_01; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; + +/** + * Parameters supplied to the Update Group operation. + */ +@JsonFlatten +public class GroupUpdateParameters { + /** + * Group name. + */ + @JsonProperty(value = "properties.displayName") + private String displayName; + + /** + * Group description. + */ + @JsonProperty(value = "properties.description") + private String description; + + /** + * Group type. Possible values include: 'custom', 'system', 'external'. + */ + @JsonProperty(value = "properties.type") + private GroupType type; + + /** + * Identifier of the external groups, this property contains the id of the + * group from the external identity provider, e.g. for Azure Active + * Directory `aad://<tenant>.onmicrosoft.com/groups/<group object + * id>`; otherwise the value is null. + */ + @JsonProperty(value = "properties.externalId") + private String externalId; + + /** + * Get group name. + * + * @return the displayName value + */ + public String displayName() { + return this.displayName; + } + + /** + * Set group name. + * + * @param displayName the displayName value to set + * @return the GroupUpdateParameters object itself. + */ + public GroupUpdateParameters withDisplayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Get group description. + * + * @return the description value + */ + public String description() { + return this.description; + } + + /** + * Set group description. + * + * @param description the description value to set + * @return the GroupUpdateParameters object itself. + */ + public GroupUpdateParameters withDescription(String description) { + this.description = description; + return this; + } + + /** + * Get group type. Possible values include: 'custom', 'system', 'external'. + * + * @return the type value + */ + public GroupType type() { + return this.type; + } + + /** + * Set group type. Possible values include: 'custom', 'system', 'external'. + * + * @param type the type value to set + * @return the GroupUpdateParameters object itself. + */ + public GroupUpdateParameters withType(GroupType type) { + this.type = type; + return this; + } + + /** + * Get identifier of the external groups, this property contains the id of the group from the external identity provider, e.g. for Azure Active Directory `aad://<tenant>.onmicrosoft.com/groups/<group object id>`; otherwise the value is null. + * + * @return the externalId value + */ + public String externalId() { + return this.externalId; + } + + /** + * Set identifier of the external groups, this property contains the id of the group from the external identity provider, e.g. for Azure Active Directory `aad://<tenant>.onmicrosoft.com/groups/<group object id>`; otherwise the value is null. + * + * @param externalId the externalId value to set + * @return the GroupUpdateParameters object itself. + */ + public GroupUpdateParameters withExternalId(String externalId) { + this.externalId = externalId; + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/GroupUserContract.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/GroupUserContract.java new file mode 100644 index 0000000000000..f0fe3c815cc70 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/GroupUserContract.java @@ -0,0 +1,130 @@ +/** + * 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.apimanagement.v2019_01_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.apimanagement.v2019_01_01.implementation.UserContractInner; +import com.microsoft.azure.arm.model.Indexable; +import com.microsoft.azure.arm.model.Updatable; +import com.microsoft.azure.arm.model.Appliable; +import com.microsoft.azure.arm.model.Creatable; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.apimanagement.v2019_01_01.implementation.ApiManagementManager; +import java.util.List; +import org.joda.time.DateTime; + +/** + * Type representing GroupUserContract. + */ +public interface GroupUserContract extends HasInner, Indexable, Updatable, HasManager { + /** + * @return the email value. + */ + String email(); + + /** + * @return the firstName value. + */ + String firstName(); + + /** + * @return the groups value. + */ + List groups(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the identities value. + */ + List identities(); + + /** + * @return the lastName value. + */ + String lastName(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the note value. + */ + String note(); + + /** + * @return the registrationDate value. + */ + DateTime registrationDate(); + + /** + * @return the state value. + */ + UserState state(); + + /** + * @return the type value. + */ + String type(); + + /** + * The entirety of the GroupUserContract definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithGroup, DefinitionStages.WithCreate { + } + + /** + * Grouping of GroupUserContract definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a GroupUserContract definition. + */ + interface Blank extends WithGroup { + } + + /** + * The stage of the groupusercontract definition allowing to specify Group. + */ + interface WithGroup { + /** + * Specifies resourceGroupName, serviceName, groupId. + * @param resourceGroupName The name of the resource group + * @param serviceName The name of the API Management service + * @param groupId Group identifier. Must be unique in the current API Management service instance + * @return the next definition stage + */ + WithCreate withExistingGroup(String resourceGroupName, String serviceName, String groupId); + } + + /** + * The stage of the definition which contains all the minimum required inputs for + * the resource to be created (via {@link WithCreate#create()}), but also allows + * for any other optional settings to be specified. + */ + interface WithCreate extends Creatable { + } + } + /** + * The template for a GroupUserContract update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable { + } + + /** + * Grouping of GroupUserContract update stages. + */ + interface UpdateStages { + } +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/GroupUsers.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/GroupUsers.java new file mode 100644 index 0000000000000..b6b786dbb3c92 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/GroupUsers.java @@ -0,0 +1,56 @@ +/** + * 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.apimanagement.v2019_01_01; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import rx.Completable; +import rx.Observable; +import com.microsoft.azure.management.apimanagement.v2019_01_01.implementation.GroupUsersInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing GroupUsers. + */ +public interface GroupUsers extends SupportsCreating, HasInner { + /** + * Checks that user entity specified by identifier is associated with the group entity. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param groupId Group identifier. Must be unique in the current API Management service instance. + * @param userId User identifier. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable checkEntityExistsAsync(String resourceGroupName, String serviceName, String groupId, String userId); + + /** + * Lists a collection of user entities associated with the group. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param groupId Group identifier. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listAsync(final String resourceGroupName, final String serviceName, final String groupId); + + /** + * Remove existing user from existing group. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param groupId Group identifier. Must be unique in the current API Management service instance. + * @param userId User identifier. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable deleteAsync(String resourceGroupName, String serviceName, String groupId, String userId); + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/Groups.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/Groups.java new file mode 100644 index 0000000000000..2711ece375ba1 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/Groups.java @@ -0,0 +1,65 @@ +/** + * 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.apimanagement.v2019_01_01; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import rx.Completable; +import rx.Observable; +import com.microsoft.azure.management.apimanagement.v2019_01_01.implementation.GroupsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing Groups. + */ +public interface Groups extends SupportsCreating, HasInner { + /** + * Lists a collection of groups defined within a service instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByServiceAsync(final String resourceGroupName, final String serviceName); + + /** + * Gets the entity state (Etag) version of the group specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param groupId Group identifier. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable getEntityTagAsync(String resourceGroupName, String serviceName, String groupId); + + /** + * Gets the details of the group specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param groupId Group identifier. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String resourceGroupName, String serviceName, String groupId); + + /** + * Deletes specific group of the API Management service instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param groupId Group identifier. Must be unique in the current API Management service instance. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable deleteAsync(String resourceGroupName, String serviceName, String groupId, String ifMatch); + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/HostnameConfiguration.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/HostnameConfiguration.java new file mode 100644 index 0000000000000..1a46ec2035469 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/HostnameConfiguration.java @@ -0,0 +1,235 @@ +/** + * 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.apimanagement.v2019_01_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Custom hostname configuration. + */ +public class HostnameConfiguration { + /** + * Hostname type. Possible values include: 'Proxy', 'Portal', 'Management', + * 'Scm', 'DeveloperPortal'. + */ + @JsonProperty(value = "type", required = true) + private HostnameType type; + + /** + * Hostname to configure on the Api Management service. + */ + @JsonProperty(value = "hostName", required = true) + private String hostName; + + /** + * Url to the KeyVault Secret containing the Ssl Certificate. If absolute + * Url containing version is provided, auto-update of ssl certificate will + * not work. This requires Api Management service to be configured with + * MSI. The secret should be of type *application/x-pkcs12*. + */ + @JsonProperty(value = "keyVaultId") + private String keyVaultId; + + /** + * Base64 Encoded certificate. + */ + @JsonProperty(value = "encodedCertificate") + private String encodedCertificate; + + /** + * Certificate Password. + */ + @JsonProperty(value = "certificatePassword") + private String certificatePassword; + + /** + * Specify true to setup the certificate associated with this Hostname as + * the Default SSL Certificate. If a client does not send the SNI header, + * then this will be the certificate that will be challenged. The property + * is useful if a service has multiple custom hostname enabled and it needs + * to decide on the default ssl certificate. The setting only applied to + * Proxy Hostname Type. + */ + @JsonProperty(value = "defaultSslBinding") + private Boolean defaultSslBinding; + + /** + * Specify true to always negotiate client certificate on the hostname. + * Default Value is false. + */ + @JsonProperty(value = "negotiateClientCertificate") + private Boolean negotiateClientCertificate; + + /** + * Certificate information. + */ + @JsonProperty(value = "certificate") + private CertificateInformation certificate; + + /** + * Get hostname type. Possible values include: 'Proxy', 'Portal', 'Management', 'Scm', 'DeveloperPortal'. + * + * @return the type value + */ + public HostnameType type() { + return this.type; + } + + /** + * Set hostname type. Possible values include: 'Proxy', 'Portal', 'Management', 'Scm', 'DeveloperPortal'. + * + * @param type the type value to set + * @return the HostnameConfiguration object itself. + */ + public HostnameConfiguration withType(HostnameType type) { + this.type = type; + return this; + } + + /** + * Get hostname to configure on the Api Management service. + * + * @return the hostName value + */ + public String hostName() { + return this.hostName; + } + + /** + * Set hostname to configure on the Api Management service. + * + * @param hostName the hostName value to set + * @return the HostnameConfiguration object itself. + */ + public HostnameConfiguration withHostName(String hostName) { + this.hostName = hostName; + return this; + } + + /** + * Get url to the KeyVault Secret containing the Ssl Certificate. If absolute Url containing version is provided, auto-update of ssl certificate will not work. This requires Api Management service to be configured with MSI. The secret should be of type *application/x-pkcs12*. + * + * @return the keyVaultId value + */ + public String keyVaultId() { + return this.keyVaultId; + } + + /** + * Set url to the KeyVault Secret containing the Ssl Certificate. If absolute Url containing version is provided, auto-update of ssl certificate will not work. This requires Api Management service to be configured with MSI. The secret should be of type *application/x-pkcs12*. + * + * @param keyVaultId the keyVaultId value to set + * @return the HostnameConfiguration object itself. + */ + public HostnameConfiguration withKeyVaultId(String keyVaultId) { + this.keyVaultId = keyVaultId; + return this; + } + + /** + * Get base64 Encoded certificate. + * + * @return the encodedCertificate value + */ + public String encodedCertificate() { + return this.encodedCertificate; + } + + /** + * Set base64 Encoded certificate. + * + * @param encodedCertificate the encodedCertificate value to set + * @return the HostnameConfiguration object itself. + */ + public HostnameConfiguration withEncodedCertificate(String encodedCertificate) { + this.encodedCertificate = encodedCertificate; + return this; + } + + /** + * Get certificate Password. + * + * @return the certificatePassword value + */ + public String certificatePassword() { + return this.certificatePassword; + } + + /** + * Set certificate Password. + * + * @param certificatePassword the certificatePassword value to set + * @return the HostnameConfiguration object itself. + */ + public HostnameConfiguration withCertificatePassword(String certificatePassword) { + this.certificatePassword = certificatePassword; + return this; + } + + /** + * Get specify true to setup the certificate associated with this Hostname as the Default SSL Certificate. If a client does not send the SNI header, then this will be the certificate that will be challenged. The property is useful if a service has multiple custom hostname enabled and it needs to decide on the default ssl certificate. The setting only applied to Proxy Hostname Type. + * + * @return the defaultSslBinding value + */ + public Boolean defaultSslBinding() { + return this.defaultSslBinding; + } + + /** + * Set specify true to setup the certificate associated with this Hostname as the Default SSL Certificate. If a client does not send the SNI header, then this will be the certificate that will be challenged. The property is useful if a service has multiple custom hostname enabled and it needs to decide on the default ssl certificate. The setting only applied to Proxy Hostname Type. + * + * @param defaultSslBinding the defaultSslBinding value to set + * @return the HostnameConfiguration object itself. + */ + public HostnameConfiguration withDefaultSslBinding(Boolean defaultSslBinding) { + this.defaultSslBinding = defaultSslBinding; + return this; + } + + /** + * Get specify true to always negotiate client certificate on the hostname. Default Value is false. + * + * @return the negotiateClientCertificate value + */ + public Boolean negotiateClientCertificate() { + return this.negotiateClientCertificate; + } + + /** + * Set specify true to always negotiate client certificate on the hostname. Default Value is false. + * + * @param negotiateClientCertificate the negotiateClientCertificate value to set + * @return the HostnameConfiguration object itself. + */ + public HostnameConfiguration withNegotiateClientCertificate(Boolean negotiateClientCertificate) { + this.negotiateClientCertificate = negotiateClientCertificate; + return this; + } + + /** + * Get certificate information. + * + * @return the certificate value + */ + public CertificateInformation certificate() { + return this.certificate; + } + + /** + * Set certificate information. + * + * @param certificate the certificate value to set + * @return the HostnameConfiguration object itself. + */ + public HostnameConfiguration withCertificate(CertificateInformation certificate) { + this.certificate = certificate; + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/HostnameType.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/HostnameType.java new file mode 100644 index 0000000000000..36cbe71046d40 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/HostnameType.java @@ -0,0 +1,50 @@ +/** + * 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.apimanagement.v2019_01_01; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for HostnameType. + */ +public final class HostnameType extends ExpandableStringEnum { + /** Static value Proxy for HostnameType. */ + public static final HostnameType PROXY = fromString("Proxy"); + + /** Static value Portal for HostnameType. */ + public static final HostnameType PORTAL = fromString("Portal"); + + /** Static value Management for HostnameType. */ + public static final HostnameType MANAGEMENT = fromString("Management"); + + /** Static value Scm for HostnameType. */ + public static final HostnameType SCM = fromString("Scm"); + + /** Static value DeveloperPortal for HostnameType. */ + public static final HostnameType DEVELOPER_PORTAL = fromString("DeveloperPortal"); + + /** + * Creates or finds a HostnameType from its string representation. + * @param name a name to look for + * @return the corresponding HostnameType + */ + @JsonCreator + public static HostnameType fromString(String name) { + return fromString(name, HostnameType.class); + } + + /** + * @return known HostnameType values + */ + public static Collection values() { + return values(HostnameType.class); + } +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/HttpMessageDiagnostic.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/HttpMessageDiagnostic.java new file mode 100644 index 0000000000000..7747367605af8 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/HttpMessageDiagnostic.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.apimanagement.v2019_01_01; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Http message diagnostic settings. + */ +public class HttpMessageDiagnostic { + /** + * Array of HTTP Headers to log. + */ + @JsonProperty(value = "headers") + private List headers; + + /** + * Body logging settings. + */ + @JsonProperty(value = "body") + private BodyDiagnosticSettings body; + + /** + * Get array of HTTP Headers to log. + * + * @return the headers value + */ + public List headers() { + return this.headers; + } + + /** + * Set array of HTTP Headers to log. + * + * @param headers the headers value to set + * @return the HttpMessageDiagnostic object itself. + */ + public HttpMessageDiagnostic withHeaders(List headers) { + this.headers = headers; + return this; + } + + /** + * Get body logging settings. + * + * @return the body value + */ + public BodyDiagnosticSettings body() { + return this.body; + } + + /** + * Set body logging settings. + * + * @param body the body value to set + * @return the HttpMessageDiagnostic object itself. + */ + public HttpMessageDiagnostic withBody(BodyDiagnosticSettings body) { + this.body = body; + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/IdentityProviderBaseParameters.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/IdentityProviderBaseParameters.java new file mode 100644 index 0000000000000..29068aaedc10f --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/IdentityProviderBaseParameters.java @@ -0,0 +1,201 @@ +/** + * 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.apimanagement.v2019_01_01; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Identity Provider Base Parameter Properties. + */ +public class IdentityProviderBaseParameters { + /** + * Identity Provider Type identifier. Possible values include: 'facebook', + * 'google', 'microsoft', 'twitter', 'aad', 'aadB2C'. + */ + @JsonProperty(value = "type") + private IdentityProviderType type; + + /** + * List of Allowed Tenants when configuring Azure Active Directory login. + */ + @JsonProperty(value = "allowedTenants") + private List allowedTenants; + + /** + * OpenID Connect discovery endpoint hostname for AAD or AAD B2C. + */ + @JsonProperty(value = "authority") + private String authority; + + /** + * Signup Policy Name. Only applies to AAD B2C Identity Provider. + */ + @JsonProperty(value = "signupPolicyName") + private String signupPolicyName; + + /** + * Signin Policy Name. Only applies to AAD B2C Identity Provider. + */ + @JsonProperty(value = "signinPolicyName") + private String signinPolicyName; + + /** + * Profile Editing Policy Name. Only applies to AAD B2C Identity Provider. + */ + @JsonProperty(value = "profileEditingPolicyName") + private String profileEditingPolicyName; + + /** + * Password Reset Policy Name. Only applies to AAD B2C Identity Provider. + */ + @JsonProperty(value = "passwordResetPolicyName") + private String passwordResetPolicyName; + + /** + * Get identity Provider Type identifier. Possible values include: 'facebook', 'google', 'microsoft', 'twitter', 'aad', 'aadB2C'. + * + * @return the type value + */ + public IdentityProviderType type() { + return this.type; + } + + /** + * Set identity Provider Type identifier. Possible values include: 'facebook', 'google', 'microsoft', 'twitter', 'aad', 'aadB2C'. + * + * @param type the type value to set + * @return the IdentityProviderBaseParameters object itself. + */ + public IdentityProviderBaseParameters withType(IdentityProviderType type) { + this.type = type; + return this; + } + + /** + * Get list of Allowed Tenants when configuring Azure Active Directory login. + * + * @return the allowedTenants value + */ + public List allowedTenants() { + return this.allowedTenants; + } + + /** + * Set list of Allowed Tenants when configuring Azure Active Directory login. + * + * @param allowedTenants the allowedTenants value to set + * @return the IdentityProviderBaseParameters object itself. + */ + public IdentityProviderBaseParameters withAllowedTenants(List allowedTenants) { + this.allowedTenants = allowedTenants; + return this; + } + + /** + * Get openID Connect discovery endpoint hostname for AAD or AAD B2C. + * + * @return the authority value + */ + public String authority() { + return this.authority; + } + + /** + * Set openID Connect discovery endpoint hostname for AAD or AAD B2C. + * + * @param authority the authority value to set + * @return the IdentityProviderBaseParameters object itself. + */ + public IdentityProviderBaseParameters withAuthority(String authority) { + this.authority = authority; + return this; + } + + /** + * Get signup Policy Name. Only applies to AAD B2C Identity Provider. + * + * @return the signupPolicyName value + */ + public String signupPolicyName() { + return this.signupPolicyName; + } + + /** + * Set signup Policy Name. Only applies to AAD B2C Identity Provider. + * + * @param signupPolicyName the signupPolicyName value to set + * @return the IdentityProviderBaseParameters object itself. + */ + public IdentityProviderBaseParameters withSignupPolicyName(String signupPolicyName) { + this.signupPolicyName = signupPolicyName; + return this; + } + + /** + * Get signin Policy Name. Only applies to AAD B2C Identity Provider. + * + * @return the signinPolicyName value + */ + public String signinPolicyName() { + return this.signinPolicyName; + } + + /** + * Set signin Policy Name. Only applies to AAD B2C Identity Provider. + * + * @param signinPolicyName the signinPolicyName value to set + * @return the IdentityProviderBaseParameters object itself. + */ + public IdentityProviderBaseParameters withSigninPolicyName(String signinPolicyName) { + this.signinPolicyName = signinPolicyName; + return this; + } + + /** + * Get profile Editing Policy Name. Only applies to AAD B2C Identity Provider. + * + * @return the profileEditingPolicyName value + */ + public String profileEditingPolicyName() { + return this.profileEditingPolicyName; + } + + /** + * Set profile Editing Policy Name. Only applies to AAD B2C Identity Provider. + * + * @param profileEditingPolicyName the profileEditingPolicyName value to set + * @return the IdentityProviderBaseParameters object itself. + */ + public IdentityProviderBaseParameters withProfileEditingPolicyName(String profileEditingPolicyName) { + this.profileEditingPolicyName = profileEditingPolicyName; + return this; + } + + /** + * Get password Reset Policy Name. Only applies to AAD B2C Identity Provider. + * + * @return the passwordResetPolicyName value + */ + public String passwordResetPolicyName() { + return this.passwordResetPolicyName; + } + + /** + * Set password Reset Policy Name. Only applies to AAD B2C Identity Provider. + * + * @param passwordResetPolicyName the passwordResetPolicyName value to set + * @return the IdentityProviderBaseParameters object itself. + */ + public IdentityProviderBaseParameters withPasswordResetPolicyName(String passwordResetPolicyName) { + this.passwordResetPolicyName = passwordResetPolicyName; + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/IdentityProviderContract.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/IdentityProviderContract.java new file mode 100644 index 0000000000000..aab0e1d0aaa8e --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/IdentityProviderContract.java @@ -0,0 +1,360 @@ +/** + * 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.apimanagement.v2019_01_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.apimanagement.v2019_01_01.implementation.IdentityProviderContractInner; +import com.microsoft.azure.arm.model.Indexable; +import com.microsoft.azure.arm.model.Creatable; +import com.microsoft.azure.arm.model.Updatable; +import com.microsoft.azure.arm.model.Appliable; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.apimanagement.v2019_01_01.implementation.ApiManagementManager; +import java.util.List; + +/** + * Type representing IdentityProviderContract. + */ +public interface IdentityProviderContract extends HasInner, Indexable, Updatable, HasManager { + /** + * @return the allowedTenants value. + */ + List allowedTenants(); + + /** + * @return the authority value. + */ + String authority(); + + /** + * @return the clientId value. + */ + String clientId(); + + /** + * @return the clientSecret value. + */ + String clientSecret(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the identityProviderContractType value. + */ + IdentityProviderType identityProviderContractType(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the passwordResetPolicyName value. + */ + String passwordResetPolicyName(); + + /** + * @return the profileEditingPolicyName value. + */ + String profileEditingPolicyName(); + + /** + * @return the signinPolicyName value. + */ + String signinPolicyName(); + + /** + * @return the signupPolicyName value. + */ + String signupPolicyName(); + + /** + * @return the type value. + */ + String type(); + + /** + * The entirety of the IdentityProviderContract definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithResourceGroupName, DefinitionStages.WithServiceName, DefinitionStages.WithIfMatch, DefinitionStages.WithClientId, DefinitionStages.WithClientSecret, DefinitionStages.WithCreate { + } + + /** + * Grouping of IdentityProviderContract definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a IdentityProviderContract definition. + */ + interface Blank extends WithResourceGroupName { + } + + /** + * The stage of the identityprovidercontract definition allowing to specify ResourceGroupName. + */ + interface WithResourceGroupName { + /** + * Specifies resourceGroupName. + * @param resourceGroupName The name of the resource group + * @return the next definition stage + */ + WithServiceName withResourceGroupName(String resourceGroupName); + } + + /** + * The stage of the identityprovidercontract definition allowing to specify ServiceName. + */ + interface WithServiceName { + /** + * Specifies serviceName. + * @param serviceName The name of the API Management service + * @return the next definition stage + */ + WithIfMatch withServiceName(String serviceName); + } + + /** + * The stage of the identityprovidercontract definition allowing to specify IfMatch. + */ + interface WithIfMatch { + /** + * Specifies ifMatch. + * @param ifMatch ETag of the Entity. Not required when creating an entity, but required when updating an entity + * @return the next definition stage + */ + WithClientId withIfMatch(String ifMatch); + } + + /** + * The stage of the identityprovidercontract definition allowing to specify ClientId. + */ + interface WithClientId { + /** + * Specifies clientId. + * @param clientId Client Id of the Application in the external Identity Provider. It is App ID for Facebook login, Client ID for Google login, App ID for Microsoft + * @return the next definition stage + */ + WithClientSecret withClientId(String clientId); + } + + /** + * The stage of the identityprovidercontract definition allowing to specify ClientSecret. + */ + interface WithClientSecret { + /** + * Specifies clientSecret. + * @param clientSecret Client secret of the Application in external Identity Provider, used to authenticate login request. For example, it is App Secret for Facebook login, API Key for Google login, Public Key for Microsoft + * @return the next definition stage + */ + WithCreate withClientSecret(String clientSecret); + } + + /** + * The stage of the identityprovidercontract definition allowing to specify AllowedTenants. + */ + interface WithAllowedTenants { + /** + * Specifies allowedTenants. + * @param allowedTenants List of Allowed Tenants when configuring Azure Active Directory login + * @return the next definition stage + */ + WithCreate withAllowedTenants(List allowedTenants); + } + + /** + * The stage of the identityprovidercontract definition allowing to specify Authority. + */ + interface WithAuthority { + /** + * Specifies authority. + * @param authority OpenID Connect discovery endpoint hostname for AAD or AAD B2C + * @return the next definition stage + */ + WithCreate withAuthority(String authority); + } + + /** + * The stage of the identityprovidercontract definition allowing to specify IdentityProviderContractType. + */ + interface WithIdentityProviderContractType { + /** + * Specifies identityProviderContractType. + * @param identityProviderContractType Identity Provider Type identifier. Possible values include: 'facebook', 'google', 'microsoft', 'twitter', 'aad', 'aadB2C' + * @return the next definition stage + */ + WithCreate withIdentityProviderContractType(IdentityProviderType identityProviderContractType); + } + + /** + * The stage of the identityprovidercontract definition allowing to specify PasswordResetPolicyName. + */ + interface WithPasswordResetPolicyName { + /** + * Specifies passwordResetPolicyName. + * @param passwordResetPolicyName Password Reset Policy Name. Only applies to AAD B2C Identity Provider + * @return the next definition stage + */ + WithCreate withPasswordResetPolicyName(String passwordResetPolicyName); + } + + /** + * The stage of the identityprovidercontract definition allowing to specify ProfileEditingPolicyName. + */ + interface WithProfileEditingPolicyName { + /** + * Specifies profileEditingPolicyName. + * @param profileEditingPolicyName Profile Editing Policy Name. Only applies to AAD B2C Identity Provider + * @return the next definition stage + */ + WithCreate withProfileEditingPolicyName(String profileEditingPolicyName); + } + + /** + * The stage of the identityprovidercontract definition allowing to specify SigninPolicyName. + */ + interface WithSigninPolicyName { + /** + * Specifies signinPolicyName. + * @param signinPolicyName Signin Policy Name. Only applies to AAD B2C Identity Provider + * @return the next definition stage + */ + WithCreate withSigninPolicyName(String signinPolicyName); + } + + /** + * The stage of the identityprovidercontract definition allowing to specify SignupPolicyName. + */ + interface WithSignupPolicyName { + /** + * Specifies signupPolicyName. + * @param signupPolicyName Signup Policy Name. Only applies to AAD B2C Identity Provider + * @return the next definition stage + */ + WithCreate withSignupPolicyName(String signupPolicyName); + } + + /** + * The stage of the definition which contains all the minimum required inputs for + * the resource to be created (via {@link WithCreate#create()}), but also allows + * for any other optional settings to be specified. + */ + interface WithCreate extends Creatable, DefinitionStages.WithAllowedTenants, DefinitionStages.WithAuthority, DefinitionStages.WithIdentityProviderContractType, DefinitionStages.WithPasswordResetPolicyName, DefinitionStages.WithProfileEditingPolicyName, DefinitionStages.WithSigninPolicyName, DefinitionStages.WithSignupPolicyName { + } + } + /** + * The template for a IdentityProviderContract update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithIfMatch, UpdateStages.WithAllowedTenants, UpdateStages.WithAuthority, UpdateStages.WithIdentityProviderContractType, UpdateStages.WithPasswordResetPolicyName, UpdateStages.WithProfileEditingPolicyName, UpdateStages.WithSigninPolicyName, UpdateStages.WithSignupPolicyName { + } + + /** + * Grouping of IdentityProviderContract update stages. + */ + interface UpdateStages { + /** + * The stage of the identityprovidercontract update allowing to specify IfMatch. + */ + interface WithIfMatch { + /** + * Specifies ifMatch. + * @param ifMatch ETag of the Entity. Not required when creating an entity, but required when updating an entity + * @return the next update stage + */ + Update withIfMatch(String ifMatch); + } + + /** + * The stage of the identityprovidercontract update allowing to specify AllowedTenants. + */ + interface WithAllowedTenants { + /** + * Specifies allowedTenants. + * @param allowedTenants List of Allowed Tenants when configuring Azure Active Directory login + * @return the next update stage + */ + Update withAllowedTenants(List allowedTenants); + } + + /** + * The stage of the identityprovidercontract update allowing to specify Authority. + */ + interface WithAuthority { + /** + * Specifies authority. + * @param authority OpenID Connect discovery endpoint hostname for AAD or AAD B2C + * @return the next update stage + */ + Update withAuthority(String authority); + } + + /** + * The stage of the identityprovidercontract update allowing to specify IdentityProviderContractType. + */ + interface WithIdentityProviderContractType { + /** + * Specifies identityProviderContractType. + * @param identityProviderContractType Identity Provider Type identifier. Possible values include: 'facebook', 'google', 'microsoft', 'twitter', 'aad', 'aadB2C' + * @return the next update stage + */ + Update withIdentityProviderContractType(IdentityProviderType identityProviderContractType); + } + + /** + * The stage of the identityprovidercontract update allowing to specify PasswordResetPolicyName. + */ + interface WithPasswordResetPolicyName { + /** + * Specifies passwordResetPolicyName. + * @param passwordResetPolicyName Password Reset Policy Name. Only applies to AAD B2C Identity Provider + * @return the next update stage + */ + Update withPasswordResetPolicyName(String passwordResetPolicyName); + } + + /** + * The stage of the identityprovidercontract update allowing to specify ProfileEditingPolicyName. + */ + interface WithProfileEditingPolicyName { + /** + * Specifies profileEditingPolicyName. + * @param profileEditingPolicyName Profile Editing Policy Name. Only applies to AAD B2C Identity Provider + * @return the next update stage + */ + Update withProfileEditingPolicyName(String profileEditingPolicyName); + } + + /** + * The stage of the identityprovidercontract update allowing to specify SigninPolicyName. + */ + interface WithSigninPolicyName { + /** + * Specifies signinPolicyName. + * @param signinPolicyName Signin Policy Name. Only applies to AAD B2C Identity Provider + * @return the next update stage + */ + Update withSigninPolicyName(String signinPolicyName); + } + + /** + * The stage of the identityprovidercontract update allowing to specify SignupPolicyName. + */ + interface WithSignupPolicyName { + /** + * Specifies signupPolicyName. + * @param signupPolicyName Signup Policy Name. Only applies to AAD B2C Identity Provider + * @return the next update stage + */ + Update withSignupPolicyName(String signupPolicyName); + } + + } +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/IdentityProviderCreateOrUpdateHeaders.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/IdentityProviderCreateOrUpdateHeaders.java new file mode 100644 index 0000000000000..cfa38f91925c6 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/IdentityProviderCreateOrUpdateHeaders.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.apimanagement.v2019_01_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for CreateOrUpdate operation. + */ +public class IdentityProviderCreateOrUpdateHeaders { + /** + * Current entity state version. Should be treated as opaque and used to + * make conditional HTTP requests. + */ + @JsonProperty(value = "ETag") + private String eTag; + + /** + * Get current entity state version. Should be treated as opaque and used to make conditional HTTP requests. + * + * @return the eTag value + */ + public String eTag() { + return this.eTag; + } + + /** + * Set current entity state version. Should be treated as opaque and used to make conditional HTTP requests. + * + * @param eTag the eTag value to set + * @return the IdentityProviderCreateOrUpdateHeaders object itself. + */ + public IdentityProviderCreateOrUpdateHeaders withETag(String eTag) { + this.eTag = eTag; + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/IdentityProviderGetEntityTagHeaders.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/IdentityProviderGetEntityTagHeaders.java new file mode 100644 index 0000000000000..47a693e4ea0ee --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/IdentityProviderGetEntityTagHeaders.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.apimanagement.v2019_01_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for GetEntityTag operation. + */ +public class IdentityProviderGetEntityTagHeaders { + /** + * Current entity state version. Should be treated as opaque and used to + * make conditional HTTP requests. + */ + @JsonProperty(value = "ETag") + private String eTag; + + /** + * Get current entity state version. Should be treated as opaque and used to make conditional HTTP requests. + * + * @return the eTag value + */ + public String eTag() { + return this.eTag; + } + + /** + * Set current entity state version. Should be treated as opaque and used to make conditional HTTP requests. + * + * @param eTag the eTag value to set + * @return the IdentityProviderGetEntityTagHeaders object itself. + */ + public IdentityProviderGetEntityTagHeaders withETag(String eTag) { + this.eTag = eTag; + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/IdentityProviderGetHeaders.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/IdentityProviderGetHeaders.java new file mode 100644 index 0000000000000..c03c5725170b1 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/IdentityProviderGetHeaders.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.apimanagement.v2019_01_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for Get operation. + */ +public class IdentityProviderGetHeaders { + /** + * Current entity state version. Should be treated as opaque and used to + * make conditional HTTP requests. + */ + @JsonProperty(value = "ETag") + private String eTag; + + /** + * Get current entity state version. Should be treated as opaque and used to make conditional HTTP requests. + * + * @return the eTag value + */ + public String eTag() { + return this.eTag; + } + + /** + * Set current entity state version. Should be treated as opaque and used to make conditional HTTP requests. + * + * @param eTag the eTag value to set + * @return the IdentityProviderGetHeaders object itself. + */ + public IdentityProviderGetHeaders withETag(String eTag) { + this.eTag = eTag; + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/IdentityProviderType.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/IdentityProviderType.java new file mode 100644 index 0000000000000..3c519906cf68e --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/IdentityProviderType.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.apimanagement.v2019_01_01; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for IdentityProviderType. + */ +public final class IdentityProviderType extends ExpandableStringEnum { + /** Static value facebook for IdentityProviderType. */ + public static final IdentityProviderType FACEBOOK = fromString("facebook"); + + /** Static value google for IdentityProviderType. */ + public static final IdentityProviderType GOOGLE = fromString("google"); + + /** Static value microsoft for IdentityProviderType. */ + public static final IdentityProviderType MICROSOFT = fromString("microsoft"); + + /** Static value twitter for IdentityProviderType. */ + public static final IdentityProviderType TWITTER = fromString("twitter"); + + /** Static value aad for IdentityProviderType. */ + public static final IdentityProviderType AAD = fromString("aad"); + + /** Static value aadB2C for IdentityProviderType. */ + public static final IdentityProviderType AAD_B2C = fromString("aadB2C"); + + /** + * Creates or finds a IdentityProviderType from its string representation. + * @param name a name to look for + * @return the corresponding IdentityProviderType + */ + @JsonCreator + public static IdentityProviderType fromString(String name) { + return fromString(name, IdentityProviderType.class); + } + + /** + * @return known IdentityProviderType values + */ + public static Collection values() { + return values(IdentityProviderType.class); + } +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/IdentityProviderUpdateParameters.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/IdentityProviderUpdateParameters.java new file mode 100644 index 0000000000000..e98e5f104bbb1 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/IdentityProviderUpdateParameters.java @@ -0,0 +1,259 @@ +/** + * 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.apimanagement.v2019_01_01; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; + +/** + * Parameters supplied to update Identity Provider. + */ +@JsonFlatten +public class IdentityProviderUpdateParameters { + /** + * Identity Provider Type identifier. Possible values include: 'facebook', + * 'google', 'microsoft', 'twitter', 'aad', 'aadB2C'. + */ + @JsonProperty(value = "properties.type") + private IdentityProviderType type; + + /** + * List of Allowed Tenants when configuring Azure Active Directory login. + */ + @JsonProperty(value = "properties.allowedTenants") + private List allowedTenants; + + /** + * OpenID Connect discovery endpoint hostname for AAD or AAD B2C. + */ + @JsonProperty(value = "properties.authority") + private String authority; + + /** + * Signup Policy Name. Only applies to AAD B2C Identity Provider. + */ + @JsonProperty(value = "properties.signupPolicyName") + private String signupPolicyName; + + /** + * Signin Policy Name. Only applies to AAD B2C Identity Provider. + */ + @JsonProperty(value = "properties.signinPolicyName") + private String signinPolicyName; + + /** + * Profile Editing Policy Name. Only applies to AAD B2C Identity Provider. + */ + @JsonProperty(value = "properties.profileEditingPolicyName") + private String profileEditingPolicyName; + + /** + * Password Reset Policy Name. Only applies to AAD B2C Identity Provider. + */ + @JsonProperty(value = "properties.passwordResetPolicyName") + private String passwordResetPolicyName; + + /** + * Client Id of the Application in the external Identity Provider. It is + * App ID for Facebook login, Client ID for Google login, App ID for + * Microsoft. + */ + @JsonProperty(value = "properties.clientId") + private String clientId; + + /** + * Client secret of the Application in external Identity Provider, used to + * authenticate login request. For example, it is App Secret for Facebook + * login, API Key for Google login, Public Key for Microsoft. + */ + @JsonProperty(value = "properties.clientSecret") + private String clientSecret; + + /** + * Get identity Provider Type identifier. Possible values include: 'facebook', 'google', 'microsoft', 'twitter', 'aad', 'aadB2C'. + * + * @return the type value + */ + public IdentityProviderType type() { + return this.type; + } + + /** + * Set identity Provider Type identifier. Possible values include: 'facebook', 'google', 'microsoft', 'twitter', 'aad', 'aadB2C'. + * + * @param type the type value to set + * @return the IdentityProviderUpdateParameters object itself. + */ + public IdentityProviderUpdateParameters withType(IdentityProviderType type) { + this.type = type; + return this; + } + + /** + * Get list of Allowed Tenants when configuring Azure Active Directory login. + * + * @return the allowedTenants value + */ + public List allowedTenants() { + return this.allowedTenants; + } + + /** + * Set list of Allowed Tenants when configuring Azure Active Directory login. + * + * @param allowedTenants the allowedTenants value to set + * @return the IdentityProviderUpdateParameters object itself. + */ + public IdentityProviderUpdateParameters withAllowedTenants(List allowedTenants) { + this.allowedTenants = allowedTenants; + return this; + } + + /** + * Get openID Connect discovery endpoint hostname for AAD or AAD B2C. + * + * @return the authority value + */ + public String authority() { + return this.authority; + } + + /** + * Set openID Connect discovery endpoint hostname for AAD or AAD B2C. + * + * @param authority the authority value to set + * @return the IdentityProviderUpdateParameters object itself. + */ + public IdentityProviderUpdateParameters withAuthority(String authority) { + this.authority = authority; + return this; + } + + /** + * Get signup Policy Name. Only applies to AAD B2C Identity Provider. + * + * @return the signupPolicyName value + */ + public String signupPolicyName() { + return this.signupPolicyName; + } + + /** + * Set signup Policy Name. Only applies to AAD B2C Identity Provider. + * + * @param signupPolicyName the signupPolicyName value to set + * @return the IdentityProviderUpdateParameters object itself. + */ + public IdentityProviderUpdateParameters withSignupPolicyName(String signupPolicyName) { + this.signupPolicyName = signupPolicyName; + return this; + } + + /** + * Get signin Policy Name. Only applies to AAD B2C Identity Provider. + * + * @return the signinPolicyName value + */ + public String signinPolicyName() { + return this.signinPolicyName; + } + + /** + * Set signin Policy Name. Only applies to AAD B2C Identity Provider. + * + * @param signinPolicyName the signinPolicyName value to set + * @return the IdentityProviderUpdateParameters object itself. + */ + public IdentityProviderUpdateParameters withSigninPolicyName(String signinPolicyName) { + this.signinPolicyName = signinPolicyName; + return this; + } + + /** + * Get profile Editing Policy Name. Only applies to AAD B2C Identity Provider. + * + * @return the profileEditingPolicyName value + */ + public String profileEditingPolicyName() { + return this.profileEditingPolicyName; + } + + /** + * Set profile Editing Policy Name. Only applies to AAD B2C Identity Provider. + * + * @param profileEditingPolicyName the profileEditingPolicyName value to set + * @return the IdentityProviderUpdateParameters object itself. + */ + public IdentityProviderUpdateParameters withProfileEditingPolicyName(String profileEditingPolicyName) { + this.profileEditingPolicyName = profileEditingPolicyName; + return this; + } + + /** + * Get password Reset Policy Name. Only applies to AAD B2C Identity Provider. + * + * @return the passwordResetPolicyName value + */ + public String passwordResetPolicyName() { + return this.passwordResetPolicyName; + } + + /** + * Set password Reset Policy Name. Only applies to AAD B2C Identity Provider. + * + * @param passwordResetPolicyName the passwordResetPolicyName value to set + * @return the IdentityProviderUpdateParameters object itself. + */ + public IdentityProviderUpdateParameters withPasswordResetPolicyName(String passwordResetPolicyName) { + this.passwordResetPolicyName = passwordResetPolicyName; + return this; + } + + /** + * Get client Id of the Application in the external Identity Provider. It is App ID for Facebook login, Client ID for Google login, App ID for Microsoft. + * + * @return the clientId value + */ + public String clientId() { + return this.clientId; + } + + /** + * Set client Id of the Application in the external Identity Provider. It is App ID for Facebook login, Client ID for Google login, App ID for Microsoft. + * + * @param clientId the clientId value to set + * @return the IdentityProviderUpdateParameters object itself. + */ + public IdentityProviderUpdateParameters withClientId(String clientId) { + this.clientId = clientId; + return this; + } + + /** + * Get client secret of the Application in external Identity Provider, used to authenticate login request. For example, it is App Secret for Facebook login, API Key for Google login, Public Key for Microsoft. + * + * @return the clientSecret value + */ + public String clientSecret() { + return this.clientSecret; + } + + /** + * Set client secret of the Application in external Identity Provider, used to authenticate login request. For example, it is App Secret for Facebook login, API Key for Google login, Public Key for Microsoft. + * + * @param clientSecret the clientSecret value to set + * @return the IdentityProviderUpdateParameters object itself. + */ + public IdentityProviderUpdateParameters withClientSecret(String clientSecret) { + this.clientSecret = clientSecret; + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/IdentityProviders.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/IdentityProviders.java new file mode 100644 index 0000000000000..86ac193e1b76e --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/IdentityProviders.java @@ -0,0 +1,65 @@ +/** + * 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.apimanagement.v2019_01_01; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import rx.Completable; +import rx.Observable; +import com.microsoft.azure.management.apimanagement.v2019_01_01.implementation.IdentityProvidersInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing IdentityProviders. + */ +public interface IdentityProviders extends SupportsCreating, HasInner { + /** + * Lists a collection of Identity Provider configured in the specified service instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByServiceAsync(final String resourceGroupName, final String serviceName); + + /** + * Gets the entity state (Etag) version of the identityProvider specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param identityProviderName Identity Provider Type identifier. Possible values include: 'facebook', 'google', 'microsoft', 'twitter', 'aad', 'aadB2C' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable getEntityTagAsync(String resourceGroupName, String serviceName, IdentityProviderType identityProviderName); + + /** + * Gets the configuration details of the identity Provider configured in specified service instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param identityProviderName Identity Provider Type identifier. Possible values include: 'facebook', 'google', 'microsoft', 'twitter', 'aad', 'aadB2C' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String resourceGroupName, String serviceName, IdentityProviderType identityProviderName); + + /** + * Deletes the specified identity provider configuration. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param identityProviderName Identity Provider Type identifier. Possible values include: 'facebook', 'google', 'microsoft', 'twitter', 'aad', 'aadB2C' + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable deleteAsync(String resourceGroupName, String serviceName, IdentityProviderType identityProviderName, String ifMatch); + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/IssueAttachmentContract.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/IssueAttachmentContract.java new file mode 100644 index 0000000000000..09e0b6648d074 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/IssueAttachmentContract.java @@ -0,0 +1,165 @@ +/** + * 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.apimanagement.v2019_01_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.apimanagement.v2019_01_01.implementation.IssueAttachmentContractInner; +import com.microsoft.azure.arm.model.Indexable; +import com.microsoft.azure.arm.model.Refreshable; +import com.microsoft.azure.arm.model.Updatable; +import com.microsoft.azure.arm.model.Appliable; +import com.microsoft.azure.arm.model.Creatable; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.apimanagement.v2019_01_01.implementation.ApiManagementManager; + +/** + * Type representing IssueAttachmentContract. + */ +public interface IssueAttachmentContract extends HasInner, Indexable, Refreshable, Updatable, HasManager { + /** + * @return the content value. + */ + String content(); + + /** + * @return the contentFormat value. + */ + String contentFormat(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the title value. + */ + String title(); + + /** + * @return the type value. + */ + String type(); + + /** + * The entirety of the IssueAttachmentContract definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithIssue, DefinitionStages.WithIfMatch, DefinitionStages.WithContent, DefinitionStages.WithContentFormat, DefinitionStages.WithTitle, DefinitionStages.WithCreate { + } + + /** + * Grouping of IssueAttachmentContract definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a IssueAttachmentContract definition. + */ + interface Blank extends WithIssue { + } + + /** + * The stage of the issueattachmentcontract definition allowing to specify Issue. + */ + interface WithIssue { + /** + * Specifies resourceGroupName, serviceName, apiId, issueId. + * @param resourceGroupName The name of the resource group + * @param serviceName The name of the API Management service + * @param apiId API identifier. Must be unique in the current API Management service instance + * @param issueId Issue identifier. Must be unique in the current API Management service instance + * @return the next definition stage + */ + WithIfMatch withExistingIssue(String resourceGroupName, String serviceName, String apiId, String issueId); + } + + /** + * The stage of the issueattachmentcontract definition allowing to specify IfMatch. + */ + interface WithIfMatch { + /** + * Specifies ifMatch. + * @param ifMatch ETag of the Entity. Not required when creating an entity, but required when updating an entity + * @return the next definition stage + */ + WithContent withIfMatch(String ifMatch); + } + + /** + * The stage of the issueattachmentcontract definition allowing to specify Content. + */ + interface WithContent { + /** + * Specifies content. + * @param content An HTTP link or Base64-encoded binary data + * @return the next definition stage + */ + WithContentFormat withContent(String content); + } + + /** + * The stage of the issueattachmentcontract definition allowing to specify ContentFormat. + */ + interface WithContentFormat { + /** + * Specifies contentFormat. + * @param contentFormat Either 'link' if content is provided via an HTTP link or the MIME type of the Base64-encoded binary data provided in the 'content' property + * @return the next definition stage + */ + WithTitle withContentFormat(String contentFormat); + } + + /** + * The stage of the issueattachmentcontract definition allowing to specify Title. + */ + interface WithTitle { + /** + * Specifies title. + * @param title Filename by which the binary data will be saved + * @return the next definition stage + */ + WithCreate withTitle(String title); + } + + /** + * The stage of the definition which contains all the minimum required inputs for + * the resource to be created (via {@link WithCreate#create()}), but also allows + * for any other optional settings to be specified. + */ + interface WithCreate extends Creatable { + } + } + /** + * The template for a IssueAttachmentContract update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithIfMatch { + } + + /** + * Grouping of IssueAttachmentContract update stages. + */ + interface UpdateStages { + /** + * The stage of the issueattachmentcontract update allowing to specify IfMatch. + */ + interface WithIfMatch { + /** + * Specifies ifMatch. + * @param ifMatch ETag of the Entity. Not required when creating an entity, but required when updating an entity + * @return the next update stage + */ + Update withIfMatch(String ifMatch); + } + + } +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/IssueCommentContract.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/IssueCommentContract.java new file mode 100644 index 0000000000000..9ebd0175d06f4 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/IssueCommentContract.java @@ -0,0 +1,178 @@ +/** + * 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.apimanagement.v2019_01_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.apimanagement.v2019_01_01.implementation.IssueCommentContractInner; +import com.microsoft.azure.arm.model.Indexable; +import com.microsoft.azure.arm.model.Refreshable; +import com.microsoft.azure.arm.model.Updatable; +import com.microsoft.azure.arm.model.Appliable; +import com.microsoft.azure.arm.model.Creatable; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.apimanagement.v2019_01_01.implementation.ApiManagementManager; +import org.joda.time.DateTime; + +/** + * Type representing IssueCommentContract. + */ +public interface IssueCommentContract extends HasInner, Indexable, Refreshable, Updatable, HasManager { + /** + * @return the createdDate value. + */ + DateTime createdDate(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the text value. + */ + String text(); + + /** + * @return the type value. + */ + String type(); + + /** + * @return the userId value. + */ + String userId(); + + /** + * The entirety of the IssueCommentContract definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithIssue, DefinitionStages.WithIfMatch, DefinitionStages.WithText, DefinitionStages.WithUserId, DefinitionStages.WithCreate { + } + + /** + * Grouping of IssueCommentContract definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a IssueCommentContract definition. + */ + interface Blank extends WithIssue { + } + + /** + * The stage of the issuecommentcontract definition allowing to specify Issue. + */ + interface WithIssue { + /** + * Specifies resourceGroupName, serviceName, apiId, issueId. + * @param resourceGroupName The name of the resource group + * @param serviceName The name of the API Management service + * @param apiId API identifier. Must be unique in the current API Management service instance + * @param issueId Issue identifier. Must be unique in the current API Management service instance + * @return the next definition stage + */ + WithIfMatch withExistingIssue(String resourceGroupName, String serviceName, String apiId, String issueId); + } + + /** + * The stage of the issuecommentcontract definition allowing to specify IfMatch. + */ + interface WithIfMatch { + /** + * Specifies ifMatch. + * @param ifMatch ETag of the Entity. Not required when creating an entity, but required when updating an entity + * @return the next definition stage + */ + WithText withIfMatch(String ifMatch); + } + + /** + * The stage of the issuecommentcontract definition allowing to specify Text. + */ + interface WithText { + /** + * Specifies text. + * @param text Comment text + * @return the next definition stage + */ + WithUserId withText(String text); + } + + /** + * The stage of the issuecommentcontract definition allowing to specify UserId. + */ + interface WithUserId { + /** + * Specifies userId. + * @param userId A resource identifier for the user who left the comment + * @return the next definition stage + */ + WithCreate withUserId(String userId); + } + + /** + * The stage of the issuecommentcontract definition allowing to specify CreatedDate. + */ + interface WithCreatedDate { + /** + * Specifies createdDate. + * @param createdDate Date and time when the comment was created + * @return the next definition stage + */ + WithCreate withCreatedDate(DateTime createdDate); + } + + /** + * The stage of the definition which contains all the minimum required inputs for + * the resource to be created (via {@link WithCreate#create()}), but also allows + * for any other optional settings to be specified. + */ + interface WithCreate extends Creatable, DefinitionStages.WithCreatedDate { + } + } + /** + * The template for a IssueCommentContract update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithIfMatch, UpdateStages.WithCreatedDate { + } + + /** + * Grouping of IssueCommentContract update stages. + */ + interface UpdateStages { + /** + * The stage of the issuecommentcontract update allowing to specify IfMatch. + */ + interface WithIfMatch { + /** + * Specifies ifMatch. + * @param ifMatch ETag of the Entity. Not required when creating an entity, but required when updating an entity + * @return the next update stage + */ + Update withIfMatch(String ifMatch); + } + + /** + * The stage of the issuecommentcontract update allowing to specify CreatedDate. + */ + interface WithCreatedDate { + /** + * Specifies createdDate. + * @param createdDate Date and time when the comment was created + * @return the next update stage + */ + Update withCreatedDate(DateTime createdDate); + } + + } +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/IssueContract.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/IssueContract.java new file mode 100644 index 0000000000000..7f1aa3692cab4 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/IssueContract.java @@ -0,0 +1,252 @@ +/** + * 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.apimanagement.v2019_01_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.apimanagement.v2019_01_01.implementation.IssueContractInner; +import com.microsoft.azure.arm.model.Indexable; +import com.microsoft.azure.arm.model.Refreshable; +import com.microsoft.azure.arm.model.Updatable; +import com.microsoft.azure.arm.model.Appliable; +import com.microsoft.azure.arm.model.Creatable; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.apimanagement.v2019_01_01.implementation.ApiManagementManager; +import org.joda.time.DateTime; + +/** + * Type representing IssueContract. + */ +public interface IssueContract extends HasInner, Indexable, Refreshable, Updatable, HasManager { + /** + * @return the apiId value. + */ + String apiId(); + + /** + * @return the createdDate value. + */ + DateTime createdDate(); + + /** + * @return the description value. + */ + String description(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the state value. + */ + State state(); + + /** + * @return the title value. + */ + String title(); + + /** + * @return the type value. + */ + String type(); + + /** + * @return the userId value. + */ + String userId(); + + /** + * The entirety of the IssueContract definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithApi, DefinitionStages.WithIfMatch, DefinitionStages.WithDescription, DefinitionStages.WithTitle, DefinitionStages.WithUserId, DefinitionStages.WithCreate { + } + + /** + * Grouping of IssueContract definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a IssueContract definition. + */ + interface Blank extends WithApi { + } + + /** + * The stage of the issuecontract definition allowing to specify Api. + */ + interface WithApi { + /** + * Specifies resourceGroupName, serviceName, apiId. + * @param resourceGroupName The name of the resource group + * @param serviceName The name of the API Management service + * @param apiId API identifier. Must be unique in the current API Management service instance + * @return the next definition stage + */ + WithIfMatch withExistingApi(String resourceGroupName, String serviceName, String apiId); + } + + /** + * The stage of the issuecontract definition allowing to specify IfMatch. + */ + interface WithIfMatch { + /** + * Specifies ifMatch. + * @param ifMatch ETag of the Entity. Not required when creating an entity, but required when updating an entity + * @return the next definition stage + */ + WithDescription withIfMatch(String ifMatch); + } + + /** + * The stage of the issuecontract definition allowing to specify Description. + */ + interface WithDescription { + /** + * Specifies description. + * @param description Text describing the issue + * @return the next definition stage + */ + WithTitle withDescription(String description); + } + + /** + * The stage of the issuecontract definition allowing to specify Title. + */ + interface WithTitle { + /** + * Specifies title. + * @param title The issue title + * @return the next definition stage + */ + WithUserId withTitle(String title); + } + + /** + * The stage of the issuecontract definition allowing to specify UserId. + */ + interface WithUserId { + /** + * Specifies userId. + * @param userId A resource identifier for the user created the issue + * @return the next definition stage + */ + WithCreate withUserId(String userId); + } + + /** + * The stage of the issuecontract definition allowing to specify ApiId. + */ + interface WithApiId { + /** + * Specifies apiId. + * @param apiId A resource identifier for the API the issue was created for + * @return the next definition stage + */ + WithCreate withApiId(String apiId); + } + + /** + * The stage of the issuecontract definition allowing to specify CreatedDate. + */ + interface WithCreatedDate { + /** + * Specifies createdDate. + * @param createdDate Date and time when the issue was created + * @return the next definition stage + */ + WithCreate withCreatedDate(DateTime createdDate); + } + + /** + * The stage of the issuecontract definition allowing to specify State. + */ + interface WithState { + /** + * Specifies state. + * @param state Status of the issue. Possible values include: 'proposed', 'open', 'removed', 'resolved', 'closed' + * @return the next definition stage + */ + WithCreate withState(State state); + } + + /** + * The stage of the definition which contains all the minimum required inputs for + * the resource to be created (via {@link WithCreate#create()}), but also allows + * for any other optional settings to be specified. + */ + interface WithCreate extends Creatable, DefinitionStages.WithApiId, DefinitionStages.WithCreatedDate, DefinitionStages.WithState { + } + } + /** + * The template for a IssueContract update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithIfMatch, UpdateStages.WithApiId, UpdateStages.WithCreatedDate, UpdateStages.WithState { + } + + /** + * Grouping of IssueContract update stages. + */ + interface UpdateStages { + /** + * The stage of the issuecontract update allowing to specify IfMatch. + */ + interface WithIfMatch { + /** + * Specifies ifMatch. + * @param ifMatch ETag of the Entity. Not required when creating an entity, but required when updating an entity + * @return the next update stage + */ + Update withIfMatch(String ifMatch); + } + + /** + * The stage of the issuecontract update allowing to specify ApiId. + */ + interface WithApiId { + /** + * Specifies apiId. + * @param apiId A resource identifier for the API the issue was created for + * @return the next update stage + */ + Update withApiId(String apiId); + } + + /** + * The stage of the issuecontract update allowing to specify CreatedDate. + */ + interface WithCreatedDate { + /** + * Specifies createdDate. + * @param createdDate Date and time when the issue was created + * @return the next update stage + */ + Update withCreatedDate(DateTime createdDate); + } + + /** + * The stage of the issuecontract update allowing to specify State. + */ + interface WithState { + /** + * Specifies state. + * @param state Status of the issue. Possible values include: 'proposed', 'open', 'removed', 'resolved', 'closed' + * @return the next update stage + */ + Update withState(State state); + } + + } +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/IssueContractBaseProperties.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/IssueContractBaseProperties.java new file mode 100644 index 0000000000000..845c57a996253 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/IssueContractBaseProperties.java @@ -0,0 +1,97 @@ +/** + * 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.apimanagement.v2019_01_01; + +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Issue contract Base Properties. + */ +public class IssueContractBaseProperties { + /** + * Date and time when the issue was created. + */ + @JsonProperty(value = "createdDate") + private DateTime createdDate; + + /** + * Status of the issue. Possible values include: 'proposed', 'open', + * 'removed', 'resolved', 'closed'. + */ + @JsonProperty(value = "state") + private State state; + + /** + * A resource identifier for the API the issue was created for. + */ + @JsonProperty(value = "apiId") + private String apiId; + + /** + * Get date and time when the issue was created. + * + * @return the createdDate value + */ + public DateTime createdDate() { + return this.createdDate; + } + + /** + * Set date and time when the issue was created. + * + * @param createdDate the createdDate value to set + * @return the IssueContractBaseProperties object itself. + */ + public IssueContractBaseProperties withCreatedDate(DateTime createdDate) { + this.createdDate = createdDate; + return this; + } + + /** + * Get status of the issue. Possible values include: 'proposed', 'open', 'removed', 'resolved', 'closed'. + * + * @return the state value + */ + public State state() { + return this.state; + } + + /** + * Set status of the issue. Possible values include: 'proposed', 'open', 'removed', 'resolved', 'closed'. + * + * @param state the state value to set + * @return the IssueContractBaseProperties object itself. + */ + public IssueContractBaseProperties withState(State state) { + this.state = state; + return this; + } + + /** + * Get a resource identifier for the API the issue was created for. + * + * @return the apiId value + */ + public String apiId() { + return this.apiId; + } + + /** + * Set a resource identifier for the API the issue was created for. + * + * @param apiId the apiId value to set + * @return the IssueContractBaseProperties object itself. + */ + public IssueContractBaseProperties withApiId(String apiId) { + this.apiId = apiId; + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/IssueGetHeaders.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/IssueGetHeaders.java new file mode 100644 index 0000000000000..eb734c6a8fed3 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/IssueGetHeaders.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.apimanagement.v2019_01_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for Get operation. + */ +public class IssueGetHeaders { + /** + * Current entity state version. Should be treated as opaque and used to + * make conditional HTTP requests. + */ + @JsonProperty(value = "ETag") + private String eTag; + + /** + * Get current entity state version. Should be treated as opaque and used to make conditional HTTP requests. + * + * @return the eTag value + */ + public String eTag() { + return this.eTag; + } + + /** + * Set current entity state version. Should be treated as opaque and used to make conditional HTTP requests. + * + * @param eTag the eTag value to set + * @return the IssueGetHeaders object itself. + */ + public IssueGetHeaders withETag(String eTag) { + this.eTag = eTag; + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/IssueUpdateContract.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/IssueUpdateContract.java new file mode 100644 index 0000000000000..b6828f9c1e629 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/IssueUpdateContract.java @@ -0,0 +1,177 @@ +/** + * 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.apimanagement.v2019_01_01; + +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; + +/** + * Issue update Parameters. + */ +@JsonFlatten +public class IssueUpdateContract { + /** + * Date and time when the issue was created. + */ + @JsonProperty(value = "properties.createdDate") + private DateTime createdDate; + + /** + * Status of the issue. Possible values include: 'proposed', 'open', + * 'removed', 'resolved', 'closed'. + */ + @JsonProperty(value = "properties.state") + private State state; + + /** + * A resource identifier for the API the issue was created for. + */ + @JsonProperty(value = "properties.apiId") + private String apiId; + + /** + * The issue title. + */ + @JsonProperty(value = "properties.title") + private String title; + + /** + * Text describing the issue. + */ + @JsonProperty(value = "properties.description") + private String description; + + /** + * A resource identifier for the user created the issue. + */ + @JsonProperty(value = "properties.userId") + private String userId; + + /** + * Get date and time when the issue was created. + * + * @return the createdDate value + */ + public DateTime createdDate() { + return this.createdDate; + } + + /** + * Set date and time when the issue was created. + * + * @param createdDate the createdDate value to set + * @return the IssueUpdateContract object itself. + */ + public IssueUpdateContract withCreatedDate(DateTime createdDate) { + this.createdDate = createdDate; + return this; + } + + /** + * Get status of the issue. Possible values include: 'proposed', 'open', 'removed', 'resolved', 'closed'. + * + * @return the state value + */ + public State state() { + return this.state; + } + + /** + * Set status of the issue. Possible values include: 'proposed', 'open', 'removed', 'resolved', 'closed'. + * + * @param state the state value to set + * @return the IssueUpdateContract object itself. + */ + public IssueUpdateContract withState(State state) { + this.state = state; + return this; + } + + /** + * Get a resource identifier for the API the issue was created for. + * + * @return the apiId value + */ + public String apiId() { + return this.apiId; + } + + /** + * Set a resource identifier for the API the issue was created for. + * + * @param apiId the apiId value to set + * @return the IssueUpdateContract object itself. + */ + public IssueUpdateContract withApiId(String apiId) { + this.apiId = apiId; + return this; + } + + /** + * Get the issue title. + * + * @return the title value + */ + public String title() { + return this.title; + } + + /** + * Set the issue title. + * + * @param title the title value to set + * @return the IssueUpdateContract object itself. + */ + public IssueUpdateContract withTitle(String title) { + this.title = title; + return this; + } + + /** + * Get text describing the issue. + * + * @return the description value + */ + public String description() { + return this.description; + } + + /** + * Set text describing the issue. + * + * @param description the description value to set + * @return the IssueUpdateContract object itself. + */ + public IssueUpdateContract withDescription(String description) { + this.description = description; + return this; + } + + /** + * Get a resource identifier for the user created the issue. + * + * @return the userId value + */ + public String userId() { + return this.userId; + } + + /** + * Set a resource identifier for the user created the issue. + * + * @param userId the userId value to set + * @return the IssueUpdateContract object itself. + */ + public IssueUpdateContract withUserId(String userId) { + this.userId = userId; + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/Issues.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/Issues.java new file mode 100644 index 0000000000000..7876dda7760ea --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/Issues.java @@ -0,0 +1,40 @@ +/** + * 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.apimanagement.v2019_01_01; + +import rx.Observable; +import com.microsoft.azure.management.apimanagement.v2019_01_01.implementation.IssuesInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing Issues. + */ +public interface Issues extends HasInner { + /** + * Lists a collection of issues in the specified service instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByServiceAsync(final String resourceGroupName, final String serviceName); + + /** + * Gets API Management issue details. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param issueId Issue identifier. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String resourceGroupName, String serviceName, String issueId); + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/KeyType.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/KeyType.java new file mode 100644 index 0000000000000..46c96b677fabc --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/KeyType.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.apimanagement.v2019_01_01; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for KeyType. + */ +public enum KeyType { + /** Enum value primary. */ + PRIMARY("primary"), + + /** Enum value secondary. */ + SECONDARY("secondary"); + + /** The actual serialized value for a KeyType instance. */ + private String value; + + KeyType(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a KeyType instance. + * + * @param value the serialized value to parse. + * @return the parsed KeyType object, or null if unable to parse. + */ + @JsonCreator + public static KeyType fromString(String value) { + KeyType[] items = KeyType.values(); + for (KeyType item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/LoggerContract.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/LoggerContract.java new file mode 100644 index 0000000000000..20c13db4f8c8d --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/LoggerContract.java @@ -0,0 +1,245 @@ +/** + * 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.apimanagement.v2019_01_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.apimanagement.v2019_01_01.implementation.LoggerContractInner; +import com.microsoft.azure.arm.model.Indexable; +import com.microsoft.azure.arm.model.Creatable; +import com.microsoft.azure.arm.model.Updatable; +import com.microsoft.azure.arm.model.Appliable; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.apimanagement.v2019_01_01.implementation.ApiManagementManager; +import java.util.Map; + +/** + * Type representing LoggerContract. + */ +public interface LoggerContract extends HasInner, Indexable, Updatable, HasManager { + /** + * @return the credentials value. + */ + Map credentials(); + + /** + * @return the description value. + */ + String description(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the isBuffered value. + */ + Boolean isBuffered(); + + /** + * @return the loggerType value. + */ + LoggerType loggerType(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the resourceId value. + */ + String resourceId(); + + /** + * @return the type value. + */ + String type(); + + /** + * The entirety of the LoggerContract definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithResourceGroupName, DefinitionStages.WithServiceName, DefinitionStages.WithIfMatch, DefinitionStages.WithCredentials, DefinitionStages.WithLoggerType, DefinitionStages.WithCreate { + } + + /** + * Grouping of LoggerContract definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a LoggerContract definition. + */ + interface Blank extends WithResourceGroupName { + } + + /** + * The stage of the loggercontract definition allowing to specify ResourceGroupName. + */ + interface WithResourceGroupName { + /** + * Specifies resourceGroupName. + * @param resourceGroupName The name of the resource group + * @return the next definition stage + */ + WithServiceName withResourceGroupName(String resourceGroupName); + } + + /** + * The stage of the loggercontract definition allowing to specify ServiceName. + */ + interface WithServiceName { + /** + * Specifies serviceName. + * @param serviceName The name of the API Management service + * @return the next definition stage + */ + WithIfMatch withServiceName(String serviceName); + } + + /** + * The stage of the loggercontract definition allowing to specify IfMatch. + */ + interface WithIfMatch { + /** + * Specifies ifMatch. + * @param ifMatch ETag of the Entity. Not required when creating an entity, but required when updating an entity + * @return the next definition stage + */ + WithCredentials withIfMatch(String ifMatch); + } + + /** + * The stage of the loggercontract definition allowing to specify Credentials. + */ + interface WithCredentials { + /** + * Specifies credentials. + * @param credentials The name and SendRule connection string of the event hub for azureEventHub logger. + Instrumentation key for applicationInsights logger + * @return the next definition stage + */ + WithLoggerType withCredentials(Map credentials); + } + + /** + * The stage of the loggercontract definition allowing to specify LoggerType. + */ + interface WithLoggerType { + /** + * Specifies loggerType. + * @param loggerType Logger type. Possible values include: 'azureEventHub', 'applicationInsights' + * @return the next definition stage + */ + WithCreate withLoggerType(LoggerType loggerType); + } + + /** + * The stage of the loggercontract definition allowing to specify Description. + */ + interface WithDescription { + /** + * Specifies description. + * @param description Logger description + * @return the next definition stage + */ + WithCreate withDescription(String description); + } + + /** + * The stage of the loggercontract definition allowing to specify IsBuffered. + */ + interface WithIsBuffered { + /** + * Specifies isBuffered. + * @param isBuffered Whether records are buffered in the logger before publishing. Default is assumed to be true + * @return the next definition stage + */ + WithCreate withIsBuffered(Boolean isBuffered); + } + + /** + * The stage of the loggercontract definition allowing to specify ResourceId. + */ + interface WithResourceId { + /** + * Specifies resourceId. + * @param resourceId Azure Resource Id of a log target (either Azure Event Hub resource or Azure Application Insights resource) + * @return the next definition stage + */ + WithCreate withResourceId(String resourceId); + } + + /** + * The stage of the definition which contains all the minimum required inputs for + * the resource to be created (via {@link WithCreate#create()}), but also allows + * for any other optional settings to be specified. + */ + interface WithCreate extends Creatable, DefinitionStages.WithDescription, DefinitionStages.WithIsBuffered, DefinitionStages.WithResourceId { + } + } + /** + * The template for a LoggerContract update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithIfMatch, UpdateStages.WithDescription, UpdateStages.WithIsBuffered, UpdateStages.WithResourceId { + } + + /** + * Grouping of LoggerContract update stages. + */ + interface UpdateStages { + /** + * The stage of the loggercontract update allowing to specify IfMatch. + */ + interface WithIfMatch { + /** + * Specifies ifMatch. + * @param ifMatch ETag of the Entity. Not required when creating an entity, but required when updating an entity + * @return the next update stage + */ + Update withIfMatch(String ifMatch); + } + + /** + * The stage of the loggercontract update allowing to specify Description. + */ + interface WithDescription { + /** + * Specifies description. + * @param description Logger description + * @return the next update stage + */ + Update withDescription(String description); + } + + /** + * The stage of the loggercontract update allowing to specify IsBuffered. + */ + interface WithIsBuffered { + /** + * Specifies isBuffered. + * @param isBuffered Whether records are buffered in the logger before publishing. Default is assumed to be true + * @return the next update stage + */ + Update withIsBuffered(Boolean isBuffered); + } + + /** + * The stage of the loggercontract update allowing to specify ResourceId. + */ + interface WithResourceId { + /** + * Specifies resourceId. + * @param resourceId Azure Resource Id of a log target (either Azure Event Hub resource or Azure Application Insights resource) + * @return the next update stage + */ + Update withResourceId(String resourceId); + } + + } +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/LoggerCreateOrUpdateHeaders.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/LoggerCreateOrUpdateHeaders.java new file mode 100644 index 0000000000000..2961f3d8a4332 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/LoggerCreateOrUpdateHeaders.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.apimanagement.v2019_01_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for CreateOrUpdate operation. + */ +public class LoggerCreateOrUpdateHeaders { + /** + * Current entity state version. Should be treated as opaque and used to + * make conditional HTTP requests. + */ + @JsonProperty(value = "ETag") + private String eTag; + + /** + * Get current entity state version. Should be treated as opaque and used to make conditional HTTP requests. + * + * @return the eTag value + */ + public String eTag() { + return this.eTag; + } + + /** + * Set current entity state version. Should be treated as opaque and used to make conditional HTTP requests. + * + * @param eTag the eTag value to set + * @return the LoggerCreateOrUpdateHeaders object itself. + */ + public LoggerCreateOrUpdateHeaders withETag(String eTag) { + this.eTag = eTag; + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/LoggerGetEntityTagHeaders.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/LoggerGetEntityTagHeaders.java new file mode 100644 index 0000000000000..a80d24f66f2dc --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/LoggerGetEntityTagHeaders.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.apimanagement.v2019_01_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for GetEntityTag operation. + */ +public class LoggerGetEntityTagHeaders { + /** + * Current entity state version. Should be treated as opaque and used to + * make conditional HTTP requests. + */ + @JsonProperty(value = "ETag") + private String eTag; + + /** + * Get current entity state version. Should be treated as opaque and used to make conditional HTTP requests. + * + * @return the eTag value + */ + public String eTag() { + return this.eTag; + } + + /** + * Set current entity state version. Should be treated as opaque and used to make conditional HTTP requests. + * + * @param eTag the eTag value to set + * @return the LoggerGetEntityTagHeaders object itself. + */ + public LoggerGetEntityTagHeaders withETag(String eTag) { + this.eTag = eTag; + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/LoggerGetHeaders.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/LoggerGetHeaders.java new file mode 100644 index 0000000000000..535b098583b88 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/LoggerGetHeaders.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.apimanagement.v2019_01_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for Get operation. + */ +public class LoggerGetHeaders { + /** + * Current entity state version. Should be treated as opaque and used to + * make conditional HTTP requests. + */ + @JsonProperty(value = "ETag") + private String eTag; + + /** + * Get current entity state version. Should be treated as opaque and used to make conditional HTTP requests. + * + * @return the eTag value + */ + public String eTag() { + return this.eTag; + } + + /** + * Set current entity state version. Should be treated as opaque and used to make conditional HTTP requests. + * + * @param eTag the eTag value to set + * @return the LoggerGetHeaders object itself. + */ + public LoggerGetHeaders withETag(String eTag) { + this.eTag = eTag; + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/LoggerType.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/LoggerType.java new file mode 100644 index 0000000000000..2f5996a5bc285 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/LoggerType.java @@ -0,0 +1,41 @@ +/** + * 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.apimanagement.v2019_01_01; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for LoggerType. + */ +public final class LoggerType extends ExpandableStringEnum { + /** Static value azureEventHub for LoggerType. */ + public static final LoggerType AZURE_EVENT_HUB = fromString("azureEventHub"); + + /** Static value applicationInsights for LoggerType. */ + public static final LoggerType APPLICATION_INSIGHTS = fromString("applicationInsights"); + + /** + * Creates or finds a LoggerType from its string representation. + * @param name a name to look for + * @return the corresponding LoggerType + */ + @JsonCreator + public static LoggerType fromString(String name) { + return fromString(name, LoggerType.class); + } + + /** + * @return known LoggerType values + */ + public static Collection values() { + return values(LoggerType.class); + } +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/LoggerUpdateContract.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/LoggerUpdateContract.java new file mode 100644 index 0000000000000..64479e397846a --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/LoggerUpdateContract.java @@ -0,0 +1,126 @@ +/** + * 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.apimanagement.v2019_01_01; + +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; + +/** + * Logger update contract. + */ +@JsonFlatten +public class LoggerUpdateContract { + /** + * Logger type. Possible values include: 'azureEventHub', + * 'applicationInsights'. + */ + @JsonProperty(value = "properties.loggerType") + private LoggerType loggerType; + + /** + * Logger description. + */ + @JsonProperty(value = "properties.description") + private String description; + + /** + * Logger credentials. + */ + @JsonProperty(value = "properties.credentials") + private Map credentials; + + /** + * Whether records are buffered in the logger before publishing. Default is + * assumed to be true. + */ + @JsonProperty(value = "properties.isBuffered") + private Boolean isBuffered; + + /** + * Get logger type. Possible values include: 'azureEventHub', 'applicationInsights'. + * + * @return the loggerType value + */ + public LoggerType loggerType() { + return this.loggerType; + } + + /** + * Set logger type. Possible values include: 'azureEventHub', 'applicationInsights'. + * + * @param loggerType the loggerType value to set + * @return the LoggerUpdateContract object itself. + */ + public LoggerUpdateContract withLoggerType(LoggerType loggerType) { + this.loggerType = loggerType; + return this; + } + + /** + * Get logger description. + * + * @return the description value + */ + public String description() { + return this.description; + } + + /** + * Set logger description. + * + * @param description the description value to set + * @return the LoggerUpdateContract object itself. + */ + public LoggerUpdateContract withDescription(String description) { + this.description = description; + return this; + } + + /** + * Get logger credentials. + * + * @return the credentials value + */ + public Map credentials() { + return this.credentials; + } + + /** + * Set logger credentials. + * + * @param credentials the credentials value to set + * @return the LoggerUpdateContract object itself. + */ + public LoggerUpdateContract withCredentials(Map credentials) { + this.credentials = credentials; + return this; + } + + /** + * Get whether records are buffered in the logger before publishing. Default is assumed to be true. + * + * @return the isBuffered value + */ + public Boolean isBuffered() { + return this.isBuffered; + } + + /** + * Set whether records are buffered in the logger before publishing. Default is assumed to be true. + * + * @param isBuffered the isBuffered value to set + * @return the LoggerUpdateContract object itself. + */ + public LoggerUpdateContract withIsBuffered(Boolean isBuffered) { + this.isBuffered = isBuffered; + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/Loggers.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/Loggers.java new file mode 100644 index 0000000000000..40bf095696d49 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/Loggers.java @@ -0,0 +1,65 @@ +/** + * 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.apimanagement.v2019_01_01; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import rx.Completable; +import rx.Observable; +import com.microsoft.azure.management.apimanagement.v2019_01_01.implementation.LoggersInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing Loggers. + */ +public interface Loggers extends SupportsCreating, HasInner { + /** + * Lists a collection of loggers in the specified service instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByServiceAsync(final String resourceGroupName, final String serviceName); + + /** + * Gets the entity state (Etag) version of the logger specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param loggerId Logger identifier. Must be unique in the API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable getEntityTagAsync(String resourceGroupName, String serviceName, String loggerId); + + /** + * Gets the details of the logger specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param loggerId Logger identifier. Must be unique in the API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String resourceGroupName, String serviceName, String loggerId); + + /** + * Deletes the specified logger. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param loggerId Logger identifier. Must be unique in the API Management service instance. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable deleteAsync(String resourceGroupName, String serviceName, String loggerId, String ifMatch); + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/NameAvailabilityReason.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/NameAvailabilityReason.java new file mode 100644 index 0000000000000..2ffb6a76c7919 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/NameAvailabilityReason.java @@ -0,0 +1,56 @@ +/** + * 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.apimanagement.v2019_01_01; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for NameAvailabilityReason. + */ +public enum NameAvailabilityReason { + /** Enum value Valid. */ + VALID("Valid"), + + /** Enum value Invalid. */ + INVALID("Invalid"), + + /** Enum value AlreadyExists. */ + ALREADY_EXISTS("AlreadyExists"); + + /** The actual serialized value for a NameAvailabilityReason instance. */ + private String value; + + NameAvailabilityReason(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a NameAvailabilityReason instance. + * + * @param value the serialized value to parse. + * @return the parsed NameAvailabilityReason object, or null if unable to parse. + */ + @JsonCreator + public static NameAvailabilityReason fromString(String value) { + NameAvailabilityReason[] items = NameAvailabilityReason.values(); + for (NameAvailabilityReason item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/NetworkStatus.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/NetworkStatus.java new file mode 100644 index 0000000000000..420a25a5ce41f --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/NetworkStatus.java @@ -0,0 +1,40 @@ +/** + * 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.apimanagement.v2019_01_01; + +import rx.Observable; +import com.microsoft.azure.management.apimanagement.v2019_01_01.implementation.NetworkStatusInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing NetworkStatus. + */ +public interface NetworkStatus extends HasInner { + /** + * Gets the Connectivity Status to the external resources on which the Api Management service depends from inside the Cloud Service. This also returns the DNS Servers as visible to the CloudService. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByServiceAsync(String resourceGroupName, String serviceName); + + /** + * Gets the Connectivity Status to the external resources on which the Api Management service depends from inside the Cloud Service. This also returns the DNS Servers as visible to the CloudService. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param locationName Location in which the API Management service is deployed. This is one of the Azure Regions like West US, East US, South Central US. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByLocationAsync(String resourceGroupName, String serviceName, String locationName); + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/NetworkStatusContract.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/NetworkStatusContract.java new file mode 100644 index 0000000000000..0fd67e7b03588 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/NetworkStatusContract.java @@ -0,0 +1,31 @@ +/** + * 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.apimanagement.v2019_01_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.apimanagement.v2019_01_01.implementation.ApiManagementManager; +import com.microsoft.azure.management.apimanagement.v2019_01_01.implementation.NetworkStatusContractInner; +import java.util.List; + +/** + * Type representing NetworkStatusContract. + */ +public interface NetworkStatusContract extends HasInner, HasManager { + /** + * @return the connectivityStatus value. + */ + List connectivityStatus(); + + /** + * @return the dnsServers value. + */ + List dnsServers(); + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/NetworkStatusContractByLocation.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/NetworkStatusContractByLocation.java new file mode 100644 index 0000000000000..04b5e06cadd39 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/NetworkStatusContractByLocation.java @@ -0,0 +1,31 @@ +/** + * 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.apimanagement.v2019_01_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.apimanagement.v2019_01_01.implementation.ApiManagementManager; +import com.microsoft.azure.management.apimanagement.v2019_01_01.implementation.NetworkStatusContractByLocationInner; +import com.microsoft.azure.management.apimanagement.v2019_01_01.implementation.NetworkStatusContractInner; + +/** + * Type representing NetworkStatusContractByLocation. + */ +public interface NetworkStatusContractByLocation extends HasInner, HasManager { + /** + * @return the location value. + */ + String location(); + + /** + * @return the networkStatus value. + */ + NetworkStatusContractInner networkStatus(); + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/NotificationContract.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/NotificationContract.java new file mode 100644 index 0000000000000..c0189bb4a5320 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/NotificationContract.java @@ -0,0 +1,137 @@ +/** + * 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.apimanagement.v2019_01_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.apimanagement.v2019_01_01.implementation.NotificationContractInner; +import com.microsoft.azure.arm.model.Indexable; +import com.microsoft.azure.arm.model.Creatable; +import com.microsoft.azure.arm.model.Updatable; +import com.microsoft.azure.arm.model.Appliable; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.apimanagement.v2019_01_01.implementation.ApiManagementManager; + +/** + * Type representing NotificationContract. + */ +public interface NotificationContract extends HasInner, Indexable, Updatable, HasManager { + /** + * @return the description value. + */ + String description(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the recipients value. + */ + RecipientsContractProperties recipients(); + + /** + * @return the title value. + */ + String title(); + + /** + * @return the type value. + */ + String type(); + + /** + * The entirety of the NotificationContract definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithResourceGroupName, DefinitionStages.WithServiceName, DefinitionStages.WithIfMatch, DefinitionStages.WithCreate { + } + + /** + * Grouping of NotificationContract definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a NotificationContract definition. + */ + interface Blank extends WithResourceGroupName { + } + + /** + * The stage of the notificationcontract definition allowing to specify ResourceGroupName. + */ + interface WithResourceGroupName { + /** + * Specifies resourceGroupName. + * @param resourceGroupName The name of the resource group + * @return the next definition stage + */ + WithServiceName withResourceGroupName(String resourceGroupName); + } + + /** + * The stage of the notificationcontract definition allowing to specify ServiceName. + */ + interface WithServiceName { + /** + * Specifies serviceName. + * @param serviceName The name of the API Management service + * @return the next definition stage + */ + WithIfMatch withServiceName(String serviceName); + } + + /** + * The stage of the notificationcontract definition allowing to specify IfMatch. + */ + interface WithIfMatch { + /** + * Specifies ifMatch. + * @param ifMatch ETag of the Entity. Not required when creating an entity, but required when updating an entity + * @return the next definition stage + */ + WithCreate withIfMatch(String ifMatch); + } + + /** + * The stage of the definition which contains all the minimum required inputs for + * the resource to be created (via {@link WithCreate#create()}), but also allows + * for any other optional settings to be specified. + */ + interface WithCreate extends Creatable { + } + } + /** + * The template for a NotificationContract update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithIfMatch { + } + + /** + * Grouping of NotificationContract update stages. + */ + interface UpdateStages { + /** + * The stage of the notificationcontract update allowing to specify IfMatch. + */ + interface WithIfMatch { + /** + * Specifies ifMatch. + * @param ifMatch ETag of the Entity. Not required when creating an entity, but required when updating an entity + * @return the next update stage + */ + Update withIfMatch(String ifMatch); + } + + } +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/NotificationName.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/NotificationName.java new file mode 100644 index 0000000000000..7a81b65287cb1 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/NotificationName.java @@ -0,0 +1,56 @@ +/** + * 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.apimanagement.v2019_01_01; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for NotificationName. + */ +public final class NotificationName extends ExpandableStringEnum { + /** Static value RequestPublisherNotificationMessage for NotificationName. */ + public static final NotificationName REQUEST_PUBLISHER_NOTIFICATION_MESSAGE = fromString("RequestPublisherNotificationMessage"); + + /** Static value PurchasePublisherNotificationMessage for NotificationName. */ + public static final NotificationName PURCHASE_PUBLISHER_NOTIFICATION_MESSAGE = fromString("PurchasePublisherNotificationMessage"); + + /** Static value NewApplicationNotificationMessage for NotificationName. */ + public static final NotificationName NEW_APPLICATION_NOTIFICATION_MESSAGE = fromString("NewApplicationNotificationMessage"); + + /** Static value BCC for NotificationName. */ + public static final NotificationName BCC = fromString("BCC"); + + /** Static value NewIssuePublisherNotificationMessage for NotificationName. */ + public static final NotificationName NEW_ISSUE_PUBLISHER_NOTIFICATION_MESSAGE = fromString("NewIssuePublisherNotificationMessage"); + + /** Static value AccountClosedPublisher for NotificationName. */ + public static final NotificationName ACCOUNT_CLOSED_PUBLISHER = fromString("AccountClosedPublisher"); + + /** Static value QuotaLimitApproachingPublisherNotificationMessage for NotificationName. */ + public static final NotificationName QUOTA_LIMIT_APPROACHING_PUBLISHER_NOTIFICATION_MESSAGE = fromString("QuotaLimitApproachingPublisherNotificationMessage"); + + /** + * Creates or finds a NotificationName from its string representation. + * @param name a name to look for + * @return the corresponding NotificationName + */ + @JsonCreator + public static NotificationName fromString(String name) { + return fromString(name, NotificationName.class); + } + + /** + * @return known NotificationName values + */ + public static Collection values() { + return values(NotificationName.class); + } +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/NotificationRecipientEmails.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/NotificationRecipientEmails.java new file mode 100644 index 0000000000000..dd7a8c98699cd --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/NotificationRecipientEmails.java @@ -0,0 +1,56 @@ +/** + * 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.apimanagement.v2019_01_01; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import rx.Completable; +import rx.Observable; +import com.microsoft.azure.management.apimanagement.v2019_01_01.implementation.NotificationRecipientEmailsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing NotificationRecipientEmails. + */ +public interface NotificationRecipientEmails extends SupportsCreating, HasInner { + /** + * Gets the list of the Notification Recipient Emails subscribed to a notification. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param notificationName Notification Name Identifier. Possible values include: 'RequestPublisherNotificationMessage', 'PurchasePublisherNotificationMessage', 'NewApplicationNotificationMessage', 'BCC', 'NewIssuePublisherNotificationMessage', 'AccountClosedPublisher', 'QuotaLimitApproachingPublisherNotificationMessage' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByNotificationAsync(String resourceGroupName, String serviceName, NotificationName notificationName); + + /** + * Determine if Notification Recipient Email subscribed to the notification. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param notificationName Notification Name Identifier. Possible values include: 'RequestPublisherNotificationMessage', 'PurchasePublisherNotificationMessage', 'NewApplicationNotificationMessage', 'BCC', 'NewIssuePublisherNotificationMessage', 'AccountClosedPublisher', 'QuotaLimitApproachingPublisherNotificationMessage' + * @param email Email identifier. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable checkEntityExistsAsync(String resourceGroupName, String serviceName, NotificationName notificationName, String email); + + /** + * Removes the email from the list of Notification. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param notificationName Notification Name Identifier. Possible values include: 'RequestPublisherNotificationMessage', 'PurchasePublisherNotificationMessage', 'NewApplicationNotificationMessage', 'BCC', 'NewIssuePublisherNotificationMessage', 'AccountClosedPublisher', 'QuotaLimitApproachingPublisherNotificationMessage' + * @param email Email identifier. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable deleteAsync(String resourceGroupName, String serviceName, NotificationName notificationName, String email); + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/NotificationRecipientUsers.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/NotificationRecipientUsers.java new file mode 100644 index 0000000000000..5df1a593b9ce9 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/NotificationRecipientUsers.java @@ -0,0 +1,56 @@ +/** + * 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.apimanagement.v2019_01_01; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import rx.Completable; +import rx.Observable; +import com.microsoft.azure.management.apimanagement.v2019_01_01.implementation.NotificationRecipientUsersInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing NotificationRecipientUsers. + */ +public interface NotificationRecipientUsers extends SupportsCreating, HasInner { + /** + * Gets the list of the Notification Recipient User subscribed to the notification. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param notificationName Notification Name Identifier. Possible values include: 'RequestPublisherNotificationMessage', 'PurchasePublisherNotificationMessage', 'NewApplicationNotificationMessage', 'BCC', 'NewIssuePublisherNotificationMessage', 'AccountClosedPublisher', 'QuotaLimitApproachingPublisherNotificationMessage' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByNotificationAsync(String resourceGroupName, String serviceName, NotificationName notificationName); + + /** + * Determine if the Notification Recipient User is subscribed to the notification. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param notificationName Notification Name Identifier. Possible values include: 'RequestPublisherNotificationMessage', 'PurchasePublisherNotificationMessage', 'NewApplicationNotificationMessage', 'BCC', 'NewIssuePublisherNotificationMessage', 'AccountClosedPublisher', 'QuotaLimitApproachingPublisherNotificationMessage' + * @param userId User identifier. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable checkEntityExistsAsync(String resourceGroupName, String serviceName, NotificationName notificationName, String userId); + + /** + * Removes the API Management user from the list of Notification. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param notificationName Notification Name Identifier. Possible values include: 'RequestPublisherNotificationMessage', 'PurchasePublisherNotificationMessage', 'NewApplicationNotificationMessage', 'BCC', 'NewIssuePublisherNotificationMessage', 'AccountClosedPublisher', 'QuotaLimitApproachingPublisherNotificationMessage' + * @param userId User identifier. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable deleteAsync(String resourceGroupName, String serviceName, NotificationName notificationName, String userId); + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/Notifications.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/Notifications.java new file mode 100644 index 0000000000000..4a12a429ab132 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/Notifications.java @@ -0,0 +1,41 @@ +/** + * 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.apimanagement.v2019_01_01; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import rx.Observable; +import com.microsoft.azure.management.apimanagement.v2019_01_01.implementation.NotificationsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing Notifications. + */ +public interface Notifications extends SupportsCreating, HasInner { + /** + * Lists a collection of properties defined within a service instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByServiceAsync(final String resourceGroupName, final String serviceName); + + /** + * Gets the details of the Notification specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param notificationName Notification Name Identifier. Possible values include: 'RequestPublisherNotificationMessage', 'PurchasePublisherNotificationMessage', 'NewApplicationNotificationMessage', 'BCC', 'NewIssuePublisherNotificationMessage', 'AccountClosedPublisher', 'QuotaLimitApproachingPublisherNotificationMessage' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String resourceGroupName, String serviceName, NotificationName notificationName); + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/OAuth2AuthenticationSettingsContract.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/OAuth2AuthenticationSettingsContract.java new file mode 100644 index 0000000000000..b24e2e4271308 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/OAuth2AuthenticationSettingsContract.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.apimanagement.v2019_01_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * API OAuth2 Authentication settings details. + */ +public class OAuth2AuthenticationSettingsContract { + /** + * OAuth authorization server identifier. + */ + @JsonProperty(value = "authorizationServerId") + private String authorizationServerId; + + /** + * operations scope. + */ + @JsonProperty(value = "scope") + private String scope; + + /** + * Get oAuth authorization server identifier. + * + * @return the authorizationServerId value + */ + public String authorizationServerId() { + return this.authorizationServerId; + } + + /** + * Set oAuth authorization server identifier. + * + * @param authorizationServerId the authorizationServerId value to set + * @return the OAuth2AuthenticationSettingsContract object itself. + */ + public OAuth2AuthenticationSettingsContract withAuthorizationServerId(String authorizationServerId) { + this.authorizationServerId = authorizationServerId; + return this; + } + + /** + * Get operations scope. + * + * @return the scope value + */ + public String scope() { + return this.scope; + } + + /** + * Set operations scope. + * + * @param scope the scope value to set + * @return the OAuth2AuthenticationSettingsContract object itself. + */ + public OAuth2AuthenticationSettingsContract withScope(String scope) { + this.scope = scope; + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/OpenIdAuthenticationSettingsContract.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/OpenIdAuthenticationSettingsContract.java new file mode 100644 index 0000000000000..4cbc845065b3b --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/OpenIdAuthenticationSettingsContract.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.apimanagement.v2019_01_01; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * API OAuth2 Authentication settings details. + */ +public class OpenIdAuthenticationSettingsContract { + /** + * OAuth authorization server identifier. + */ + @JsonProperty(value = "openidProviderId") + private String openidProviderId; + + /** + * How to send token to the server. + */ + @JsonProperty(value = "bearerTokenSendingMethods") + private List bearerTokenSendingMethods; + + /** + * Get oAuth authorization server identifier. + * + * @return the openidProviderId value + */ + public String openidProviderId() { + return this.openidProviderId; + } + + /** + * Set oAuth authorization server identifier. + * + * @param openidProviderId the openidProviderId value to set + * @return the OpenIdAuthenticationSettingsContract object itself. + */ + public OpenIdAuthenticationSettingsContract withOpenidProviderId(String openidProviderId) { + this.openidProviderId = openidProviderId; + return this; + } + + /** + * Get how to send token to the server. + * + * @return the bearerTokenSendingMethods value + */ + public List bearerTokenSendingMethods() { + return this.bearerTokenSendingMethods; + } + + /** + * Set how to send token to the server. + * + * @param bearerTokenSendingMethods the bearerTokenSendingMethods value to set + * @return the OpenIdAuthenticationSettingsContract object itself. + */ + public OpenIdAuthenticationSettingsContract withBearerTokenSendingMethods(List bearerTokenSendingMethods) { + this.bearerTokenSendingMethods = bearerTokenSendingMethods; + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/OpenIdConnectProviderCreateOrUpdateHeaders.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/OpenIdConnectProviderCreateOrUpdateHeaders.java new file mode 100644 index 0000000000000..113d5d1880504 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/OpenIdConnectProviderCreateOrUpdateHeaders.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.apimanagement.v2019_01_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for CreateOrUpdate operation. + */ +public class OpenIdConnectProviderCreateOrUpdateHeaders { + /** + * Current entity state version. Should be treated as opaque and used to + * make conditional HTTP requests. + */ + @JsonProperty(value = "ETag") + private String eTag; + + /** + * Get current entity state version. Should be treated as opaque and used to make conditional HTTP requests. + * + * @return the eTag value + */ + public String eTag() { + return this.eTag; + } + + /** + * Set current entity state version. Should be treated as opaque and used to make conditional HTTP requests. + * + * @param eTag the eTag value to set + * @return the OpenIdConnectProviderCreateOrUpdateHeaders object itself. + */ + public OpenIdConnectProviderCreateOrUpdateHeaders withETag(String eTag) { + this.eTag = eTag; + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/OpenIdConnectProviderGetEntityTagHeaders.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/OpenIdConnectProviderGetEntityTagHeaders.java new file mode 100644 index 0000000000000..ecf8b82e677a3 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/OpenIdConnectProviderGetEntityTagHeaders.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.apimanagement.v2019_01_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for GetEntityTag operation. + */ +public class OpenIdConnectProviderGetEntityTagHeaders { + /** + * Current entity state version. Should be treated as opaque and used to + * make conditional HTTP requests. + */ + @JsonProperty(value = "ETag") + private String eTag; + + /** + * Get current entity state version. Should be treated as opaque and used to make conditional HTTP requests. + * + * @return the eTag value + */ + public String eTag() { + return this.eTag; + } + + /** + * Set current entity state version. Should be treated as opaque and used to make conditional HTTP requests. + * + * @param eTag the eTag value to set + * @return the OpenIdConnectProviderGetEntityTagHeaders object itself. + */ + public OpenIdConnectProviderGetEntityTagHeaders withETag(String eTag) { + this.eTag = eTag; + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/OpenIdConnectProviderGetHeaders.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/OpenIdConnectProviderGetHeaders.java new file mode 100644 index 0000000000000..4c9bab87401cd --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/OpenIdConnectProviderGetHeaders.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.apimanagement.v2019_01_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for Get operation. + */ +public class OpenIdConnectProviderGetHeaders { + /** + * Current entity state version. Should be treated as opaque and used to + * make conditional HTTP requests. + */ + @JsonProperty(value = "ETag") + private String eTag; + + /** + * Get current entity state version. Should be treated as opaque and used to make conditional HTTP requests. + * + * @return the eTag value + */ + public String eTag() { + return this.eTag; + } + + /** + * Set current entity state version. Should be treated as opaque and used to make conditional HTTP requests. + * + * @param eTag the eTag value to set + * @return the OpenIdConnectProviderGetHeaders object itself. + */ + public OpenIdConnectProviderGetHeaders withETag(String eTag) { + this.eTag = eTag; + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/OpenIdConnectProviders.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/OpenIdConnectProviders.java new file mode 100644 index 0000000000000..a1a7260075f46 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/OpenIdConnectProviders.java @@ -0,0 +1,65 @@ +/** + * 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.apimanagement.v2019_01_01; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import rx.Completable; +import rx.Observable; +import com.microsoft.azure.management.apimanagement.v2019_01_01.implementation.OpenIdConnectProvidersInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing OpenIdConnectProviders. + */ +public interface OpenIdConnectProviders extends SupportsCreating, HasInner { + /** + * Lists of all the OpenId Connect Providers. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByServiceAsync(final String resourceGroupName, final String serviceName); + + /** + * Gets the entity state (Etag) version of the openIdConnectProvider specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param opid Identifier of the OpenID Connect Provider. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable getEntityTagAsync(String resourceGroupName, String serviceName, String opid); + + /** + * Gets specific OpenID Connect Provider. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param opid Identifier of the OpenID Connect Provider. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String resourceGroupName, String serviceName, String opid); + + /** + * Deletes specific OpenID Connect Provider of the API Management service instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param opid Identifier of the OpenID Connect Provider. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable deleteAsync(String resourceGroupName, String serviceName, String opid, String ifMatch); + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/OpenidConnectProviderContract.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/OpenidConnectProviderContract.java new file mode 100644 index 0000000000000..61b1ea1b0eb8e --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/OpenidConnectProviderContract.java @@ -0,0 +1,231 @@ +/** + * 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.apimanagement.v2019_01_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.apimanagement.v2019_01_01.implementation.OpenidConnectProviderContractInner; +import com.microsoft.azure.arm.model.Indexable; +import com.microsoft.azure.arm.model.Creatable; +import com.microsoft.azure.arm.model.Updatable; +import com.microsoft.azure.arm.model.Appliable; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.apimanagement.v2019_01_01.implementation.ApiManagementManager; + +/** + * Type representing OpenidConnectProviderContract. + */ +public interface OpenidConnectProviderContract extends HasInner, Indexable, Updatable, HasManager { + /** + * @return the clientId value. + */ + String clientId(); + + /** + * @return the clientSecret value. + */ + String clientSecret(); + + /** + * @return the description value. + */ + String description(); + + /** + * @return the displayName value. + */ + String displayName(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the metadataEndpoint value. + */ + String metadataEndpoint(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the type value. + */ + String type(); + + /** + * The entirety of the OpenidConnectProviderContract definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithResourceGroupName, DefinitionStages.WithServiceName, DefinitionStages.WithIfMatch, DefinitionStages.WithClientId, DefinitionStages.WithDisplayName, DefinitionStages.WithMetadataEndpoint, DefinitionStages.WithCreate { + } + + /** + * Grouping of OpenidConnectProviderContract definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a OpenidConnectProviderContract definition. + */ + interface Blank extends WithResourceGroupName { + } + + /** + * The stage of the openidconnectprovidercontract definition allowing to specify ResourceGroupName. + */ + interface WithResourceGroupName { + /** + * Specifies resourceGroupName. + * @param resourceGroupName The name of the resource group + * @return the next definition stage + */ + WithServiceName withResourceGroupName(String resourceGroupName); + } + + /** + * The stage of the openidconnectprovidercontract definition allowing to specify ServiceName. + */ + interface WithServiceName { + /** + * Specifies serviceName. + * @param serviceName The name of the API Management service + * @return the next definition stage + */ + WithIfMatch withServiceName(String serviceName); + } + + /** + * The stage of the openidconnectprovidercontract definition allowing to specify IfMatch. + */ + interface WithIfMatch { + /** + * Specifies ifMatch. + * @param ifMatch ETag of the Entity. Not required when creating an entity, but required when updating an entity + * @return the next definition stage + */ + WithClientId withIfMatch(String ifMatch); + } + + /** + * The stage of the openidconnectprovidercontract definition allowing to specify ClientId. + */ + interface WithClientId { + /** + * Specifies clientId. + * @param clientId Client ID of developer console which is the client application + * @return the next definition stage + */ + WithDisplayName withClientId(String clientId); + } + + /** + * The stage of the openidconnectprovidercontract definition allowing to specify DisplayName. + */ + interface WithDisplayName { + /** + * Specifies displayName. + * @param displayName User-friendly OpenID Connect Provider name + * @return the next definition stage + */ + WithMetadataEndpoint withDisplayName(String displayName); + } + + /** + * The stage of the openidconnectprovidercontract definition allowing to specify MetadataEndpoint. + */ + interface WithMetadataEndpoint { + /** + * Specifies metadataEndpoint. + * @param metadataEndpoint Metadata endpoint URI + * @return the next definition stage + */ + WithCreate withMetadataEndpoint(String metadataEndpoint); + } + + /** + * The stage of the openidconnectprovidercontract definition allowing to specify ClientSecret. + */ + interface WithClientSecret { + /** + * Specifies clientSecret. + * @param clientSecret Client Secret of developer console which is the client application + * @return the next definition stage + */ + WithCreate withClientSecret(String clientSecret); + } + + /** + * The stage of the openidconnectprovidercontract definition allowing to specify Description. + */ + interface WithDescription { + /** + * Specifies description. + * @param description User-friendly description of OpenID Connect Provider + * @return the next definition stage + */ + WithCreate withDescription(String description); + } + + /** + * The stage of the definition which contains all the minimum required inputs for + * the resource to be created (via {@link WithCreate#create()}), but also allows + * for any other optional settings to be specified. + */ + interface WithCreate extends Creatable, DefinitionStages.WithClientSecret, DefinitionStages.WithDescription { + } + } + /** + * The template for a OpenidConnectProviderContract update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithIfMatch, UpdateStages.WithClientSecret, UpdateStages.WithDescription { + } + + /** + * Grouping of OpenidConnectProviderContract update stages. + */ + interface UpdateStages { + /** + * The stage of the openidconnectprovidercontract update allowing to specify IfMatch. + */ + interface WithIfMatch { + /** + * Specifies ifMatch. + * @param ifMatch ETag of the Entity. Not required when creating an entity, but required when updating an entity + * @return the next update stage + */ + Update withIfMatch(String ifMatch); + } + + /** + * The stage of the openidconnectprovidercontract update allowing to specify ClientSecret. + */ + interface WithClientSecret { + /** + * Specifies clientSecret. + * @param clientSecret Client Secret of developer console which is the client application + * @return the next update stage + */ + Update withClientSecret(String clientSecret); + } + + /** + * The stage of the openidconnectprovidercontract update allowing to specify Description. + */ + interface WithDescription { + /** + * Specifies description. + * @param description User-friendly description of OpenID Connect Provider + * @return the next update stage + */ + Update withDescription(String description); + } + + } +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/OpenidConnectProviderUpdateContract.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/OpenidConnectProviderUpdateContract.java new file mode 100644 index 0000000000000..0002d83afd5d8 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/OpenidConnectProviderUpdateContract.java @@ -0,0 +1,149 @@ +/** + * 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.apimanagement.v2019_01_01; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; + +/** + * Parameters supplied to the Update OpenID Connect Provider operation. + */ +@JsonFlatten +public class OpenidConnectProviderUpdateContract { + /** + * User-friendly OpenID Connect Provider name. + */ + @JsonProperty(value = "properties.displayName") + private String displayName; + + /** + * User-friendly description of OpenID Connect Provider. + */ + @JsonProperty(value = "properties.description") + private String description; + + /** + * Metadata endpoint URI. + */ + @JsonProperty(value = "properties.metadataEndpoint") + private String metadataEndpoint; + + /** + * Client ID of developer console which is the client application. + */ + @JsonProperty(value = "properties.clientId") + private String clientId; + + /** + * Client Secret of developer console which is the client application. + */ + @JsonProperty(value = "properties.clientSecret") + private String clientSecret; + + /** + * Get user-friendly OpenID Connect Provider name. + * + * @return the displayName value + */ + public String displayName() { + return this.displayName; + } + + /** + * Set user-friendly OpenID Connect Provider name. + * + * @param displayName the displayName value to set + * @return the OpenidConnectProviderUpdateContract object itself. + */ + public OpenidConnectProviderUpdateContract withDisplayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Get user-friendly description of OpenID Connect Provider. + * + * @return the description value + */ + public String description() { + return this.description; + } + + /** + * Set user-friendly description of OpenID Connect Provider. + * + * @param description the description value to set + * @return the OpenidConnectProviderUpdateContract object itself. + */ + public OpenidConnectProviderUpdateContract withDescription(String description) { + this.description = description; + return this; + } + + /** + * Get metadata endpoint URI. + * + * @return the metadataEndpoint value + */ + public String metadataEndpoint() { + return this.metadataEndpoint; + } + + /** + * Set metadata endpoint URI. + * + * @param metadataEndpoint the metadataEndpoint value to set + * @return the OpenidConnectProviderUpdateContract object itself. + */ + public OpenidConnectProviderUpdateContract withMetadataEndpoint(String metadataEndpoint) { + this.metadataEndpoint = metadataEndpoint; + return this; + } + + /** + * Get client ID of developer console which is the client application. + * + * @return the clientId value + */ + public String clientId() { + return this.clientId; + } + + /** + * Set client ID of developer console which is the client application. + * + * @param clientId the clientId value to set + * @return the OpenidConnectProviderUpdateContract object itself. + */ + public OpenidConnectProviderUpdateContract withClientId(String clientId) { + this.clientId = clientId; + return this; + } + + /** + * Get client Secret of developer console which is the client application. + * + * @return the clientSecret value + */ + public String clientSecret() { + return this.clientSecret; + } + + /** + * Set client Secret of developer console which is the client application. + * + * @param clientSecret the clientSecret value to set + * @return the OpenidConnectProviderUpdateContract object itself. + */ + public OpenidConnectProviderUpdateContract withClientSecret(String clientSecret) { + this.clientSecret = clientSecret; + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/Operation.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/Operation.java new file mode 100644 index 0000000000000..e4050aed44952 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/Operation.java @@ -0,0 +1,40 @@ +/** + * 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.apimanagement.v2019_01_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.apimanagement.v2019_01_01.implementation.ApiManagementManager; +import com.microsoft.azure.management.apimanagement.v2019_01_01.implementation.OperationInner; + +/** + * Type representing Operation. + */ +public interface Operation extends HasInner, HasManager { + /** + * @return the display value. + */ + OperationDisplay display(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the origin value. + */ + String origin(); + + /** + * @return the properties value. + */ + Object properties(); + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/OperationApiPolicyContract.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/OperationApiPolicyContract.java new file mode 100644 index 0000000000000..7a30d235548bb --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/OperationApiPolicyContract.java @@ -0,0 +1,160 @@ +/** + * 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.apimanagement.v2019_01_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.apimanagement.v2019_01_01.implementation.PolicyContractInner; +import com.microsoft.azure.arm.model.Indexable; +import com.microsoft.azure.arm.model.Refreshable; +import com.microsoft.azure.arm.model.Updatable; +import com.microsoft.azure.arm.model.Appliable; +import com.microsoft.azure.arm.model.Creatable; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.apimanagement.v2019_01_01.implementation.ApiManagementManager; + +/** + * Type representing OperationApiPolicyContract. + */ +public interface OperationApiPolicyContract extends HasInner, Indexable, Refreshable, Updatable, HasManager { + /** + * @return the format value. + */ + PolicyContentFormat format(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the type value. + */ + String type(); + + /** + * @return the value value. + */ + String value(); + + /** + * The entirety of the OperationApiPolicyContract definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithOperation, DefinitionStages.WithIfMatch, DefinitionStages.WithValue, DefinitionStages.WithCreate { + } + + /** + * Grouping of OperationApiPolicyContract definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a OperationApiPolicyContract definition. + */ + interface Blank extends WithOperation { + } + + /** + * The stage of the operationapipolicycontract definition allowing to specify Operation. + */ + interface WithOperation { + /** + * Specifies resourceGroupName, serviceName, apiId, operationId. + * @param resourceGroupName The name of the resource group + * @param serviceName The name of the API Management service + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number + * @param operationId Operation identifier within an API. Must be unique in the current API Management service instance + * @return the next definition stage + */ + WithIfMatch withExistingOperation(String resourceGroupName, String serviceName, String apiId, String operationId); + } + + /** + * The stage of the operationapipolicycontract definition allowing to specify IfMatch. + */ + interface WithIfMatch { + /** + * Specifies ifMatch. + * @param ifMatch ETag of the Entity. Not required when creating an entity, but required when updating an entity + * @return the next definition stage + */ + WithValue withIfMatch(String ifMatch); + } + + /** + * The stage of the operationapipolicycontract definition allowing to specify Value. + */ + interface WithValue { + /** + * Specifies value. + * @param value Contents of the Policy as defined by the format + * @return the next definition stage + */ + WithCreate withValue(String value); + } + + /** + * The stage of the operationapipolicycontract definition allowing to specify Format. + */ + interface WithFormat { + /** + * Specifies format. + * @param format Format of the policyContent. Possible values include: 'xml', 'xml-link', 'rawxml', 'rawxml-link' + * @return the next definition stage + */ + WithCreate withFormat(PolicyContentFormat format); + } + + /** + * The stage of the definition which contains all the minimum required inputs for + * the resource to be created (via {@link WithCreate#create()}), but also allows + * for any other optional settings to be specified. + */ + interface WithCreate extends Creatable, DefinitionStages.WithFormat { + } + } + /** + * The template for a OperationApiPolicyContract update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithIfMatch, UpdateStages.WithFormat { + } + + /** + * Grouping of OperationApiPolicyContract update stages. + */ + interface UpdateStages { + /** + * The stage of the operationapipolicycontract update allowing to specify IfMatch. + */ + interface WithIfMatch { + /** + * Specifies ifMatch. + * @param ifMatch ETag of the Entity. Not required when creating an entity, but required when updating an entity + * @return the next update stage + */ + Update withIfMatch(String ifMatch); + } + + /** + * The stage of the operationapipolicycontract update allowing to specify Format. + */ + interface WithFormat { + /** + * Specifies format. + * @param format Format of the policyContent. Possible values include: 'xml', 'xml-link', 'rawxml', 'rawxml-link' + * @return the next update stage + */ + Update withFormat(PolicyContentFormat format); + } + + } +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/OperationContract.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/OperationContract.java new file mode 100644 index 0000000000000..55836147cde3e --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/OperationContract.java @@ -0,0 +1,310 @@ +/** + * 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.apimanagement.v2019_01_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.apimanagement.v2019_01_01.implementation.OperationContractInner; +import com.microsoft.azure.arm.model.Indexable; +import com.microsoft.azure.arm.model.Refreshable; +import com.microsoft.azure.arm.model.Updatable; +import com.microsoft.azure.arm.model.Appliable; +import com.microsoft.azure.arm.model.Creatable; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.apimanagement.v2019_01_01.implementation.ApiManagementManager; +import java.util.List; + +/** + * Type representing OperationContract. + */ +public interface OperationContract extends HasInner, Indexable, Refreshable, Updatable, HasManager { + /** + * @return the description value. + */ + String description(); + + /** + * @return the displayName value. + */ + String displayName(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the method value. + */ + String method(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the policies value. + */ + String policies(); + + /** + * @return the request value. + */ + RequestContract request(); + + /** + * @return the responses value. + */ + List responses(); + + /** + * @return the templateParameters value. + */ + List templateParameters(); + + /** + * @return the type value. + */ + String type(); + + /** + * @return the urlTemplate value. + */ + String urlTemplate(); + + /** + * The entirety of the OperationContract definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithApi, DefinitionStages.WithIfMatch, DefinitionStages.WithDisplayName, DefinitionStages.WithMethod, DefinitionStages.WithUrlTemplate, DefinitionStages.WithCreate { + } + + /** + * Grouping of OperationContract definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a OperationContract definition. + */ + interface Blank extends WithApi { + } + + /** + * The stage of the operationcontract definition allowing to specify Api. + */ + interface WithApi { + /** + * Specifies resourceGroupName, serviceName, apiId. + * @param resourceGroupName The name of the resource group + * @param serviceName The name of the API Management service + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number + * @return the next definition stage + */ + WithIfMatch withExistingApi(String resourceGroupName, String serviceName, String apiId); + } + + /** + * The stage of the operationcontract definition allowing to specify IfMatch. + */ + interface WithIfMatch { + /** + * Specifies ifMatch. + * @param ifMatch ETag of the Entity. Not required when creating an entity, but required when updating an entity + * @return the next definition stage + */ + WithDisplayName withIfMatch(String ifMatch); + } + + /** + * The stage of the operationcontract definition allowing to specify DisplayName. + */ + interface WithDisplayName { + /** + * Specifies displayName. + * @param displayName Operation Name + * @return the next definition stage + */ + WithMethod withDisplayName(String displayName); + } + + /** + * The stage of the operationcontract definition allowing to specify Method. + */ + interface WithMethod { + /** + * Specifies method. + * @param method A Valid HTTP Operation Method. Typical Http Methods like GET, PUT, POST but not limited by only them + * @return the next definition stage + */ + WithUrlTemplate withMethod(String method); + } + + /** + * The stage of the operationcontract definition allowing to specify UrlTemplate. + */ + interface WithUrlTemplate { + /** + * Specifies urlTemplate. + * @param urlTemplate Relative URL template identifying the target resource for this operation. May include parameters. Example: /customers/{cid}/orders/{oid}/?date={date} + * @return the next definition stage + */ + WithCreate withUrlTemplate(String urlTemplate); + } + + /** + * The stage of the operationcontract definition allowing to specify Description. + */ + interface WithDescription { + /** + * Specifies description. + * @param description Description of the operation. May include HTML formatting tags + * @return the next definition stage + */ + WithCreate withDescription(String description); + } + + /** + * The stage of the operationcontract definition allowing to specify Policies. + */ + interface WithPolicies { + /** + * Specifies policies. + * @param policies Operation Policies + * @return the next definition stage + */ + WithCreate withPolicies(String policies); + } + + /** + * The stage of the operationcontract definition allowing to specify Request. + */ + interface WithRequest { + /** + * Specifies request. + * @param request An entity containing request details + * @return the next definition stage + */ + WithCreate withRequest(RequestContract request); + } + + /** + * The stage of the operationcontract definition allowing to specify Responses. + */ + interface WithResponses { + /** + * Specifies responses. + * @param responses Array of Operation responses + * @return the next definition stage + */ + WithCreate withResponses(List responses); + } + + /** + * The stage of the operationcontract definition allowing to specify TemplateParameters. + */ + interface WithTemplateParameters { + /** + * Specifies templateParameters. + * @param templateParameters Collection of URL template parameters + * @return the next definition stage + */ + WithCreate withTemplateParameters(List templateParameters); + } + + /** + * The stage of the definition which contains all the minimum required inputs for + * the resource to be created (via {@link WithCreate#create()}), but also allows + * for any other optional settings to be specified. + */ + interface WithCreate extends Creatable, DefinitionStages.WithDescription, DefinitionStages.WithPolicies, DefinitionStages.WithRequest, DefinitionStages.WithResponses, DefinitionStages.WithTemplateParameters { + } + } + /** + * The template for a OperationContract update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithIfMatch, UpdateStages.WithDescription, UpdateStages.WithPolicies, UpdateStages.WithRequest, UpdateStages.WithResponses, UpdateStages.WithTemplateParameters { + } + + /** + * Grouping of OperationContract update stages. + */ + interface UpdateStages { + /** + * The stage of the operationcontract update allowing to specify IfMatch. + */ + interface WithIfMatch { + /** + * Specifies ifMatch. + * @param ifMatch ETag of the Entity. Not required when creating an entity, but required when updating an entity + * @return the next update stage + */ + Update withIfMatch(String ifMatch); + } + + /** + * The stage of the operationcontract update allowing to specify Description. + */ + interface WithDescription { + /** + * Specifies description. + * @param description Description of the operation. May include HTML formatting tags + * @return the next update stage + */ + Update withDescription(String description); + } + + /** + * The stage of the operationcontract update allowing to specify Policies. + */ + interface WithPolicies { + /** + * Specifies policies. + * @param policies Operation Policies + * @return the next update stage + */ + Update withPolicies(String policies); + } + + /** + * The stage of the operationcontract update allowing to specify Request. + */ + interface WithRequest { + /** + * Specifies request. + * @param request An entity containing request details + * @return the next update stage + */ + Update withRequest(RequestContract request); + } + + /** + * The stage of the operationcontract update allowing to specify Responses. + */ + interface WithResponses { + /** + * Specifies responses. + * @param responses Array of Operation responses + * @return the next update stage + */ + Update withResponses(List responses); + } + + /** + * The stage of the operationcontract update allowing to specify TemplateParameters. + */ + interface WithTemplateParameters { + /** + * Specifies templateParameters. + * @param templateParameters Collection of URL template parameters + * @return the next update stage + */ + Update withTemplateParameters(List templateParameters); + } + + } +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/OperationDisplay.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/OperationDisplay.java new file mode 100644 index 0000000000000..45bfceae9c073 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/OperationDisplay.java @@ -0,0 +1,121 @@ +/** + * 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.apimanagement.v2019_01_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The object that describes the operation. + */ +public class OperationDisplay { + /** + * Friendly name of the resource provider. + */ + @JsonProperty(value = "provider") + private String provider; + + /** + * Operation type: read, write, delete, listKeys/action, etc. + */ + @JsonProperty(value = "operation") + private String operation; + + /** + * Resource type on which the operation is performed. + */ + @JsonProperty(value = "resource") + private String resource; + + /** + * Friendly name of the operation. + */ + @JsonProperty(value = "description") + private String description; + + /** + * Get friendly name of the resource provider. + * + * @return the provider value + */ + public String provider() { + return this.provider; + } + + /** + * Set friendly name of the resource provider. + * + * @param provider the provider value to set + * @return the OperationDisplay object itself. + */ + public OperationDisplay withProvider(String provider) { + this.provider = provider; + return this; + } + + /** + * Get operation type: read, write, delete, listKeys/action, etc. + * + * @return the operation value + */ + public String operation() { + return this.operation; + } + + /** + * Set operation type: read, write, delete, listKeys/action, etc. + * + * @param operation the operation value to set + * @return the OperationDisplay object itself. + */ + public OperationDisplay withOperation(String operation) { + this.operation = operation; + return this; + } + + /** + * Get resource type on which the operation is performed. + * + * @return the resource value + */ + public String resource() { + return this.resource; + } + + /** + * Set resource type on which the operation is performed. + * + * @param resource the resource value to set + * @return the OperationDisplay object itself. + */ + public OperationDisplay withResource(String resource) { + this.resource = resource; + return this; + } + + /** + * Get friendly name of the operation. + * + * @return the description value + */ + public String description() { + return this.description; + } + + /** + * Set friendly name of the operation. + * + * @param description the description value to set + * @return the OperationDisplay object itself. + */ + public OperationDisplay withDescription(String description) { + this.description = description; + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/OperationEntityBaseContract.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/OperationEntityBaseContract.java new file mode 100644 index 0000000000000..03f6075b17a35 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/OperationEntityBaseContract.java @@ -0,0 +1,148 @@ +/** + * 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.apimanagement.v2019_01_01; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Api Operation Entity Base Contract details. + */ +public class OperationEntityBaseContract { + /** + * Collection of URL template parameters. + */ + @JsonProperty(value = "templateParameters") + private List templateParameters; + + /** + * Description of the operation. May include HTML formatting tags. + */ + @JsonProperty(value = "description") + private String description; + + /** + * An entity containing request details. + */ + @JsonProperty(value = "request") + private RequestContract request; + + /** + * Array of Operation responses. + */ + @JsonProperty(value = "responses") + private List responses; + + /** + * Operation Policies. + */ + @JsonProperty(value = "policies") + private String policies; + + /** + * Get collection of URL template parameters. + * + * @return the templateParameters value + */ + public List templateParameters() { + return this.templateParameters; + } + + /** + * Set collection of URL template parameters. + * + * @param templateParameters the templateParameters value to set + * @return the OperationEntityBaseContract object itself. + */ + public OperationEntityBaseContract withTemplateParameters(List templateParameters) { + this.templateParameters = templateParameters; + return this; + } + + /** + * Get description of the operation. May include HTML formatting tags. + * + * @return the description value + */ + public String description() { + return this.description; + } + + /** + * Set description of the operation. May include HTML formatting tags. + * + * @param description the description value to set + * @return the OperationEntityBaseContract object itself. + */ + public OperationEntityBaseContract withDescription(String description) { + this.description = description; + return this; + } + + /** + * Get an entity containing request details. + * + * @return the request value + */ + public RequestContract request() { + return this.request; + } + + /** + * Set an entity containing request details. + * + * @param request the request value to set + * @return the OperationEntityBaseContract object itself. + */ + public OperationEntityBaseContract withRequest(RequestContract request) { + this.request = request; + return this; + } + + /** + * Get array of Operation responses. + * + * @return the responses value + */ + public List responses() { + return this.responses; + } + + /** + * Set array of Operation responses. + * + * @param responses the responses value to set + * @return the OperationEntityBaseContract object itself. + */ + public OperationEntityBaseContract withResponses(List responses) { + this.responses = responses; + return this; + } + + /** + * Get operation Policies. + * + * @return the policies value + */ + public String policies() { + return this.policies; + } + + /** + * Set operation Policies. + * + * @param policies the policies value to set + * @return the OperationEntityBaseContract object itself. + */ + public OperationEntityBaseContract withPolicies(String policies) { + this.policies = policies; + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/OperationResultContract.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/OperationResultContract.java new file mode 100644 index 0000000000000..cb713ee149bfe --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/OperationResultContract.java @@ -0,0 +1,57 @@ +/** + * 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.apimanagement.v2019_01_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.apimanagement.v2019_01_01.implementation.ApiManagementManager; +import com.microsoft.azure.management.apimanagement.v2019_01_01.implementation.OperationResultContractInner; +import java.util.List; +import org.joda.time.DateTime; + +/** + * Type representing OperationResultContract. + */ +public interface OperationResultContract extends HasInner, HasManager { + /** + * @return the actionLog value. + */ + List actionLog(); + + /** + * @return the error value. + */ + ErrorResponseBody error(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the resultInfo value. + */ + String resultInfo(); + + /** + * @return the started value. + */ + DateTime started(); + + /** + * @return the status value. + */ + AsyncOperationStatus status(); + + /** + * @return the updated value. + */ + DateTime updated(); + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/OperationResultLogItemContract.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/OperationResultLogItemContract.java new file mode 100644 index 0000000000000..3bcb3fd156b72 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/OperationResultLogItemContract.java @@ -0,0 +1,95 @@ +/** + * 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.apimanagement.v2019_01_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Log of the entity being created, updated or deleted. + */ +public class OperationResultLogItemContract { + /** + * The type of entity contract. + */ + @JsonProperty(value = "objectType") + private String objectType; + + /** + * Action like create/update/delete. + */ + @JsonProperty(value = "action") + private String action; + + /** + * Identifier of the entity being created/updated/deleted. + */ + @JsonProperty(value = "objectKey") + private String objectKey; + + /** + * Get the type of entity contract. + * + * @return the objectType value + */ + public String objectType() { + return this.objectType; + } + + /** + * Set the type of entity contract. + * + * @param objectType the objectType value to set + * @return the OperationResultLogItemContract object itself. + */ + public OperationResultLogItemContract withObjectType(String objectType) { + this.objectType = objectType; + return this; + } + + /** + * Get action like create/update/delete. + * + * @return the action value + */ + public String action() { + return this.action; + } + + /** + * Set action like create/update/delete. + * + * @param action the action value to set + * @return the OperationResultLogItemContract object itself. + */ + public OperationResultLogItemContract withAction(String action) { + this.action = action; + return this; + } + + /** + * Get identifier of the entity being created/updated/deleted. + * + * @return the objectKey value + */ + public String objectKey() { + return this.objectKey; + } + + /** + * Set identifier of the entity being created/updated/deleted. + * + * @param objectKey the objectKey value to set + * @return the OperationResultLogItemContract object itself. + */ + public OperationResultLogItemContract withObjectKey(String objectKey) { + this.objectKey = objectKey; + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/OperationTagResourceContractProperties.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/OperationTagResourceContractProperties.java new file mode 100644 index 0000000000000..cf7fd66147412 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/OperationTagResourceContractProperties.java @@ -0,0 +1,151 @@ +/** + * 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.apimanagement.v2019_01_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Operation Entity contract Properties. + */ +public class OperationTagResourceContractProperties { + /** + * Identifier of the operation in form /operations/{operationId}. + */ + @JsonProperty(value = "id") + private String id; + + /** + * Operation name. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /** + * Api Name. + */ + @JsonProperty(value = "apiName", access = JsonProperty.Access.WRITE_ONLY) + private String apiName; + + /** + * Api Revision. + */ + @JsonProperty(value = "apiRevision", access = JsonProperty.Access.WRITE_ONLY) + private String apiRevision; + + /** + * Api Version. + */ + @JsonProperty(value = "apiVersion", access = JsonProperty.Access.WRITE_ONLY) + private String apiVersion; + + /** + * Operation Description. + */ + @JsonProperty(value = "description", access = JsonProperty.Access.WRITE_ONLY) + private String description; + + /** + * A Valid HTTP Operation Method. Typical Http Methods like GET, PUT, POST + * but not limited by only them. + */ + @JsonProperty(value = "method", access = JsonProperty.Access.WRITE_ONLY) + private String method; + + /** + * Relative URL template identifying the target resource for this + * operation. May include parameters. Example: + * /customers/{cid}/orders/{oid}/?date={date}. + */ + @JsonProperty(value = "urlTemplate", access = JsonProperty.Access.WRITE_ONLY) + private String urlTemplate; + + /** + * Get identifier of the operation in form /operations/{operationId}. + * + * @return the id value + */ + public String id() { + return this.id; + } + + /** + * Set identifier of the operation in form /operations/{operationId}. + * + * @param id the id value to set + * @return the OperationTagResourceContractProperties object itself. + */ + public OperationTagResourceContractProperties withId(String id) { + this.id = id; + return this; + } + + /** + * Get operation name. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Get api Name. + * + * @return the apiName value + */ + public String apiName() { + return this.apiName; + } + + /** + * Get api Revision. + * + * @return the apiRevision value + */ + public String apiRevision() { + return this.apiRevision; + } + + /** + * Get api Version. + * + * @return the apiVersion value + */ + public String apiVersion() { + return this.apiVersion; + } + + /** + * Get operation Description. + * + * @return the description value + */ + public String description() { + return this.description; + } + + /** + * Get a Valid HTTP Operation Method. Typical Http Methods like GET, PUT, POST but not limited by only them. + * + * @return the method value + */ + public String method() { + return this.method; + } + + /** + * Get relative URL template identifying the target resource for this operation. May include parameters. Example: /customers/{cid}/orders/{oid}/?date={date}. + * + * @return the urlTemplate value + */ + public String urlTemplate() { + return this.urlTemplate; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/OperationUpdateContract.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/OperationUpdateContract.java new file mode 100644 index 0000000000000..1f5f50fe5c1c8 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/OperationUpdateContract.java @@ -0,0 +1,231 @@ +/** + * 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.apimanagement.v2019_01_01; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; + +/** + * Api Operation Update Contract details. + */ +@JsonFlatten +public class OperationUpdateContract { + /** + * Collection of URL template parameters. + */ + @JsonProperty(value = "properties.templateParameters") + private List templateParameters; + + /** + * Description of the operation. May include HTML formatting tags. + */ + @JsonProperty(value = "properties.description") + private String description; + + /** + * An entity containing request details. + */ + @JsonProperty(value = "properties.request") + private RequestContract request; + + /** + * Array of Operation responses. + */ + @JsonProperty(value = "properties.responses") + private List responses; + + /** + * Operation Policies. + */ + @JsonProperty(value = "properties.policies") + private String policies; + + /** + * Operation Name. + */ + @JsonProperty(value = "properties.displayName") + private String displayName; + + /** + * A Valid HTTP Operation Method. Typical Http Methods like GET, PUT, POST + * but not limited by only them. + */ + @JsonProperty(value = "properties.method") + private String method; + + /** + * Relative URL template identifying the target resource for this + * operation. May include parameters. Example: + * /customers/{cid}/orders/{oid}/?date={date}. + */ + @JsonProperty(value = "properties.urlTemplate") + private String urlTemplate; + + /** + * Get collection of URL template parameters. + * + * @return the templateParameters value + */ + public List templateParameters() { + return this.templateParameters; + } + + /** + * Set collection of URL template parameters. + * + * @param templateParameters the templateParameters value to set + * @return the OperationUpdateContract object itself. + */ + public OperationUpdateContract withTemplateParameters(List templateParameters) { + this.templateParameters = templateParameters; + return this; + } + + /** + * Get description of the operation. May include HTML formatting tags. + * + * @return the description value + */ + public String description() { + return this.description; + } + + /** + * Set description of the operation. May include HTML formatting tags. + * + * @param description the description value to set + * @return the OperationUpdateContract object itself. + */ + public OperationUpdateContract withDescription(String description) { + this.description = description; + return this; + } + + /** + * Get an entity containing request details. + * + * @return the request value + */ + public RequestContract request() { + return this.request; + } + + /** + * Set an entity containing request details. + * + * @param request the request value to set + * @return the OperationUpdateContract object itself. + */ + public OperationUpdateContract withRequest(RequestContract request) { + this.request = request; + return this; + } + + /** + * Get array of Operation responses. + * + * @return the responses value + */ + public List responses() { + return this.responses; + } + + /** + * Set array of Operation responses. + * + * @param responses the responses value to set + * @return the OperationUpdateContract object itself. + */ + public OperationUpdateContract withResponses(List responses) { + this.responses = responses; + return this; + } + + /** + * Get operation Policies. + * + * @return the policies value + */ + public String policies() { + return this.policies; + } + + /** + * Set operation Policies. + * + * @param policies the policies value to set + * @return the OperationUpdateContract object itself. + */ + public OperationUpdateContract withPolicies(String policies) { + this.policies = policies; + return this; + } + + /** + * Get operation Name. + * + * @return the displayName value + */ + public String displayName() { + return this.displayName; + } + + /** + * Set operation Name. + * + * @param displayName the displayName value to set + * @return the OperationUpdateContract object itself. + */ + public OperationUpdateContract withDisplayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Get a Valid HTTP Operation Method. Typical Http Methods like GET, PUT, POST but not limited by only them. + * + * @return the method value + */ + public String method() { + return this.method; + } + + /** + * Set a Valid HTTP Operation Method. Typical Http Methods like GET, PUT, POST but not limited by only them. + * + * @param method the method value to set + * @return the OperationUpdateContract object itself. + */ + public OperationUpdateContract withMethod(String method) { + this.method = method; + return this; + } + + /** + * Get relative URL template identifying the target resource for this operation. May include parameters. Example: /customers/{cid}/orders/{oid}/?date={date}. + * + * @return the urlTemplate value + */ + public String urlTemplate() { + return this.urlTemplate; + } + + /** + * Set relative URL template identifying the target resource for this operation. May include parameters. Example: /customers/{cid}/orders/{oid}/?date={date}. + * + * @param urlTemplate the urlTemplate value to set + * @return the OperationUpdateContract object itself. + */ + public OperationUpdateContract withUrlTemplate(String urlTemplate) { + this.urlTemplate = urlTemplate; + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/Operations.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/Operations.java new file mode 100644 index 0000000000000..da018cae94f24 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/Operations.java @@ -0,0 +1,30 @@ +/** + * 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.apimanagement.v2019_01_01; + +import rx.Observable; +import com.microsoft.azure.management.apimanagement.v2019_01_01.implementation.OperationsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing Operations. + */ +public interface Operations extends HasInner { + /** + * Lists a collection of operations associated with tags. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByTagsAsync(final String resourceGroupName, final String serviceName, final String apiId); + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ParameterContract.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ParameterContract.java new file mode 100644 index 0000000000000..83d8aa6c22bd3 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ParameterContract.java @@ -0,0 +1,174 @@ +/** + * 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.apimanagement.v2019_01_01; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Operation parameters details. + */ +public class ParameterContract { + /** + * Parameter name. + */ + @JsonProperty(value = "name", required = true) + private String name; + + /** + * Parameter description. + */ + @JsonProperty(value = "description") + private String description; + + /** + * Parameter type. + */ + @JsonProperty(value = "type", required = true) + private String type; + + /** + * Default parameter value. + */ + @JsonProperty(value = "defaultValue") + private String defaultValue; + + /** + * Specifies whether parameter is required or not. + */ + @JsonProperty(value = "required") + private Boolean required; + + /** + * Parameter values. + */ + @JsonProperty(value = "values") + private List values; + + /** + * Get parameter name. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set parameter name. + * + * @param name the name value to set + * @return the ParameterContract object itself. + */ + public ParameterContract withName(String name) { + this.name = name; + return this; + } + + /** + * Get parameter description. + * + * @return the description value + */ + public String description() { + return this.description; + } + + /** + * Set parameter description. + * + * @param description the description value to set + * @return the ParameterContract object itself. + */ + public ParameterContract withDescription(String description) { + this.description = description; + return this; + } + + /** + * Get parameter type. + * + * @return the type value + */ + public String type() { + return this.type; + } + + /** + * Set parameter type. + * + * @param type the type value to set + * @return the ParameterContract object itself. + */ + public ParameterContract withType(String type) { + this.type = type; + return this; + } + + /** + * Get default parameter value. + * + * @return the defaultValue value + */ + public String defaultValue() { + return this.defaultValue; + } + + /** + * Set default parameter value. + * + * @param defaultValue the defaultValue value to set + * @return the ParameterContract object itself. + */ + public ParameterContract withDefaultValue(String defaultValue) { + this.defaultValue = defaultValue; + return this; + } + + /** + * Get specifies whether parameter is required or not. + * + * @return the required value + */ + public Boolean required() { + return this.required; + } + + /** + * Set specifies whether parameter is required or not. + * + * @param required the required value to set + * @return the ParameterContract object itself. + */ + public ParameterContract withRequired(Boolean required) { + this.required = required; + return this; + } + + /** + * Get parameter values. + * + * @return the values value + */ + public List values() { + return this.values; + } + + /** + * Set parameter values. + * + * @param values the values value to set + * @return the ParameterContract object itself. + */ + public ParameterContract withValues(List values) { + this.values = values; + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/PipelineDiagnosticSettings.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/PipelineDiagnosticSettings.java new file mode 100644 index 0000000000000..397882bd22bbe --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/PipelineDiagnosticSettings.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.apimanagement.v2019_01_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Diagnostic settings for incoming/outgoing HTTP messages to the Gateway. + */ +public class PipelineDiagnosticSettings { + /** + * Diagnostic settings for request. + */ + @JsonProperty(value = "request") + private HttpMessageDiagnostic request; + + /** + * Diagnostic settings for response. + */ + @JsonProperty(value = "response") + private HttpMessageDiagnostic response; + + /** + * Get diagnostic settings for request. + * + * @return the request value + */ + public HttpMessageDiagnostic request() { + return this.request; + } + + /** + * Set diagnostic settings for request. + * + * @param request the request value to set + * @return the PipelineDiagnosticSettings object itself. + */ + public PipelineDiagnosticSettings withRequest(HttpMessageDiagnostic request) { + this.request = request; + return this; + } + + /** + * Get diagnostic settings for response. + * + * @return the response value + */ + public HttpMessageDiagnostic response() { + return this.response; + } + + /** + * Set diagnostic settings for response. + * + * @param response the response value to set + * @return the PipelineDiagnosticSettings object itself. + */ + public PipelineDiagnosticSettings withResponse(HttpMessageDiagnostic response) { + this.response = response; + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/PolicyCollection.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/PolicyCollection.java new file mode 100644 index 0000000000000..0d7397cea328f --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/PolicyCollection.java @@ -0,0 +1,32 @@ +/** + * 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.apimanagement.v2019_01_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.apimanagement.v2019_01_01.implementation.ApiManagementManager; +import com.microsoft.azure.management.apimanagement.v2019_01_01.implementation.PolicyCollectionInner; +import com.microsoft.azure.management.apimanagement.v2019_01_01.implementation.PolicyContractInner; +import java.util.List; + +/** + * Type representing PolicyCollection. + */ +public interface PolicyCollection extends HasInner, HasManager { + /** + * @return the nextLink value. + */ + String nextLink(); + + /** + * @return the value value. + */ + List value(); + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/PolicyContentFormat.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/PolicyContentFormat.java new file mode 100644 index 0000000000000..d462a9a0184e6 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/PolicyContentFormat.java @@ -0,0 +1,47 @@ +/** + * 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.apimanagement.v2019_01_01; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for PolicyContentFormat. + */ +public final class PolicyContentFormat extends ExpandableStringEnum { + /** Static value xml for PolicyContentFormat. */ + public static final PolicyContentFormat XML = fromString("xml"); + + /** Static value xml-link for PolicyContentFormat. */ + public static final PolicyContentFormat XML_LINK = fromString("xml-link"); + + /** Static value rawxml for PolicyContentFormat. */ + public static final PolicyContentFormat RAWXML = fromString("rawxml"); + + /** Static value rawxml-link for PolicyContentFormat. */ + public static final PolicyContentFormat RAWXML_LINK = fromString("rawxml-link"); + + /** + * Creates or finds a PolicyContentFormat from its string representation. + * @param name a name to look for + * @return the corresponding PolicyContentFormat + */ + @JsonCreator + public static PolicyContentFormat fromString(String name) { + return fromString(name, PolicyContentFormat.class); + } + + /** + * @return known PolicyContentFormat values + */ + public static Collection values() { + return values(PolicyContentFormat.class); + } +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/PolicyContract.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/PolicyContract.java new file mode 100644 index 0000000000000..e3fb3762b71b3 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/PolicyContract.java @@ -0,0 +1,168 @@ +/** + * 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.apimanagement.v2019_01_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.apimanagement.v2019_01_01.implementation.PolicyContractInner; +import com.microsoft.azure.arm.model.Indexable; +import com.microsoft.azure.arm.model.Creatable; +import com.microsoft.azure.arm.model.Updatable; +import com.microsoft.azure.arm.model.Appliable; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.apimanagement.v2019_01_01.implementation.ApiManagementManager; + +/** + * Type representing PolicyContract. + */ +public interface PolicyContract extends HasInner, Indexable, Updatable, HasManager { + /** + * @return the format value. + */ + PolicyContentFormat format(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the type value. + */ + String type(); + + /** + * @return the value value. + */ + String value(); + + /** + * The entirety of the PolicyContract definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithResourceGroupName, DefinitionStages.WithServiceName, DefinitionStages.WithIfMatch, DefinitionStages.WithValue, DefinitionStages.WithCreate { + } + + /** + * Grouping of PolicyContract definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a PolicyContract definition. + */ + interface Blank extends WithResourceGroupName { + } + + /** + * The stage of the policycontract definition allowing to specify ResourceGroupName. + */ + interface WithResourceGroupName { + /** + * Specifies resourceGroupName. + * @param resourceGroupName The name of the resource group + * @return the next definition stage + */ + WithServiceName withResourceGroupName(String resourceGroupName); + } + + /** + * The stage of the policycontract definition allowing to specify ServiceName. + */ + interface WithServiceName { + /** + * Specifies serviceName. + * @param serviceName The name of the API Management service + * @return the next definition stage + */ + WithIfMatch withServiceName(String serviceName); + } + + /** + * The stage of the policycontract definition allowing to specify IfMatch. + */ + interface WithIfMatch { + /** + * Specifies ifMatch. + * @param ifMatch ETag of the Entity. Not required when creating an entity, but required when updating an entity + * @return the next definition stage + */ + WithValue withIfMatch(String ifMatch); + } + + /** + * The stage of the policycontract definition allowing to specify Value. + */ + interface WithValue { + /** + * Specifies value. + * @param value Contents of the Policy as defined by the format + * @return the next definition stage + */ + WithCreate withValue(String value); + } + + /** + * The stage of the policycontract definition allowing to specify Format. + */ + interface WithFormat { + /** + * Specifies format. + * @param format Format of the policyContent. Possible values include: 'xml', 'xml-link', 'rawxml', 'rawxml-link' + * @return the next definition stage + */ + WithCreate withFormat(PolicyContentFormat format); + } + + /** + * The stage of the definition which contains all the minimum required inputs for + * the resource to be created (via {@link WithCreate#create()}), but also allows + * for any other optional settings to be specified. + */ + interface WithCreate extends Creatable, DefinitionStages.WithFormat { + } + } + /** + * The template for a PolicyContract update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithIfMatch, UpdateStages.WithFormat { + } + + /** + * Grouping of PolicyContract update stages. + */ + interface UpdateStages { + /** + * The stage of the policycontract update allowing to specify IfMatch. + */ + interface WithIfMatch { + /** + * Specifies ifMatch. + * @param ifMatch ETag of the Entity. Not required when creating an entity, but required when updating an entity + * @return the next update stage + */ + Update withIfMatch(String ifMatch); + } + + /** + * The stage of the policycontract update allowing to specify Format. + */ + interface WithFormat { + /** + * Specifies format. + * @param format Format of the policyContent. Possible values include: 'xml', 'xml-link', 'rawxml', 'rawxml-link' + * @return the next update stage + */ + Update withFormat(PolicyContentFormat format); + } + + } +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/PolicyCreateOrUpdateHeaders.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/PolicyCreateOrUpdateHeaders.java new file mode 100644 index 0000000000000..4caea04bb7c25 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/PolicyCreateOrUpdateHeaders.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.apimanagement.v2019_01_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for CreateOrUpdate operation. + */ +public class PolicyCreateOrUpdateHeaders { + /** + * Current entity state version. Should be treated as opaque and used to + * make conditional HTTP requests. + */ + @JsonProperty(value = "ETag") + private String eTag; + + /** + * Get current entity state version. Should be treated as opaque and used to make conditional HTTP requests. + * + * @return the eTag value + */ + public String eTag() { + return this.eTag; + } + + /** + * Set current entity state version. Should be treated as opaque and used to make conditional HTTP requests. + * + * @param eTag the eTag value to set + * @return the PolicyCreateOrUpdateHeaders object itself. + */ + public PolicyCreateOrUpdateHeaders withETag(String eTag) { + this.eTag = eTag; + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/PolicyExportFormat.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/PolicyExportFormat.java new file mode 100644 index 0000000000000..4c1fdf035f613 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/PolicyExportFormat.java @@ -0,0 +1,41 @@ +/** + * 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.apimanagement.v2019_01_01; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for PolicyExportFormat. + */ +public final class PolicyExportFormat extends ExpandableStringEnum { + /** Static value xml for PolicyExportFormat. */ + public static final PolicyExportFormat XML = fromString("xml"); + + /** Static value rawxml for PolicyExportFormat. */ + public static final PolicyExportFormat RAWXML = fromString("rawxml"); + + /** + * Creates or finds a PolicyExportFormat from its string representation. + * @param name a name to look for + * @return the corresponding PolicyExportFormat + */ + @JsonCreator + public static PolicyExportFormat fromString(String name) { + return fromString(name, PolicyExportFormat.class); + } + + /** + * @return known PolicyExportFormat values + */ + public static Collection values() { + return values(PolicyExportFormat.class); + } +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/PolicyGetEntityTagHeaders.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/PolicyGetEntityTagHeaders.java new file mode 100644 index 0000000000000..9ec0458dc318c --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/PolicyGetEntityTagHeaders.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.apimanagement.v2019_01_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for GetEntityTag operation. + */ +public class PolicyGetEntityTagHeaders { + /** + * Current entity state version. Should be treated as opaque and used to + * make conditional HTTP requests. + */ + @JsonProperty(value = "ETag") + private String eTag; + + /** + * Get current entity state version. Should be treated as opaque and used to make conditional HTTP requests. + * + * @return the eTag value + */ + public String eTag() { + return this.eTag; + } + + /** + * Set current entity state version. Should be treated as opaque and used to make conditional HTTP requests. + * + * @param eTag the eTag value to set + * @return the PolicyGetEntityTagHeaders object itself. + */ + public PolicyGetEntityTagHeaders withETag(String eTag) { + this.eTag = eTag; + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/PolicyGetHeaders.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/PolicyGetHeaders.java new file mode 100644 index 0000000000000..bfa24e0055e2d --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/PolicyGetHeaders.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.apimanagement.v2019_01_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for Get operation. + */ +public class PolicyGetHeaders { + /** + * Current entity state version. Should be treated as opaque and used to + * make conditional HTTP requests. + */ + @JsonProperty(value = "ETag") + private String eTag; + + /** + * Get current entity state version. Should be treated as opaque and used to make conditional HTTP requests. + * + * @return the eTag value + */ + public String eTag() { + return this.eTag; + } + + /** + * Set current entity state version. Should be treated as opaque and used to make conditional HTTP requests. + * + * @param eTag the eTag value to set + * @return the PolicyGetHeaders object itself. + */ + public PolicyGetHeaders withETag(String eTag) { + this.eTag = eTag; + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/PolicyScopeContract.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/PolicyScopeContract.java new file mode 100644 index 0000000000000..59ca576e353d5 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/PolicyScopeContract.java @@ -0,0 +1,62 @@ +/** + * 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.apimanagement.v2019_01_01; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for PolicyScopeContract. + */ +public enum PolicyScopeContract { + /** Enum value Tenant. */ + TENANT("Tenant"), + + /** Enum value Product. */ + PRODUCT("Product"), + + /** Enum value Api. */ + API("Api"), + + /** Enum value Operation. */ + OPERATION("Operation"), + + /** Enum value All. */ + ALL("All"); + + /** The actual serialized value for a PolicyScopeContract instance. */ + private String value; + + PolicyScopeContract(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a PolicyScopeContract instance. + * + * @param value the serialized value to parse. + * @return the parsed PolicyScopeContract object, or null if unable to parse. + */ + @JsonCreator + public static PolicyScopeContract fromString(String value) { + PolicyScopeContract[] items = PolicyScopeContract.values(); + for (PolicyScopeContract item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/PolicySnippetContract.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/PolicySnippetContract.java new file mode 100644 index 0000000000000..989e259c3e3c4 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/PolicySnippetContract.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.apimanagement.v2019_01_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Policy snippet. + */ +public class PolicySnippetContract { + /** + * Snippet name. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /** + * Snippet content. + */ + @JsonProperty(value = "content", access = JsonProperty.Access.WRITE_ONLY) + private String content; + + /** + * Snippet toolTip. + */ + @JsonProperty(value = "toolTip", access = JsonProperty.Access.WRITE_ONLY) + private String toolTip; + + /** + * Binary OR value of the Snippet scope. + */ + @JsonProperty(value = "scope", access = JsonProperty.Access.WRITE_ONLY) + private Integer scope; + + /** + * Get snippet name. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Get snippet content. + * + * @return the content value + */ + public String content() { + return this.content; + } + + /** + * Get snippet toolTip. + * + * @return the toolTip value + */ + public String toolTip() { + return this.toolTip; + } + + /** + * Get binary OR value of the Snippet scope. + * + * @return the scope value + */ + public Integer scope() { + return this.scope; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/PolicySnippets.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/PolicySnippets.java new file mode 100644 index 0000000000000..67fc121f567ed --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/PolicySnippets.java @@ -0,0 +1,29 @@ +/** + * 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.apimanagement.v2019_01_01; + +import rx.Observable; +import com.microsoft.azure.management.apimanagement.v2019_01_01.implementation.PolicySnippetsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing PolicySnippets. + */ +public interface PolicySnippets extends HasInner { + /** + * Lists all policy snippets. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByServiceAsync(String resourceGroupName, String serviceName); + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/PolicySnippetsCollection.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/PolicySnippetsCollection.java new file mode 100644 index 0000000000000..225bf0ebc9a7a --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/PolicySnippetsCollection.java @@ -0,0 +1,26 @@ +/** + * 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.apimanagement.v2019_01_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.apimanagement.v2019_01_01.implementation.ApiManagementManager; +import com.microsoft.azure.management.apimanagement.v2019_01_01.implementation.PolicySnippetsCollectionInner; +import java.util.List; + +/** + * Type representing PolicySnippetsCollection. + */ +public interface PolicySnippetsCollection extends HasInner, HasManager { + /** + * @return the value value. + */ + List value(); + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/Policys.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/Policys.java new file mode 100644 index 0000000000000..7e415365efd20 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/Policys.java @@ -0,0 +1,62 @@ +/** + * 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.apimanagement.v2019_01_01; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import rx.Completable; +import rx.Observable; +import com.microsoft.azure.management.apimanagement.v2019_01_01.implementation.PolicysInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing Policys. + */ +public interface Policys extends SupportsCreating, HasInner { + /** + * Lists all the Global Policy definitions of the Api Management service. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByServiceAsync(String resourceGroupName, String serviceName); + + /** + * Gets the entity state (Etag) version of the Global policy definition in the Api Management service. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable getEntityTagAsync(String resourceGroupName, String serviceName); + + /** + * Get the Global policy definition of the Api Management service. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String resourceGroupName, String serviceName); + + /** + * Deletes the global policy configuration of the Api Management Service. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable deleteAsync(String resourceGroupName, String serviceName, String ifMatch); + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/PortalDelegationSettings.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/PortalDelegationSettings.java new file mode 100644 index 0000000000000..6c0267df89a8f --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/PortalDelegationSettings.java @@ -0,0 +1,55 @@ +/** + * 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.apimanagement.v2019_01_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.apimanagement.v2019_01_01.implementation.ApiManagementManager; +import com.microsoft.azure.management.apimanagement.v2019_01_01.implementation.PortalDelegationSettingsInner; + +/** + * Type representing PortalDelegationSettings. + */ +public interface PortalDelegationSettings extends HasInner, HasManager { + /** + * @return the id value. + */ + String id(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the subscriptions value. + */ + SubscriptionsDelegationSettingsProperties subscriptions(); + + /** + * @return the type value. + */ + String type(); + + /** + * @return the url value. + */ + String url(); + + /** + * @return the userRegistration value. + */ + RegistrationDelegationSettingsProperties userRegistration(); + + /** + * @return the validationKey value. + */ + String validationKey(); + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/PortalSigninSettings.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/PortalSigninSettings.java new file mode 100644 index 0000000000000..3bebce8c0df9f --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/PortalSigninSettings.java @@ -0,0 +1,40 @@ +/** + * 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.apimanagement.v2019_01_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.apimanagement.v2019_01_01.implementation.ApiManagementManager; +import com.microsoft.azure.management.apimanagement.v2019_01_01.implementation.PortalSigninSettingsInner; + +/** + * Type representing PortalSigninSettings. + */ +public interface PortalSigninSettings extends HasInner, HasManager { + /** + * @return the enabled value. + */ + Boolean enabled(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the type value. + */ + String type(); + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/PortalSignupSettings.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/PortalSignupSettings.java new file mode 100644 index 0000000000000..5d7acd0206503 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/PortalSignupSettings.java @@ -0,0 +1,45 @@ +/** + * 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.apimanagement.v2019_01_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.apimanagement.v2019_01_01.implementation.ApiManagementManager; +import com.microsoft.azure.management.apimanagement.v2019_01_01.implementation.PortalSignupSettingsInner; + +/** + * Type representing PortalSignupSettings. + */ +public interface PortalSignupSettings extends HasInner, HasManager { + /** + * @return the enabled value. + */ + Boolean enabled(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the termsOfService value. + */ + TermsOfServiceProperties termsOfService(); + + /** + * @return the type value. + */ + String type(); + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ProductApiContract.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ProductApiContract.java new file mode 100644 index 0000000000000..22d593451fa57 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ProductApiContract.java @@ -0,0 +1,179 @@ +/** + * 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.apimanagement.v2019_01_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.apimanagement.v2019_01_01.implementation.ApiContractInner; +import com.microsoft.azure.arm.model.Indexable; +import com.microsoft.azure.arm.model.Updatable; +import com.microsoft.azure.arm.model.Appliable; +import com.microsoft.azure.arm.model.Creatable; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.apimanagement.v2019_01_01.implementation.ApiManagementManager; +import java.util.List; + +/** + * Type representing ProductApiContract. + */ +public interface ProductApiContract extends HasInner, Indexable, Updatable, HasManager { + /** + * @return the apiRevision value. + */ + String apiRevision(); + + /** + * @return the apiRevisionDescription value. + */ + String apiRevisionDescription(); + + /** + * @return the apiType value. + */ + ApiType apiType(); + + /** + * @return the apiVersion value. + */ + String apiVersion(); + + /** + * @return the apiVersionDescription value. + */ + String apiVersionDescription(); + + /** + * @return the apiVersionSet value. + */ + ApiVersionSetContractDetails apiVersionSet(); + + /** + * @return the apiVersionSetId value. + */ + String apiVersionSetId(); + + /** + * @return the authenticationSettings value. + */ + AuthenticationSettingsContract authenticationSettings(); + + /** + * @return the description value. + */ + String description(); + + /** + * @return the displayName value. + */ + String displayName(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the isCurrent value. + */ + Boolean isCurrent(); + + /** + * @return the isOnline value. + */ + Boolean isOnline(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the path value. + */ + String path(); + + /** + * @return the protocols value. + */ + List protocols(); + + /** + * @return the serviceUrl value. + */ + String serviceUrl(); + + /** + * @return the sourceApiId value. + */ + String sourceApiId(); + + /** + * @return the subscriptionKeyParameterNames value. + */ + SubscriptionKeyParameterNamesContract subscriptionKeyParameterNames(); + + /** + * @return the subscriptionRequired value. + */ + Boolean subscriptionRequired(); + + /** + * @return the type value. + */ + String type(); + + /** + * The entirety of the ProductApiContract definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithProduct, DefinitionStages.WithCreate { + } + + /** + * Grouping of ProductApiContract definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a ProductApiContract definition. + */ + interface Blank extends WithProduct { + } + + /** + * The stage of the productapicontract definition allowing to specify Product. + */ + interface WithProduct { + /** + * Specifies resourceGroupName, serviceName, productId. + * @param resourceGroupName The name of the resource group + * @param serviceName The name of the API Management service + * @param productId Product identifier. Must be unique in the current API Management service instance + * @return the next definition stage + */ + WithCreate withExistingProduct(String resourceGroupName, String serviceName, String productId); + } + + /** + * The stage of the definition which contains all the minimum required inputs for + * the resource to be created (via {@link WithCreate#create()}), but also allows + * for any other optional settings to be specified. + */ + interface WithCreate extends Creatable { + } + } + /** + * The template for a ProductApiContract update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable { + } + + /** + * Grouping of ProductApiContract update stages. + */ + interface UpdateStages { + } +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ProductApis.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ProductApis.java new file mode 100644 index 0000000000000..2bc00f05399de --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ProductApis.java @@ -0,0 +1,56 @@ +/** + * 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.apimanagement.v2019_01_01; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import rx.Completable; +import rx.Observable; +import com.microsoft.azure.management.apimanagement.v2019_01_01.implementation.ProductApisInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing ProductApis. + */ +public interface ProductApis extends SupportsCreating, HasInner { + /** + * Checks that API entity specified by identifier is associated with the Product entity. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param productId Product identifier. Must be unique in the current API Management service instance. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable checkEntityExistsAsync(String resourceGroupName, String serviceName, String productId, String apiId); + + /** + * Lists a collection of the APIs associated with a product. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param productId Product identifier. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByProductAsync(final String resourceGroupName, final String serviceName, final String productId); + + /** + * Deletes the specified API from the specified product. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param productId Product identifier. Must be unique in the current API Management service instance. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable deleteAsync(String resourceGroupName, String serviceName, String productId, String apiId); + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ProductContract.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ProductContract.java new file mode 100644 index 0000000000000..fd7cf82745677 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ProductContract.java @@ -0,0 +1,313 @@ +/** + * 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.apimanagement.v2019_01_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.apimanagement.v2019_01_01.implementation.ProductContractInner; +import com.microsoft.azure.arm.model.Indexable; +import com.microsoft.azure.arm.model.Creatable; +import com.microsoft.azure.arm.model.Updatable; +import com.microsoft.azure.arm.model.Appliable; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.apimanagement.v2019_01_01.implementation.ApiManagementManager; + +/** + * Type representing ProductContract. + */ +public interface ProductContract extends HasInner, Indexable, Updatable, HasManager { + /** + * @return the approvalRequired value. + */ + Boolean approvalRequired(); + + /** + * @return the description value. + */ + String description(); + + /** + * @return the displayName value. + */ + String displayName(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the state value. + */ + ProductState state(); + + /** + * @return the subscriptionRequired value. + */ + Boolean subscriptionRequired(); + + /** + * @return the subscriptionsLimit value. + */ + Integer subscriptionsLimit(); + + /** + * @return the terms value. + */ + String terms(); + + /** + * @return the type value. + */ + String type(); + + /** + * The entirety of the ProductContract definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithResourceGroupName, DefinitionStages.WithServiceName, DefinitionStages.WithIfMatch, DefinitionStages.WithDisplayName, DefinitionStages.WithCreate { + } + + /** + * Grouping of ProductContract definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a ProductContract definition. + */ + interface Blank extends WithResourceGroupName { + } + + /** + * The stage of the productcontract definition allowing to specify ResourceGroupName. + */ + interface WithResourceGroupName { + /** + * Specifies resourceGroupName. + * @param resourceGroupName The name of the resource group + * @return the next definition stage + */ + WithServiceName withResourceGroupName(String resourceGroupName); + } + + /** + * The stage of the productcontract definition allowing to specify ServiceName. + */ + interface WithServiceName { + /** + * Specifies serviceName. + * @param serviceName The name of the API Management service + * @return the next definition stage + */ + WithIfMatch withServiceName(String serviceName); + } + + /** + * The stage of the productcontract definition allowing to specify IfMatch. + */ + interface WithIfMatch { + /** + * Specifies ifMatch. + * @param ifMatch ETag of the Entity. Not required when creating an entity, but required when updating an entity + * @return the next definition stage + */ + WithDisplayName withIfMatch(String ifMatch); + } + + /** + * The stage of the productcontract definition allowing to specify DisplayName. + */ + interface WithDisplayName { + /** + * Specifies displayName. + * @param displayName Product name + * @return the next definition stage + */ + WithCreate withDisplayName(String displayName); + } + + /** + * The stage of the productcontract definition allowing to specify ApprovalRequired. + */ + interface WithApprovalRequired { + /** + * Specifies approvalRequired. + * @param approvalRequired whether subscription approval is required. If false, new subscriptions will be approved automatically enabling developers to call the product’s APIs immediately after subscribing. If true, administrators must manually approve the subscription before the developer can any of the product’s APIs. Can be present only if subscriptionRequired property is present and has a value of false + * @return the next definition stage + */ + WithCreate withApprovalRequired(Boolean approvalRequired); + } + + /** + * The stage of the productcontract definition allowing to specify Description. + */ + interface WithDescription { + /** + * Specifies description. + * @param description Product description. May include HTML formatting tags + * @return the next definition stage + */ + WithCreate withDescription(String description); + } + + /** + * The stage of the productcontract definition allowing to specify State. + */ + interface WithState { + /** + * Specifies state. + * @param state whether product is published or not. Published products are discoverable by users of developer portal. Non published products are visible only to administrators. Default state of Product is notPublished. Possible values include: 'notPublished', 'published' + * @return the next definition stage + */ + WithCreate withState(ProductState state); + } + + /** + * The stage of the productcontract definition allowing to specify SubscriptionRequired. + */ + interface WithSubscriptionRequired { + /** + * Specifies subscriptionRequired. + * @param subscriptionRequired Whether a product subscription is required for accessing APIs included in this product. If true, the product is referred to as "protected" and a valid subscription key is required for a request to an API included in the product to succeed. If false, the product is referred to as "open" and requests to an API included in the product can be made without a subscription key. If property is omitted when creating a new product it's value is assumed to be true + * @return the next definition stage + */ + WithCreate withSubscriptionRequired(Boolean subscriptionRequired); + } + + /** + * The stage of the productcontract definition allowing to specify SubscriptionsLimit. + */ + interface WithSubscriptionsLimit { + /** + * Specifies subscriptionsLimit. + * @param subscriptionsLimit Whether the number of subscriptions a user can have to this product at the same time. Set to null or omit to allow unlimited per user subscriptions. Can be present only if subscriptionRequired property is present and has a value of false + * @return the next definition stage + */ + WithCreate withSubscriptionsLimit(Integer subscriptionsLimit); + } + + /** + * The stage of the productcontract definition allowing to specify Terms. + */ + interface WithTerms { + /** + * Specifies terms. + * @param terms Product terms of use. Developers trying to subscribe to the product will be presented and required to accept these terms before they can complete the subscription process + * @return the next definition stage + */ + WithCreate withTerms(String terms); + } + + /** + * The stage of the definition which contains all the minimum required inputs for + * the resource to be created (via {@link WithCreate#create()}), but also allows + * for any other optional settings to be specified. + */ + interface WithCreate extends Creatable, DefinitionStages.WithApprovalRequired, DefinitionStages.WithDescription, DefinitionStages.WithState, DefinitionStages.WithSubscriptionRequired, DefinitionStages.WithSubscriptionsLimit, DefinitionStages.WithTerms { + } + } + /** + * The template for a ProductContract update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithIfMatch, UpdateStages.WithApprovalRequired, UpdateStages.WithDescription, UpdateStages.WithState, UpdateStages.WithSubscriptionRequired, UpdateStages.WithSubscriptionsLimit, UpdateStages.WithTerms { + } + + /** + * Grouping of ProductContract update stages. + */ + interface UpdateStages { + /** + * The stage of the productcontract update allowing to specify IfMatch. + */ + interface WithIfMatch { + /** + * Specifies ifMatch. + * @param ifMatch ETag of the Entity. Not required when creating an entity, but required when updating an entity + * @return the next update stage + */ + Update withIfMatch(String ifMatch); + } + + /** + * The stage of the productcontract update allowing to specify ApprovalRequired. + */ + interface WithApprovalRequired { + /** + * Specifies approvalRequired. + * @param approvalRequired whether subscription approval is required. If false, new subscriptions will be approved automatically enabling developers to call the product’s APIs immediately after subscribing. If true, administrators must manually approve the subscription before the developer can any of the product’s APIs. Can be present only if subscriptionRequired property is present and has a value of false + * @return the next update stage + */ + Update withApprovalRequired(Boolean approvalRequired); + } + + /** + * The stage of the productcontract update allowing to specify Description. + */ + interface WithDescription { + /** + * Specifies description. + * @param description Product description. May include HTML formatting tags + * @return the next update stage + */ + Update withDescription(String description); + } + + /** + * The stage of the productcontract update allowing to specify State. + */ + interface WithState { + /** + * Specifies state. + * @param state whether product is published or not. Published products are discoverable by users of developer portal. Non published products are visible only to administrators. Default state of Product is notPublished. Possible values include: 'notPublished', 'published' + * @return the next update stage + */ + Update withState(ProductState state); + } + + /** + * The stage of the productcontract update allowing to specify SubscriptionRequired. + */ + interface WithSubscriptionRequired { + /** + * Specifies subscriptionRequired. + * @param subscriptionRequired Whether a product subscription is required for accessing APIs included in this product. If true, the product is referred to as "protected" and a valid subscription key is required for a request to an API included in the product to succeed. If false, the product is referred to as "open" and requests to an API included in the product can be made without a subscription key. If property is omitted when creating a new product it's value is assumed to be true + * @return the next update stage + */ + Update withSubscriptionRequired(Boolean subscriptionRequired); + } + + /** + * The stage of the productcontract update allowing to specify SubscriptionsLimit. + */ + interface WithSubscriptionsLimit { + /** + * Specifies subscriptionsLimit. + * @param subscriptionsLimit Whether the number of subscriptions a user can have to this product at the same time. Set to null or omit to allow unlimited per user subscriptions. Can be present only if subscriptionRequired property is present and has a value of false + * @return the next update stage + */ + Update withSubscriptionsLimit(Integer subscriptionsLimit); + } + + /** + * The stage of the productcontract update allowing to specify Terms. + */ + interface WithTerms { + /** + * Specifies terms. + * @param terms Product terms of use. Developers trying to subscribe to the product will be presented and required to accept these terms before they can complete the subscription process + * @return the next update stage + */ + Update withTerms(String terms); + } + + } +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ProductCreateOrUpdateHeaders.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ProductCreateOrUpdateHeaders.java new file mode 100644 index 0000000000000..ea41dbe22079f --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ProductCreateOrUpdateHeaders.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.apimanagement.v2019_01_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for CreateOrUpdate operation. + */ +public class ProductCreateOrUpdateHeaders { + /** + * Current entity state version. Should be treated as opaque and used to + * make conditional HTTP requests. + */ + @JsonProperty(value = "ETag") + private String eTag; + + /** + * Get current entity state version. Should be treated as opaque and used to make conditional HTTP requests. + * + * @return the eTag value + */ + public String eTag() { + return this.eTag; + } + + /** + * Set current entity state version. Should be treated as opaque and used to make conditional HTTP requests. + * + * @param eTag the eTag value to set + * @return the ProductCreateOrUpdateHeaders object itself. + */ + public ProductCreateOrUpdateHeaders withETag(String eTag) { + this.eTag = eTag; + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ProductEntityBaseParameters.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ProductEntityBaseParameters.java new file mode 100644 index 0000000000000..01c87927a6851 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ProductEntityBaseParameters.java @@ -0,0 +1,192 @@ +/** + * 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.apimanagement.v2019_01_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Product Entity Base Parameters. + */ +public class ProductEntityBaseParameters { + /** + * Product description. May include HTML formatting tags. + */ + @JsonProperty(value = "description") + private String description; + + /** + * Product terms of use. Developers trying to subscribe to the product will + * be presented and required to accept these terms before they can complete + * the subscription process. + */ + @JsonProperty(value = "terms") + private String terms; + + /** + * Whether a product subscription is required for accessing APIs included + * in this product. If true, the product is referred to as "protected" and + * a valid subscription key is required for a request to an API included in + * the product to succeed. If false, the product is referred to as "open" + * and requests to an API included in the product can be made without a + * subscription key. If property is omitted when creating a new product + * it's value is assumed to be true. + */ + @JsonProperty(value = "subscriptionRequired") + private Boolean subscriptionRequired; + + /** + * whether subscription approval is required. If false, new subscriptions + * will be approved automatically enabling developers to call the product’s + * APIs immediately after subscribing. If true, administrators must + * manually approve the subscription before the developer can any of the + * product’s APIs. Can be present only if subscriptionRequired property is + * present and has a value of false. + */ + @JsonProperty(value = "approvalRequired") + private Boolean approvalRequired; + + /** + * Whether the number of subscriptions a user can have to this product at + * the same time. Set to null or omit to allow unlimited per user + * subscriptions. Can be present only if subscriptionRequired property is + * present and has a value of false. + */ + @JsonProperty(value = "subscriptionsLimit") + private Integer subscriptionsLimit; + + /** + * whether product is published or not. Published products are discoverable + * by users of developer portal. Non published products are visible only to + * administrators. Default state of Product is notPublished. Possible + * values include: 'notPublished', 'published'. + */ + @JsonProperty(value = "state") + private ProductState state; + + /** + * Get product description. May include HTML formatting tags. + * + * @return the description value + */ + public String description() { + return this.description; + } + + /** + * Set product description. May include HTML formatting tags. + * + * @param description the description value to set + * @return the ProductEntityBaseParameters object itself. + */ + public ProductEntityBaseParameters withDescription(String description) { + this.description = description; + return this; + } + + /** + * Get product terms of use. Developers trying to subscribe to the product will be presented and required to accept these terms before they can complete the subscription process. + * + * @return the terms value + */ + public String terms() { + return this.terms; + } + + /** + * Set product terms of use. Developers trying to subscribe to the product will be presented and required to accept these terms before they can complete the subscription process. + * + * @param terms the terms value to set + * @return the ProductEntityBaseParameters object itself. + */ + public ProductEntityBaseParameters withTerms(String terms) { + this.terms = terms; + return this; + } + + /** + * Get whether a product subscription is required for accessing APIs included in this product. If true, the product is referred to as "protected" and a valid subscription key is required for a request to an API included in the product to succeed. If false, the product is referred to as "open" and requests to an API included in the product can be made without a subscription key. If property is omitted when creating a new product it's value is assumed to be true. + * + * @return the subscriptionRequired value + */ + public Boolean subscriptionRequired() { + return this.subscriptionRequired; + } + + /** + * Set whether a product subscription is required for accessing APIs included in this product. If true, the product is referred to as "protected" and a valid subscription key is required for a request to an API included in the product to succeed. If false, the product is referred to as "open" and requests to an API included in the product can be made without a subscription key. If property is omitted when creating a new product it's value is assumed to be true. + * + * @param subscriptionRequired the subscriptionRequired value to set + * @return the ProductEntityBaseParameters object itself. + */ + public ProductEntityBaseParameters withSubscriptionRequired(Boolean subscriptionRequired) { + this.subscriptionRequired = subscriptionRequired; + return this; + } + + /** + * Get whether subscription approval is required. If false, new subscriptions will be approved automatically enabling developers to call the product’s APIs immediately after subscribing. If true, administrators must manually approve the subscription before the developer can any of the product’s APIs. Can be present only if subscriptionRequired property is present and has a value of false. + * + * @return the approvalRequired value + */ + public Boolean approvalRequired() { + return this.approvalRequired; + } + + /** + * Set whether subscription approval is required. If false, new subscriptions will be approved automatically enabling developers to call the product’s APIs immediately after subscribing. If true, administrators must manually approve the subscription before the developer can any of the product’s APIs. Can be present only if subscriptionRequired property is present and has a value of false. + * + * @param approvalRequired the approvalRequired value to set + * @return the ProductEntityBaseParameters object itself. + */ + public ProductEntityBaseParameters withApprovalRequired(Boolean approvalRequired) { + this.approvalRequired = approvalRequired; + return this; + } + + /** + * Get whether the number of subscriptions a user can have to this product at the same time. Set to null or omit to allow unlimited per user subscriptions. Can be present only if subscriptionRequired property is present and has a value of false. + * + * @return the subscriptionsLimit value + */ + public Integer subscriptionsLimit() { + return this.subscriptionsLimit; + } + + /** + * Set whether the number of subscriptions a user can have to this product at the same time. Set to null or omit to allow unlimited per user subscriptions. Can be present only if subscriptionRequired property is present and has a value of false. + * + * @param subscriptionsLimit the subscriptionsLimit value to set + * @return the ProductEntityBaseParameters object itself. + */ + public ProductEntityBaseParameters withSubscriptionsLimit(Integer subscriptionsLimit) { + this.subscriptionsLimit = subscriptionsLimit; + return this; + } + + /** + * Get whether product is published or not. Published products are discoverable by users of developer portal. Non published products are visible only to administrators. Default state of Product is notPublished. Possible values include: 'notPublished', 'published'. + * + * @return the state value + */ + public ProductState state() { + return this.state; + } + + /** + * Set whether product is published or not. Published products are discoverable by users of developer portal. Non published products are visible only to administrators. Default state of Product is notPublished. Possible values include: 'notPublished', 'published'. + * + * @param state the state value to set + * @return the ProductEntityBaseParameters object itself. + */ + public ProductEntityBaseParameters withState(ProductState state) { + this.state = state; + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ProductGetEntityTagHeaders.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ProductGetEntityTagHeaders.java new file mode 100644 index 0000000000000..867962141d7ab --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ProductGetEntityTagHeaders.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.apimanagement.v2019_01_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for GetEntityTag operation. + */ +public class ProductGetEntityTagHeaders { + /** + * Current entity state version. Should be treated as opaque and used to + * make conditional HTTP requests. + */ + @JsonProperty(value = "ETag") + private String eTag; + + /** + * Get current entity state version. Should be treated as opaque and used to make conditional HTTP requests. + * + * @return the eTag value + */ + public String eTag() { + return this.eTag; + } + + /** + * Set current entity state version. Should be treated as opaque and used to make conditional HTTP requests. + * + * @param eTag the eTag value to set + * @return the ProductGetEntityTagHeaders object itself. + */ + public ProductGetEntityTagHeaders withETag(String eTag) { + this.eTag = eTag; + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ProductGetHeaders.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ProductGetHeaders.java new file mode 100644 index 0000000000000..00a1c6109bb16 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ProductGetHeaders.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.apimanagement.v2019_01_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for Get operation. + */ +public class ProductGetHeaders { + /** + * Current entity state version. Should be treated as opaque and used to + * make conditional HTTP requests. + */ + @JsonProperty(value = "ETag") + private String eTag; + + /** + * Get current entity state version. Should be treated as opaque and used to make conditional HTTP requests. + * + * @return the eTag value + */ + public String eTag() { + return this.eTag; + } + + /** + * Set current entity state version. Should be treated as opaque and used to make conditional HTTP requests. + * + * @param eTag the eTag value to set + * @return the ProductGetHeaders object itself. + */ + public ProductGetHeaders withETag(String eTag) { + this.eTag = eTag; + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ProductGroupContract.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ProductGroupContract.java new file mode 100644 index 0000000000000..eec7237b362f6 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ProductGroupContract.java @@ -0,0 +1,113 @@ +/** + * 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.apimanagement.v2019_01_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.apimanagement.v2019_01_01.implementation.GroupContractInner; +import com.microsoft.azure.arm.model.Indexable; +import com.microsoft.azure.arm.model.Updatable; +import com.microsoft.azure.arm.model.Appliable; +import com.microsoft.azure.arm.model.Creatable; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.apimanagement.v2019_01_01.implementation.ApiManagementManager; + +/** + * Type representing ProductGroupContract. + */ +public interface ProductGroupContract extends HasInner, Indexable, Updatable, HasManager { + /** + * @return the builtIn value. + */ + Boolean builtIn(); + + /** + * @return the description value. + */ + String description(); + + /** + * @return the displayName value. + */ + String displayName(); + + /** + * @return the externalId value. + */ + String externalId(); + + /** + * @return the groupContractType value. + */ + GroupType groupContractType(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the type value. + */ + String type(); + + /** + * The entirety of the ProductGroupContract definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithProduct, DefinitionStages.WithCreate { + } + + /** + * Grouping of ProductGroupContract definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a ProductGroupContract definition. + */ + interface Blank extends WithProduct { + } + + /** + * The stage of the productgroupcontract definition allowing to specify Product. + */ + interface WithProduct { + /** + * Specifies resourceGroupName, serviceName, productId. + * @param resourceGroupName The name of the resource group + * @param serviceName The name of the API Management service + * @param productId Product identifier. Must be unique in the current API Management service instance + * @return the next definition stage + */ + WithCreate withExistingProduct(String resourceGroupName, String serviceName, String productId); + } + + /** + * The stage of the definition which contains all the minimum required inputs for + * the resource to be created (via {@link WithCreate#create()}), but also allows + * for any other optional settings to be specified. + */ + interface WithCreate extends Creatable { + } + } + /** + * The template for a ProductGroupContract update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable { + } + + /** + * Grouping of ProductGroupContract update stages. + */ + interface UpdateStages { + } +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ProductGroups.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ProductGroups.java new file mode 100644 index 0000000000000..f29be9df88477 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ProductGroups.java @@ -0,0 +1,56 @@ +/** + * 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.apimanagement.v2019_01_01; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import rx.Completable; +import rx.Observable; +import com.microsoft.azure.management.apimanagement.v2019_01_01.implementation.ProductGroupsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing ProductGroups. + */ +public interface ProductGroups extends SupportsCreating, HasInner { + /** + * Checks that Group entity specified by identifier is associated with the Product entity. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param productId Product identifier. Must be unique in the current API Management service instance. + * @param groupId Group identifier. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable checkEntityExistsAsync(String resourceGroupName, String serviceName, String productId, String groupId); + + /** + * Lists the collection of developer groups associated with the specified product. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param productId Product identifier. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByProductAsync(final String resourceGroupName, final String serviceName, final String productId); + + /** + * Deletes the association between the specified group and product. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param productId Product identifier. Must be unique in the current API Management service instance. + * @param groupId Group identifier. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable deleteAsync(String resourceGroupName, String serviceName, String productId, String groupId); + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ProductPolicyContract.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ProductPolicyContract.java new file mode 100644 index 0000000000000..b7d6fd5acd32e --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ProductPolicyContract.java @@ -0,0 +1,159 @@ +/** + * 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.apimanagement.v2019_01_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.apimanagement.v2019_01_01.implementation.PolicyContractInner; +import com.microsoft.azure.arm.model.Indexable; +import com.microsoft.azure.arm.model.Refreshable; +import com.microsoft.azure.arm.model.Updatable; +import com.microsoft.azure.arm.model.Appliable; +import com.microsoft.azure.arm.model.Creatable; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.apimanagement.v2019_01_01.implementation.ApiManagementManager; + +/** + * Type representing ProductPolicyContract. + */ +public interface ProductPolicyContract extends HasInner, Indexable, Refreshable, Updatable, HasManager { + /** + * @return the format value. + */ + PolicyContentFormat format(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the type value. + */ + String type(); + + /** + * @return the value value. + */ + String value(); + + /** + * The entirety of the ProductPolicyContract definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithProduct, DefinitionStages.WithIfMatch, DefinitionStages.WithValue, DefinitionStages.WithCreate { + } + + /** + * Grouping of ProductPolicyContract definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a ProductPolicyContract definition. + */ + interface Blank extends WithProduct { + } + + /** + * The stage of the productpolicycontract definition allowing to specify Product. + */ + interface WithProduct { + /** + * Specifies resourceGroupName, serviceName, productId. + * @param resourceGroupName The name of the resource group + * @param serviceName The name of the API Management service + * @param productId Product identifier. Must be unique in the current API Management service instance + * @return the next definition stage + */ + WithIfMatch withExistingProduct(String resourceGroupName, String serviceName, String productId); + } + + /** + * The stage of the productpolicycontract definition allowing to specify IfMatch. + */ + interface WithIfMatch { + /** + * Specifies ifMatch. + * @param ifMatch ETag of the Entity. Not required when creating an entity, but required when updating an entity + * @return the next definition stage + */ + WithValue withIfMatch(String ifMatch); + } + + /** + * The stage of the productpolicycontract definition allowing to specify Value. + */ + interface WithValue { + /** + * Specifies value. + * @param value Contents of the Policy as defined by the format + * @return the next definition stage + */ + WithCreate withValue(String value); + } + + /** + * The stage of the productpolicycontract definition allowing to specify Format. + */ + interface WithFormat { + /** + * Specifies format. + * @param format Format of the policyContent. Possible values include: 'xml', 'xml-link', 'rawxml', 'rawxml-link' + * @return the next definition stage + */ + WithCreate withFormat(PolicyContentFormat format); + } + + /** + * The stage of the definition which contains all the minimum required inputs for + * the resource to be created (via {@link WithCreate#create()}), but also allows + * for any other optional settings to be specified. + */ + interface WithCreate extends Creatable, DefinitionStages.WithFormat { + } + } + /** + * The template for a ProductPolicyContract update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithIfMatch, UpdateStages.WithFormat { + } + + /** + * Grouping of ProductPolicyContract update stages. + */ + interface UpdateStages { + /** + * The stage of the productpolicycontract update allowing to specify IfMatch. + */ + interface WithIfMatch { + /** + * Specifies ifMatch. + * @param ifMatch ETag of the Entity. Not required when creating an entity, but required when updating an entity + * @return the next update stage + */ + Update withIfMatch(String ifMatch); + } + + /** + * The stage of the productpolicycontract update allowing to specify Format. + */ + interface WithFormat { + /** + * Specifies format. + * @param format Format of the policyContent. Possible values include: 'xml', 'xml-link', 'rawxml', 'rawxml-link' + * @return the next update stage + */ + Update withFormat(PolicyContentFormat format); + } + + } +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ProductPolicyCreateOrUpdateHeaders.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ProductPolicyCreateOrUpdateHeaders.java new file mode 100644 index 0000000000000..e027930f885a5 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ProductPolicyCreateOrUpdateHeaders.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.apimanagement.v2019_01_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for CreateOrUpdate operation. + */ +public class ProductPolicyCreateOrUpdateHeaders { + /** + * Current entity state version. Should be treated as opaque and used to + * make conditional HTTP requests. + */ + @JsonProperty(value = "ETag") + private String eTag; + + /** + * Get current entity state version. Should be treated as opaque and used to make conditional HTTP requests. + * + * @return the eTag value + */ + public String eTag() { + return this.eTag; + } + + /** + * Set current entity state version. Should be treated as opaque and used to make conditional HTTP requests. + * + * @param eTag the eTag value to set + * @return the ProductPolicyCreateOrUpdateHeaders object itself. + */ + public ProductPolicyCreateOrUpdateHeaders withETag(String eTag) { + this.eTag = eTag; + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ProductPolicyGetEntityTagHeaders.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ProductPolicyGetEntityTagHeaders.java new file mode 100644 index 0000000000000..6f678b666de48 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ProductPolicyGetEntityTagHeaders.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.apimanagement.v2019_01_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for GetEntityTag operation. + */ +public class ProductPolicyGetEntityTagHeaders { + /** + * Current entity state version. Should be treated as opaque and used to + * make conditional HTTP requests. + */ + @JsonProperty(value = "ETag") + private String eTag; + + /** + * Get current entity state version. Should be treated as opaque and used to make conditional HTTP requests. + * + * @return the eTag value + */ + public String eTag() { + return this.eTag; + } + + /** + * Set current entity state version. Should be treated as opaque and used to make conditional HTTP requests. + * + * @param eTag the eTag value to set + * @return the ProductPolicyGetEntityTagHeaders object itself. + */ + public ProductPolicyGetEntityTagHeaders withETag(String eTag) { + this.eTag = eTag; + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ProductPolicyGetHeaders.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ProductPolicyGetHeaders.java new file mode 100644 index 0000000000000..376608eb4f945 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ProductPolicyGetHeaders.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.apimanagement.v2019_01_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for Get operation. + */ +public class ProductPolicyGetHeaders { + /** + * Current entity state version. Should be treated as opaque and used to + * make conditional HTTP requests. + */ + @JsonProperty(value = "ETag") + private String eTag; + + /** + * Get current entity state version. Should be treated as opaque and used to make conditional HTTP requests. + * + * @return the eTag value + */ + public String eTag() { + return this.eTag; + } + + /** + * Set current entity state version. Should be treated as opaque and used to make conditional HTTP requests. + * + * @param eTag the eTag value to set + * @return the ProductPolicyGetHeaders object itself. + */ + public ProductPolicyGetHeaders withETag(String eTag) { + this.eTag = eTag; + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ProductPolicys.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ProductPolicys.java new file mode 100644 index 0000000000000..a2bf23f6389f8 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ProductPolicys.java @@ -0,0 +1,66 @@ +/** + * 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.apimanagement.v2019_01_01; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import rx.Completable; +import rx.Observable; +import com.microsoft.azure.management.apimanagement.v2019_01_01.implementation.ProductPolicysInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing ProductPolicys. + */ +public interface ProductPolicys extends SupportsCreating, HasInner { + /** + * Get the policy configuration at the Product level. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param productId Product identifier. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByProductAsync(String resourceGroupName, String serviceName, String productId); + + /** + * Get the ETag of the policy configuration at the Product level. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param productId Product identifier. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable getEntityTagAsync(String resourceGroupName, String serviceName, String productId); + + /** + * Get the policy configuration at the Product level. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param productId Product identifier. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String resourceGroupName, String serviceName, String productId); + + /** + * Deletes the policy configuration at the Product. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param productId Product identifier. Must be unique in the current API Management service instance. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable deleteAsync(String resourceGroupName, String serviceName, String productId, String ifMatch); + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ProductState.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ProductState.java new file mode 100644 index 0000000000000..7cbb61d17d3b2 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ProductState.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.apimanagement.v2019_01_01; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for ProductState. + */ +public enum ProductState { + /** Enum value notPublished. */ + NOT_PUBLISHED("notPublished"), + + /** Enum value published. */ + PUBLISHED("published"); + + /** The actual serialized value for a ProductState instance. */ + private String value; + + ProductState(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a ProductState instance. + * + * @param value the serialized value to parse. + * @return the parsed ProductState object, or null if unable to parse. + */ + @JsonCreator + public static ProductState fromString(String value) { + ProductState[] items = ProductState.values(); + for (ProductState item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ProductSubscriptionContract.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ProductSubscriptionContract.java new file mode 100644 index 0000000000000..66fad530c6a74 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ProductSubscriptionContract.java @@ -0,0 +1,101 @@ +/** + * 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.apimanagement.v2019_01_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.apimanagement.v2019_01_01.implementation.SubscriptionContractInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.apimanagement.v2019_01_01.implementation.ApiManagementManager; +import org.joda.time.DateTime; + +/** + * Type representing ProductSubscriptionContract. + */ +public interface ProductSubscriptionContract extends HasInner, HasManager { + /** + * @return the allowTracing value. + */ + Boolean allowTracing(); + + /** + * @return the createdDate value. + */ + DateTime createdDate(); + + /** + * @return the displayName value. + */ + String displayName(); + + /** + * @return the endDate value. + */ + DateTime endDate(); + + /** + * @return the expirationDate value. + */ + DateTime expirationDate(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the notificationDate value. + */ + DateTime notificationDate(); + + /** + * @return the ownerId value. + */ + String ownerId(); + + /** + * @return the primaryKey value. + */ + String primaryKey(); + + /** + * @return the scope value. + */ + String scope(); + + /** + * @return the secondaryKey value. + */ + String secondaryKey(); + + /** + * @return the startDate value. + */ + DateTime startDate(); + + /** + * @return the state value. + */ + SubscriptionState state(); + + /** + * @return the stateComment value. + */ + String stateComment(); + + /** + * @return the type value. + */ + String type(); + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ProductSubscriptions.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ProductSubscriptions.java new file mode 100644 index 0000000000000..32b4ab6b2d56e --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ProductSubscriptions.java @@ -0,0 +1,30 @@ +/** + * 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.apimanagement.v2019_01_01; + +import rx.Observable; +import com.microsoft.azure.management.apimanagement.v2019_01_01.implementation.ProductSubscriptionsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing ProductSubscriptions. + */ +public interface ProductSubscriptions extends HasInner { + /** + * Lists the collection of subscriptions to the specified product. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param productId Product identifier. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listAsync(final String resourceGroupName, final String serviceName, final String productId); + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ProductTagResourceContractProperties.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ProductTagResourceContractProperties.java new file mode 100644 index 0000000000000..3938735740d60 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ProductTagResourceContractProperties.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.apimanagement.v2019_01_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Product profile. + */ +public class ProductTagResourceContractProperties extends ProductEntityBaseParameters { + /** + * Identifier of the product in the form of /products/{productId}. + */ + @JsonProperty(value = "id") + private String id; + + /** + * Product name. + */ + @JsonProperty(value = "name", required = true) + private String name; + + /** + * Get identifier of the product in the form of /products/{productId}. + * + * @return the id value + */ + public String id() { + return this.id; + } + + /** + * Set identifier of the product in the form of /products/{productId}. + * + * @param id the id value to set + * @return the ProductTagResourceContractProperties object itself. + */ + public ProductTagResourceContractProperties withId(String id) { + this.id = id; + return this; + } + + /** + * Get product name. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set product name. + * + * @param name the name value to set + * @return the ProductTagResourceContractProperties object itself. + */ + public ProductTagResourceContractProperties withName(String name) { + this.name = name; + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ProductUpdateParameters.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ProductUpdateParameters.java new file mode 100644 index 0000000000000..5987c85ad5752 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ProductUpdateParameters.java @@ -0,0 +1,220 @@ +/** + * 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.apimanagement.v2019_01_01; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; + +/** + * Product Update parameters. + */ +@JsonFlatten +public class ProductUpdateParameters { + /** + * Product description. May include HTML formatting tags. + */ + @JsonProperty(value = "properties.description") + private String description; + + /** + * Product terms of use. Developers trying to subscribe to the product will + * be presented and required to accept these terms before they can complete + * the subscription process. + */ + @JsonProperty(value = "properties.terms") + private String terms; + + /** + * Whether a product subscription is required for accessing APIs included + * in this product. If true, the product is referred to as "protected" and + * a valid subscription key is required for a request to an API included in + * the product to succeed. If false, the product is referred to as "open" + * and requests to an API included in the product can be made without a + * subscription key. If property is omitted when creating a new product + * it's value is assumed to be true. + */ + @JsonProperty(value = "properties.subscriptionRequired") + private Boolean subscriptionRequired; + + /** + * whether subscription approval is required. If false, new subscriptions + * will be approved automatically enabling developers to call the product’s + * APIs immediately after subscribing. If true, administrators must + * manually approve the subscription before the developer can any of the + * product’s APIs. Can be present only if subscriptionRequired property is + * present and has a value of false. + */ + @JsonProperty(value = "properties.approvalRequired") + private Boolean approvalRequired; + + /** + * Whether the number of subscriptions a user can have to this product at + * the same time. Set to null or omit to allow unlimited per user + * subscriptions. Can be present only if subscriptionRequired property is + * present and has a value of false. + */ + @JsonProperty(value = "properties.subscriptionsLimit") + private Integer subscriptionsLimit; + + /** + * whether product is published or not. Published products are discoverable + * by users of developer portal. Non published products are visible only to + * administrators. Default state of Product is notPublished. Possible + * values include: 'notPublished', 'published'. + */ + @JsonProperty(value = "properties.state") + private ProductState state; + + /** + * Product name. + */ + @JsonProperty(value = "properties.displayName") + private String displayName; + + /** + * Get product description. May include HTML formatting tags. + * + * @return the description value + */ + public String description() { + return this.description; + } + + /** + * Set product description. May include HTML formatting tags. + * + * @param description the description value to set + * @return the ProductUpdateParameters object itself. + */ + public ProductUpdateParameters withDescription(String description) { + this.description = description; + return this; + } + + /** + * Get product terms of use. Developers trying to subscribe to the product will be presented and required to accept these terms before they can complete the subscription process. + * + * @return the terms value + */ + public String terms() { + return this.terms; + } + + /** + * Set product terms of use. Developers trying to subscribe to the product will be presented and required to accept these terms before they can complete the subscription process. + * + * @param terms the terms value to set + * @return the ProductUpdateParameters object itself. + */ + public ProductUpdateParameters withTerms(String terms) { + this.terms = terms; + return this; + } + + /** + * Get whether a product subscription is required for accessing APIs included in this product. If true, the product is referred to as "protected" and a valid subscription key is required for a request to an API included in the product to succeed. If false, the product is referred to as "open" and requests to an API included in the product can be made without a subscription key. If property is omitted when creating a new product it's value is assumed to be true. + * + * @return the subscriptionRequired value + */ + public Boolean subscriptionRequired() { + return this.subscriptionRequired; + } + + /** + * Set whether a product subscription is required for accessing APIs included in this product. If true, the product is referred to as "protected" and a valid subscription key is required for a request to an API included in the product to succeed. If false, the product is referred to as "open" and requests to an API included in the product can be made without a subscription key. If property is omitted when creating a new product it's value is assumed to be true. + * + * @param subscriptionRequired the subscriptionRequired value to set + * @return the ProductUpdateParameters object itself. + */ + public ProductUpdateParameters withSubscriptionRequired(Boolean subscriptionRequired) { + this.subscriptionRequired = subscriptionRequired; + return this; + } + + /** + * Get whether subscription approval is required. If false, new subscriptions will be approved automatically enabling developers to call the product’s APIs immediately after subscribing. If true, administrators must manually approve the subscription before the developer can any of the product’s APIs. Can be present only if subscriptionRequired property is present and has a value of false. + * + * @return the approvalRequired value + */ + public Boolean approvalRequired() { + return this.approvalRequired; + } + + /** + * Set whether subscription approval is required. If false, new subscriptions will be approved automatically enabling developers to call the product’s APIs immediately after subscribing. If true, administrators must manually approve the subscription before the developer can any of the product’s APIs. Can be present only if subscriptionRequired property is present and has a value of false. + * + * @param approvalRequired the approvalRequired value to set + * @return the ProductUpdateParameters object itself. + */ + public ProductUpdateParameters withApprovalRequired(Boolean approvalRequired) { + this.approvalRequired = approvalRequired; + return this; + } + + /** + * Get whether the number of subscriptions a user can have to this product at the same time. Set to null or omit to allow unlimited per user subscriptions. Can be present only if subscriptionRequired property is present and has a value of false. + * + * @return the subscriptionsLimit value + */ + public Integer subscriptionsLimit() { + return this.subscriptionsLimit; + } + + /** + * Set whether the number of subscriptions a user can have to this product at the same time. Set to null or omit to allow unlimited per user subscriptions. Can be present only if subscriptionRequired property is present and has a value of false. + * + * @param subscriptionsLimit the subscriptionsLimit value to set + * @return the ProductUpdateParameters object itself. + */ + public ProductUpdateParameters withSubscriptionsLimit(Integer subscriptionsLimit) { + this.subscriptionsLimit = subscriptionsLimit; + return this; + } + + /** + * Get whether product is published or not. Published products are discoverable by users of developer portal. Non published products are visible only to administrators. Default state of Product is notPublished. Possible values include: 'notPublished', 'published'. + * + * @return the state value + */ + public ProductState state() { + return this.state; + } + + /** + * Set whether product is published or not. Published products are discoverable by users of developer portal. Non published products are visible only to administrators. Default state of Product is notPublished. Possible values include: 'notPublished', 'published'. + * + * @param state the state value to set + * @return the ProductUpdateParameters object itself. + */ + public ProductUpdateParameters withState(ProductState state) { + this.state = state; + return this; + } + + /** + * Get product name. + * + * @return the displayName value + */ + public String displayName() { + return this.displayName; + } + + /** + * Set product name. + * + * @param displayName the displayName value to set + * @return the ProductUpdateParameters object itself. + */ + public ProductUpdateParameters withDisplayName(String displayName) { + this.displayName = displayName; + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/Products.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/Products.java new file mode 100644 index 0000000000000..5dad6aa619c18 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/Products.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.apimanagement.v2019_01_01; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import rx.Completable; +import rx.Observable; +import com.microsoft.azure.management.apimanagement.v2019_01_01.implementation.ProductsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing Products. + */ +public interface Products extends SupportsCreating, HasInner { + /** + * Lists a collection of products in the specified service instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByServiceAsync(final String resourceGroupName, final String serviceName); + + /** + * Gets the entity state (Etag) version of the product specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param productId Product identifier. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable getEntityTagAsync(String resourceGroupName, String serviceName, String productId); + + /** + * Gets the details of the product specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param productId Product identifier. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String resourceGroupName, String serviceName, String productId); + + /** + * Delete product. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param productId Product identifier. Must be unique in the current API Management service instance. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable deleteAsync(String resourceGroupName, String serviceName, String productId, String ifMatch); + + /** + * Lists a collection of products associated with tags. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByTagsAsync(final String resourceGroupName, final String serviceName); + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/PropertyContract.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/PropertyContract.java new file mode 100644 index 0000000000000..e8d1a8a157847 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/PropertyContract.java @@ -0,0 +1,215 @@ +/** + * 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.apimanagement.v2019_01_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.apimanagement.v2019_01_01.implementation.PropertyContractInner; +import com.microsoft.azure.arm.model.Indexable; +import com.microsoft.azure.arm.model.Creatable; +import com.microsoft.azure.arm.model.Updatable; +import com.microsoft.azure.arm.model.Appliable; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.apimanagement.v2019_01_01.implementation.ApiManagementManager; +import java.util.List; + +/** + * Type representing PropertyContract. + */ +public interface PropertyContract extends HasInner, Indexable, Updatable, HasManager { + /** + * @return the displayName value. + */ + String displayName(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the secret value. + */ + Boolean secret(); + + /** + * @return the tags value. + */ + List tags(); + + /** + * @return the type value. + */ + String type(); + + /** + * @return the value value. + */ + String value(); + + /** + * The entirety of the PropertyContract definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithResourceGroupName, DefinitionStages.WithServiceName, DefinitionStages.WithIfMatch, DefinitionStages.WithDisplayName, DefinitionStages.WithValue, DefinitionStages.WithCreate { + } + + /** + * Grouping of PropertyContract definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a PropertyContract definition. + */ + interface Blank extends WithResourceGroupName { + } + + /** + * The stage of the propertycontract definition allowing to specify ResourceGroupName. + */ + interface WithResourceGroupName { + /** + * Specifies resourceGroupName. + * @param resourceGroupName The name of the resource group + * @return the next definition stage + */ + WithServiceName withResourceGroupName(String resourceGroupName); + } + + /** + * The stage of the propertycontract definition allowing to specify ServiceName. + */ + interface WithServiceName { + /** + * Specifies serviceName. + * @param serviceName The name of the API Management service + * @return the next definition stage + */ + WithIfMatch withServiceName(String serviceName); + } + + /** + * The stage of the propertycontract definition allowing to specify IfMatch. + */ + interface WithIfMatch { + /** + * Specifies ifMatch. + * @param ifMatch ETag of the Entity. Not required when creating an entity, but required when updating an entity + * @return the next definition stage + */ + WithDisplayName withIfMatch(String ifMatch); + } + + /** + * The stage of the propertycontract definition allowing to specify DisplayName. + */ + interface WithDisplayName { + /** + * Specifies displayName. + * @param displayName Unique name of Property. It may contain only letters, digits, period, dash, and underscore characters + * @return the next definition stage + */ + WithValue withDisplayName(String displayName); + } + + /** + * The stage of the propertycontract definition allowing to specify Value. + */ + interface WithValue { + /** + * Specifies value. + * @param value Value of the property. Can contain policy expressions. It may not be empty or consist only of whitespace + * @return the next definition stage + */ + WithCreate withValue(String value); + } + + /** + * The stage of the propertycontract definition allowing to specify Secret. + */ + interface WithSecret { + /** + * Specifies secret. + * @param secret Determines whether the value is a secret and should be encrypted or not. Default value is false + * @return the next definition stage + */ + WithCreate withSecret(Boolean secret); + } + + /** + * The stage of the propertycontract definition allowing to specify Tags. + */ + interface WithTags { + /** + * Specifies tags. + * @param tags Optional tags that when provided can be used to filter the property list + * @return the next definition stage + */ + WithCreate withTags(List tags); + } + + /** + * The stage of the definition which contains all the minimum required inputs for + * the resource to be created (via {@link WithCreate#create()}), but also allows + * for any other optional settings to be specified. + */ + interface WithCreate extends Creatable, DefinitionStages.WithSecret, DefinitionStages.WithTags { + } + } + /** + * The template for a PropertyContract update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithIfMatch, UpdateStages.WithSecret, UpdateStages.WithTags { + } + + /** + * Grouping of PropertyContract update stages. + */ + interface UpdateStages { + /** + * The stage of the propertycontract update allowing to specify IfMatch. + */ + interface WithIfMatch { + /** + * Specifies ifMatch. + * @param ifMatch ETag of the Entity. Not required when creating an entity, but required when updating an entity + * @return the next update stage + */ + Update withIfMatch(String ifMatch); + } + + /** + * The stage of the propertycontract update allowing to specify Secret. + */ + interface WithSecret { + /** + * Specifies secret. + * @param secret Determines whether the value is a secret and should be encrypted or not. Default value is false + * @return the next update stage + */ + Update withSecret(Boolean secret); + } + + /** + * The stage of the propertycontract update allowing to specify Tags. + */ + interface WithTags { + /** + * Specifies tags. + * @param tags Optional tags that when provided can be used to filter the property list + * @return the next update stage + */ + Update withTags(List tags); + } + + } +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/PropertyCreateOrUpdateHeaders.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/PropertyCreateOrUpdateHeaders.java new file mode 100644 index 0000000000000..977a6c1e39fa0 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/PropertyCreateOrUpdateHeaders.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.apimanagement.v2019_01_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for CreateOrUpdate operation. + */ +public class PropertyCreateOrUpdateHeaders { + /** + * Current entity state version. Should be treated as opaque and used to + * make conditional HTTP requests. + */ + @JsonProperty(value = "ETag") + private String eTag; + + /** + * Get current entity state version. Should be treated as opaque and used to make conditional HTTP requests. + * + * @return the eTag value + */ + public String eTag() { + return this.eTag; + } + + /** + * Set current entity state version. Should be treated as opaque and used to make conditional HTTP requests. + * + * @param eTag the eTag value to set + * @return the PropertyCreateOrUpdateHeaders object itself. + */ + public PropertyCreateOrUpdateHeaders withETag(String eTag) { + this.eTag = eTag; + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/PropertyEntityBaseParameters.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/PropertyEntityBaseParameters.java new file mode 100644 index 0000000000000..94f6badfed781 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/PropertyEntityBaseParameters.java @@ -0,0 +1,72 @@ +/** + * 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.apimanagement.v2019_01_01; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Property Entity Base Parameters set. + */ +public class PropertyEntityBaseParameters { + /** + * Optional tags that when provided can be used to filter the property + * list. + */ + @JsonProperty(value = "tags") + private List tags; + + /** + * Determines whether the value is a secret and should be encrypted or not. + * Default value is false. + */ + @JsonProperty(value = "secret") + private Boolean secret; + + /** + * Get optional tags that when provided can be used to filter the property list. + * + * @return the tags value + */ + public List tags() { + return this.tags; + } + + /** + * Set optional tags that when provided can be used to filter the property list. + * + * @param tags the tags value to set + * @return the PropertyEntityBaseParameters object itself. + */ + public PropertyEntityBaseParameters withTags(List tags) { + this.tags = tags; + return this; + } + + /** + * Get determines whether the value is a secret and should be encrypted or not. Default value is false. + * + * @return the secret value + */ + public Boolean secret() { + return this.secret; + } + + /** + * Set determines whether the value is a secret and should be encrypted or not. Default value is false. + * + * @param secret the secret value to set + * @return the PropertyEntityBaseParameters object itself. + */ + public PropertyEntityBaseParameters withSecret(Boolean secret) { + this.secret = secret; + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/PropertyGetEntityTagHeaders.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/PropertyGetEntityTagHeaders.java new file mode 100644 index 0000000000000..97392671a7335 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/PropertyGetEntityTagHeaders.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.apimanagement.v2019_01_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for GetEntityTag operation. + */ +public class PropertyGetEntityTagHeaders { + /** + * Current entity state version. Should be treated as opaque and used to + * make conditional HTTP requests. + */ + @JsonProperty(value = "ETag") + private String eTag; + + /** + * Get current entity state version. Should be treated as opaque and used to make conditional HTTP requests. + * + * @return the eTag value + */ + public String eTag() { + return this.eTag; + } + + /** + * Set current entity state version. Should be treated as opaque and used to make conditional HTTP requests. + * + * @param eTag the eTag value to set + * @return the PropertyGetEntityTagHeaders object itself. + */ + public PropertyGetEntityTagHeaders withETag(String eTag) { + this.eTag = eTag; + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/PropertyGetHeaders.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/PropertyGetHeaders.java new file mode 100644 index 0000000000000..cb3c00630083c --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/PropertyGetHeaders.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.apimanagement.v2019_01_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for Get operation. + */ +public class PropertyGetHeaders { + /** + * Current entity state version. Should be treated as opaque and used to + * make conditional HTTP requests. + */ + @JsonProperty(value = "ETag") + private String eTag; + + /** + * Get current entity state version. Should be treated as opaque and used to make conditional HTTP requests. + * + * @return the eTag value + */ + public String eTag() { + return this.eTag; + } + + /** + * Set current entity state version. Should be treated as opaque and used to make conditional HTTP requests. + * + * @param eTag the eTag value to set + * @return the PropertyGetHeaders object itself. + */ + public PropertyGetHeaders withETag(String eTag) { + this.eTag = eTag; + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/PropertyUpdateParameters.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/PropertyUpdateParameters.java new file mode 100644 index 0000000000000..1d5d74b86829c --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/PropertyUpdateParameters.java @@ -0,0 +1,128 @@ +/** + * 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.apimanagement.v2019_01_01; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; + +/** + * Property update Parameters. + */ +@JsonFlatten +public class PropertyUpdateParameters { + /** + * Optional tags that when provided can be used to filter the property + * list. + */ + @JsonProperty(value = "properties.tags") + private List tags; + + /** + * Determines whether the value is a secret and should be encrypted or not. + * Default value is false. + */ + @JsonProperty(value = "properties.secret") + private Boolean secret; + + /** + * Unique name of Property. It may contain only letters, digits, period, + * dash, and underscore characters. + */ + @JsonProperty(value = "properties.displayName") + private String displayName; + + /** + * Value of the property. Can contain policy expressions. It may not be + * empty or consist only of whitespace. + */ + @JsonProperty(value = "properties.value") + private String value; + + /** + * Get optional tags that when provided can be used to filter the property list. + * + * @return the tags value + */ + public List tags() { + return this.tags; + } + + /** + * Set optional tags that when provided can be used to filter the property list. + * + * @param tags the tags value to set + * @return the PropertyUpdateParameters object itself. + */ + public PropertyUpdateParameters withTags(List tags) { + this.tags = tags; + return this; + } + + /** + * Get determines whether the value is a secret and should be encrypted or not. Default value is false. + * + * @return the secret value + */ + public Boolean secret() { + return this.secret; + } + + /** + * Set determines whether the value is a secret and should be encrypted or not. Default value is false. + * + * @param secret the secret value to set + * @return the PropertyUpdateParameters object itself. + */ + public PropertyUpdateParameters withSecret(Boolean secret) { + this.secret = secret; + return this; + } + + /** + * Get unique name of Property. It may contain only letters, digits, period, dash, and underscore characters. + * + * @return the displayName value + */ + public String displayName() { + return this.displayName; + } + + /** + * Set unique name of Property. It may contain only letters, digits, period, dash, and underscore characters. + * + * @param displayName the displayName value to set + * @return the PropertyUpdateParameters object itself. + */ + public PropertyUpdateParameters withDisplayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Get value of the property. Can contain policy expressions. It may not be empty or consist only of whitespace. + * + * @return the value value + */ + public String value() { + return this.value; + } + + /** + * Set value of the property. Can contain policy expressions. It may not be empty or consist only of whitespace. + * + * @param value the value value to set + * @return the PropertyUpdateParameters object itself. + */ + public PropertyUpdateParameters withValue(String value) { + this.value = value; + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/Propertys.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/Propertys.java new file mode 100644 index 0000000000000..58bef248f96f2 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/Propertys.java @@ -0,0 +1,65 @@ +/** + * 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.apimanagement.v2019_01_01; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import rx.Completable; +import rx.Observable; +import com.microsoft.azure.management.apimanagement.v2019_01_01.implementation.PropertysInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing Propertys. + */ +public interface Propertys extends SupportsCreating, HasInner { + /** + * Lists a collection of properties defined within a service instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByServiceAsync(final String resourceGroupName, final String serviceName); + + /** + * Gets the entity state (Etag) version of the property specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param propId Identifier of the property. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable getEntityTagAsync(String resourceGroupName, String serviceName, String propId); + + /** + * Gets the details of the property specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param propId Identifier of the property. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String resourceGroupName, String serviceName, String propId); + + /** + * Deletes specific property from the API Management service instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param propId Identifier of the property. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable deleteAsync(String resourceGroupName, String serviceName, String propId, String ifMatch); + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/Protocol.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/Protocol.java new file mode 100644 index 0000000000000..80a601fea9277 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/Protocol.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.apimanagement.v2019_01_01; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for Protocol. + */ +public enum Protocol { + /** Enum value http. */ + HTTP("http"), + + /** Enum value https. */ + HTTPS("https"); + + /** The actual serialized value for a Protocol instance. */ + private String value; + + Protocol(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a Protocol instance. + * + * @param value the serialized value to parse. + * @return the parsed Protocol object, or null if unable to parse. + */ + @JsonCreator + public static Protocol fromString(String value) { + Protocol[] items = Protocol.values(); + for (Protocol item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/QuotaByCounterKeys.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/QuotaByCounterKeys.java new file mode 100644 index 0000000000000..7f58cae5a2e29 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/QuotaByCounterKeys.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.apimanagement.v2019_01_01; + +import rx.Completable; +import rx.Observable; +import com.microsoft.azure.management.apimanagement.v2019_01_01.implementation.QuotaByCounterKeysInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing QuotaByCounterKeys. + */ +public interface QuotaByCounterKeys extends HasInner { + /** + * Lists a collection of current quota counter periods associated with the counter-key configured in the policy on the specified service instance. The api does not support paging yet. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param quotaCounterKey Quota counter key identifier.This is the result of expression defined in counter-key attribute of the quota-by-key policy.For Example, if you specify counter-key="boo" in the policy, then it’s accessible by "boo" counter key. But if it’s defined as counter-key="@("b"+"a")" then it will be accessible by "ba" key + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByServiceAsync(String resourceGroupName, String serviceName, String quotaCounterKey); + + /** + * Updates all the quota counter values specified with the existing quota counter key to a value in the specified service instance. This should be used for reset of the quota counter values. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param quotaCounterKey Quota counter key identifier.This is the result of expression defined in counter-key attribute of the quota-by-key policy.For Example, if you specify counter-key="boo" in the policy, then it’s accessible by "boo" counter key. But if it’s defined as counter-key="@("b"+"a")" then it will be accessible by "ba" key + * @param parameters The value of the quota counter to be applied to all quota counter periods. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable updateAsync(String resourceGroupName, String serviceName, String quotaCounterKey, QuotaCounterValueContractProperties parameters); + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/QuotaByPeriodKeys.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/QuotaByPeriodKeys.java new file mode 100644 index 0000000000000..c4b5a8e3ce51a --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/QuotaByPeriodKeys.java @@ -0,0 +1,45 @@ +/** + * 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.apimanagement.v2019_01_01; + +import rx.Observable; +import rx.Completable; +import com.microsoft.azure.management.apimanagement.v2019_01_01.implementation.QuotaByPeriodKeysInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing QuotaByPeriodKeys. + */ +public interface QuotaByPeriodKeys extends HasInner { + /** + * Updates an existing quota counter value in the specified service instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param quotaCounterKey Quota counter key identifier.This is the result of expression defined in counter-key attribute of the quota-by-key policy.For Example, if you specify counter-key="boo" in the policy, then it’s accessible by "boo" counter key. But if it’s defined as counter-key="@("b"+"a")" then it will be accessible by "ba" key + * @param quotaPeriodKey Quota period key identifier. + * @param parameters The value of the Quota counter to be applied on the specified period. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable updateAsync(String resourceGroupName, String serviceName, String quotaCounterKey, String quotaPeriodKey, QuotaCounterValueContractProperties parameters); + + /** + * Gets the value of the quota counter associated with the counter-key in the policy for the specific period in service instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param quotaCounterKey Quota counter key identifier.This is the result of expression defined in counter-key attribute of the quota-by-key policy.For Example, if you specify counter-key="boo" in the policy, then it’s accessible by "boo" counter key. But if it’s defined as counter-key="@("b"+"a")" then it will be accessible by "ba" key + * @param quotaPeriodKey Quota period key identifier. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String resourceGroupName, String serviceName, String quotaCounterKey, String quotaPeriodKey); + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/QuotaCounterCollection.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/QuotaCounterCollection.java new file mode 100644 index 0000000000000..b4f3f3daeb397 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/QuotaCounterCollection.java @@ -0,0 +1,37 @@ +/** + * 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.apimanagement.v2019_01_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.apimanagement.v2019_01_01.implementation.ApiManagementManager; +import com.microsoft.azure.management.apimanagement.v2019_01_01.implementation.QuotaCounterCollectionInner; +import com.microsoft.azure.management.apimanagement.v2019_01_01.implementation.QuotaCounterContractInner; +import java.util.List; + +/** + * Type representing QuotaCounterCollection. + */ +public interface QuotaCounterCollection extends HasInner, HasManager { + /** + * @return the count value. + */ + Long count(); + + /** + * @return the nextLink value. + */ + String nextLink(); + + /** + * @return the value value. + */ + List value(); + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/QuotaCounterContract.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/QuotaCounterContract.java new file mode 100644 index 0000000000000..795a36ec4c6bf --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/QuotaCounterContract.java @@ -0,0 +1,46 @@ +/** + * 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.apimanagement.v2019_01_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.apimanagement.v2019_01_01.implementation.QuotaCounterContractInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.apimanagement.v2019_01_01.implementation.ApiManagementManager; +import org.joda.time.DateTime; + +/** + * Type representing QuotaCounterContract. + */ +public interface QuotaCounterContract extends HasInner, HasManager { + /** + * @return the counterKey value. + */ + String counterKey(); + + /** + * @return the periodEndTime value. + */ + DateTime periodEndTime(); + + /** + * @return the periodKey value. + */ + String periodKey(); + + /** + * @return the periodStartTime value. + */ + DateTime periodStartTime(); + + /** + * @return the value value. + */ + QuotaCounterValueContractProperties value(); + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/QuotaCounterValueContract.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/QuotaCounterValueContract.java new file mode 100644 index 0000000000000..eb41c02ac6afb --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/QuotaCounterValueContract.java @@ -0,0 +1,71 @@ +/** + * 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.apimanagement.v2019_01_01; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; + +/** + * Quota counter value details. + */ +@JsonFlatten +public class QuotaCounterValueContract { + /** + * Number of times Counter was called. + */ + @JsonProperty(value = "value.callsCount") + private Integer callsCount; + + /** + * Data Transferred in KiloBytes. + */ + @JsonProperty(value = "value.kbTransferred") + private Double kbTransferred; + + /** + * Get number of times Counter was called. + * + * @return the callsCount value + */ + public Integer callsCount() { + return this.callsCount; + } + + /** + * Set number of times Counter was called. + * + * @param callsCount the callsCount value to set + * @return the QuotaCounterValueContract object itself. + */ + public QuotaCounterValueContract withCallsCount(Integer callsCount) { + this.callsCount = callsCount; + return this; + } + + /** + * Get data Transferred in KiloBytes. + * + * @return the kbTransferred value + */ + public Double kbTransferred() { + return this.kbTransferred; + } + + /** + * Set data Transferred in KiloBytes. + * + * @param kbTransferred the kbTransferred value to set + * @return the QuotaCounterValueContract object itself. + */ + public QuotaCounterValueContract withKbTransferred(Double kbTransferred) { + this.kbTransferred = kbTransferred; + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/QuotaCounterValueContractProperties.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/QuotaCounterValueContractProperties.java new file mode 100644 index 0000000000000..7278a4a938f48 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/QuotaCounterValueContractProperties.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.apimanagement.v2019_01_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Quota counter value details. + */ +public class QuotaCounterValueContractProperties { + /** + * Number of times Counter was called. + */ + @JsonProperty(value = "callsCount") + private Integer callsCount; + + /** + * Data Transferred in KiloBytes. + */ + @JsonProperty(value = "kbTransferred") + private Double kbTransferred; + + /** + * Get number of times Counter was called. + * + * @return the callsCount value + */ + public Integer callsCount() { + return this.callsCount; + } + + /** + * Set number of times Counter was called. + * + * @param callsCount the callsCount value to set + * @return the QuotaCounterValueContractProperties object itself. + */ + public QuotaCounterValueContractProperties withCallsCount(Integer callsCount) { + this.callsCount = callsCount; + return this; + } + + /** + * Get data Transferred in KiloBytes. + * + * @return the kbTransferred value + */ + public Double kbTransferred() { + return this.kbTransferred; + } + + /** + * Set data Transferred in KiloBytes. + * + * @param kbTransferred the kbTransferred value to set + * @return the QuotaCounterValueContractProperties object itself. + */ + public QuotaCounterValueContractProperties withKbTransferred(Double kbTransferred) { + this.kbTransferred = kbTransferred; + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/RecipientEmailCollection.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/RecipientEmailCollection.java new file mode 100644 index 0000000000000..3d4db792fc948 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/RecipientEmailCollection.java @@ -0,0 +1,32 @@ +/** + * 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.apimanagement.v2019_01_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.apimanagement.v2019_01_01.implementation.ApiManagementManager; +import com.microsoft.azure.management.apimanagement.v2019_01_01.implementation.RecipientEmailCollectionInner; +import com.microsoft.azure.management.apimanagement.v2019_01_01.implementation.RecipientEmailContractInner; +import java.util.List; + +/** + * Type representing RecipientEmailCollection. + */ +public interface RecipientEmailCollection extends HasInner, HasManager { + /** + * @return the nextLink value. + */ + String nextLink(); + + /** + * @return the value value. + */ + List value(); + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/RecipientEmailContract.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/RecipientEmailContract.java new file mode 100644 index 0000000000000..19b147b6f4967 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/RecipientEmailContract.java @@ -0,0 +1,93 @@ +/** + * 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.apimanagement.v2019_01_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.apimanagement.v2019_01_01.implementation.RecipientEmailContractInner; +import com.microsoft.azure.arm.model.Indexable; +import com.microsoft.azure.arm.model.Updatable; +import com.microsoft.azure.arm.model.Appliable; +import com.microsoft.azure.arm.model.Creatable; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.apimanagement.v2019_01_01.implementation.ApiManagementManager; + +/** + * Type representing RecipientEmailContract. + */ +public interface RecipientEmailContract extends HasInner, Indexable, Updatable, HasManager { + /** + * @return the email value. + */ + String email(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the type value. + */ + String type(); + + /** + * The entirety of the RecipientEmailContract definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithNotification, DefinitionStages.WithCreate { + } + + /** + * Grouping of RecipientEmailContract definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a RecipientEmailContract definition. + */ + interface Blank extends WithNotification { + } + + /** + * The stage of the recipientemailcontract definition allowing to specify Notification. + */ + interface WithNotification { + /** + * Specifies resourceGroupName, serviceName, notificationName. + * @param resourceGroupName The name of the resource group + * @param serviceName The name of the API Management service + * @param notificationName Notification Name Identifier. Possible values include: 'RequestPublisherNotificationMessage', 'PurchasePublisherNotificationMessage', 'NewApplicationNotificationMessage', 'BCC', 'NewIssuePublisherNotificationMessage', 'AccountClosedPublisher', 'QuotaLimitApproachingPublisherNotificationMessage' + * @return the next definition stage + */ + WithCreate withExistingNotification(String resourceGroupName, String serviceName, NotificationName notificationName); + } + + /** + * The stage of the definition which contains all the minimum required inputs for + * the resource to be created (via {@link WithCreate#create()}), but also allows + * for any other optional settings to be specified. + */ + interface WithCreate extends Creatable { + } + } + /** + * The template for a RecipientEmailContract update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable { + } + + /** + * Grouping of RecipientEmailContract update stages. + */ + interface UpdateStages { + } +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/RecipientUserCollection.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/RecipientUserCollection.java new file mode 100644 index 0000000000000..363cab7eb08ff --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/RecipientUserCollection.java @@ -0,0 +1,32 @@ +/** + * 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.apimanagement.v2019_01_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.apimanagement.v2019_01_01.implementation.ApiManagementManager; +import com.microsoft.azure.management.apimanagement.v2019_01_01.implementation.RecipientUserCollectionInner; +import com.microsoft.azure.management.apimanagement.v2019_01_01.implementation.RecipientUserContractInner; +import java.util.List; + +/** + * Type representing RecipientUserCollection. + */ +public interface RecipientUserCollection extends HasInner, HasManager { + /** + * @return the nextLink value. + */ + String nextLink(); + + /** + * @return the value value. + */ + List value(); + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/RecipientUserContract.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/RecipientUserContract.java new file mode 100644 index 0000000000000..e8b44700dd9cd --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/RecipientUserContract.java @@ -0,0 +1,93 @@ +/** + * 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.apimanagement.v2019_01_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.apimanagement.v2019_01_01.implementation.RecipientUserContractInner; +import com.microsoft.azure.arm.model.Indexable; +import com.microsoft.azure.arm.model.Updatable; +import com.microsoft.azure.arm.model.Appliable; +import com.microsoft.azure.arm.model.Creatable; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.apimanagement.v2019_01_01.implementation.ApiManagementManager; + +/** + * Type representing RecipientUserContract. + */ +public interface RecipientUserContract extends HasInner, Indexable, Updatable, HasManager { + /** + * @return the id value. + */ + String id(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the type value. + */ + String type(); + + /** + * @return the userId value. + */ + String userId(); + + /** + * The entirety of the RecipientUserContract definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithNotification, DefinitionStages.WithCreate { + } + + /** + * Grouping of RecipientUserContract definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a RecipientUserContract definition. + */ + interface Blank extends WithNotification { + } + + /** + * The stage of the recipientusercontract definition allowing to specify Notification. + */ + interface WithNotification { + /** + * Specifies resourceGroupName, serviceName, notificationName. + * @param resourceGroupName The name of the resource group + * @param serviceName The name of the API Management service + * @param notificationName Notification Name Identifier. Possible values include: 'RequestPublisherNotificationMessage', 'PurchasePublisherNotificationMessage', 'NewApplicationNotificationMessage', 'BCC', 'NewIssuePublisherNotificationMessage', 'AccountClosedPublisher', 'QuotaLimitApproachingPublisherNotificationMessage' + * @return the next definition stage + */ + WithCreate withExistingNotification(String resourceGroupName, String serviceName, NotificationName notificationName); + } + + /** + * The stage of the definition which contains all the minimum required inputs for + * the resource to be created (via {@link WithCreate#create()}), but also allows + * for any other optional settings to be specified. + */ + interface WithCreate extends Creatable { + } + } + /** + * The template for a RecipientUserContract update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable { + } + + /** + * Grouping of RecipientUserContract update stages. + */ + interface UpdateStages { + } +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/RecipientsContractProperties.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/RecipientsContractProperties.java new file mode 100644 index 0000000000000..e24d4c5fb0cf9 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/RecipientsContractProperties.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.apimanagement.v2019_01_01; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Notification Parameter contract. + */ +public class RecipientsContractProperties { + /** + * List of Emails subscribed for the notification. + */ + @JsonProperty(value = "emails") + private List emails; + + /** + * List of Users subscribed for the notification. + */ + @JsonProperty(value = "users") + private List users; + + /** + * Get list of Emails subscribed for the notification. + * + * @return the emails value + */ + public List emails() { + return this.emails; + } + + /** + * Set list of Emails subscribed for the notification. + * + * @param emails the emails value to set + * @return the RecipientsContractProperties object itself. + */ + public RecipientsContractProperties withEmails(List emails) { + this.emails = emails; + return this; + } + + /** + * Get list of Users subscribed for the notification. + * + * @return the users value + */ + public List users() { + return this.users; + } + + /** + * Set list of Users subscribed for the notification. + * + * @param users the users value to set + * @return the RecipientsContractProperties object itself. + */ + public RecipientsContractProperties withUsers(List users) { + this.users = users; + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/RegionContract.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/RegionContract.java new file mode 100644 index 0000000000000..344b9bded382a --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/RegionContract.java @@ -0,0 +1,35 @@ +/** + * 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.apimanagement.v2019_01_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.apimanagement.v2019_01_01.implementation.ApiManagementManager; +import com.microsoft.azure.management.apimanagement.v2019_01_01.implementation.RegionContractInner; + +/** + * Type representing RegionContract. + */ +public interface RegionContract extends HasInner, HasManager { + /** + * @return the isDeleted value. + */ + Boolean isDeleted(); + + /** + * @return the isMasterRegion value. + */ + Boolean isMasterRegion(); + + /** + * @return the name value. + */ + String name(); + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/Regions.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/Regions.java new file mode 100644 index 0000000000000..eec12adc0a78f --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/Regions.java @@ -0,0 +1,29 @@ +/** + * 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.apimanagement.v2019_01_01; + +import rx.Observable; +import com.microsoft.azure.management.apimanagement.v2019_01_01.implementation.RegionsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing Regions. + */ +public interface Regions extends HasInner { + /** + * Lists all azure regions in which the service exists. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByServiceAsync(final String resourceGroupName, final String serviceName); + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/RegistrationDelegationSettingsProperties.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/RegistrationDelegationSettingsProperties.java new file mode 100644 index 0000000000000..a8bdc3944fdb7 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/RegistrationDelegationSettingsProperties.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.apimanagement.v2019_01_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * User registration delegation settings properties. + */ +public class RegistrationDelegationSettingsProperties { + /** + * Enable or disable delegation for user registration. + */ + @JsonProperty(value = "enabled") + private Boolean enabled; + + /** + * Get enable or disable delegation for user registration. + * + * @return the enabled value + */ + public Boolean enabled() { + return this.enabled; + } + + /** + * Set enable or disable delegation for user registration. + * + * @param enabled the enabled value to set + * @return the RegistrationDelegationSettingsProperties object itself. + */ + public RegistrationDelegationSettingsProperties withEnabled(Boolean enabled) { + this.enabled = enabled; + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ReportRecordContract.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ReportRecordContract.java new file mode 100644 index 0000000000000..f0f03863d3f22 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ReportRecordContract.java @@ -0,0 +1,151 @@ +/** + * 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.apimanagement.v2019_01_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.apimanagement.v2019_01_01.implementation.ApiManagementManager; +import com.microsoft.azure.management.apimanagement.v2019_01_01.implementation.ReportRecordContractInner; +import org.joda.time.DateTime; + +/** + * Type representing ReportRecordContract. + */ +public interface ReportRecordContract extends HasInner, HasManager { + /** + * @return the apiId value. + */ + String apiId(); + + /** + * @return the apiRegion value. + */ + String apiRegion(); + + /** + * @return the apiTimeAvg value. + */ + Double apiTimeAvg(); + + /** + * @return the apiTimeMax value. + */ + Double apiTimeMax(); + + /** + * @return the apiTimeMin value. + */ + Double apiTimeMin(); + + /** + * @return the bandwidth value. + */ + Long bandwidth(); + + /** + * @return the cacheHitCount value. + */ + Integer cacheHitCount(); + + /** + * @return the cacheMissCount value. + */ + Integer cacheMissCount(); + + /** + * @return the callCountBlocked value. + */ + Integer callCountBlocked(); + + /** + * @return the callCountFailed value. + */ + Integer callCountFailed(); + + /** + * @return the callCountOther value. + */ + Integer callCountOther(); + + /** + * @return the callCountSuccess value. + */ + Integer callCountSuccess(); + + /** + * @return the callCountTotal value. + */ + Integer callCountTotal(); + + /** + * @return the country value. + */ + String country(); + + /** + * @return the interval value. + */ + String interval(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the operationId value. + */ + String operationId(); + + /** + * @return the productId value. + */ + String productId(); + + /** + * @return the region value. + */ + String region(); + + /** + * @return the serviceTimeAvg value. + */ + Double serviceTimeAvg(); + + /** + * @return the serviceTimeMax value. + */ + Double serviceTimeMax(); + + /** + * @return the serviceTimeMin value. + */ + Double serviceTimeMin(); + + /** + * @return the subscriptionId value. + */ + String subscriptionId(); + + /** + * @return the timestamp value. + */ + DateTime timestamp(); + + /** + * @return the userId value. + */ + String userId(); + + /** + * @return the zip value. + */ + String zip(); + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/Reports.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/Reports.java new file mode 100644 index 0000000000000..e6c5f3cc656ad --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/Reports.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.apimanagement.v2019_01_01; + +import rx.Observable; +import org.joda.time.Period; +import com.microsoft.azure.management.apimanagement.v2019_01_01.implementation.ReportsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing Reports. + */ +public interface Reports extends HasInner { + /** + * Lists report records by API. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param filter The filter to apply on the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByApiAsync(final String resourceGroupName, final String serviceName, final String filter); + + /** + * Lists report records by User. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| timestamp | filter | ge, le | | </br>| displayName | select, orderBy | | | </br>| userId | select, filter | eq | | </br>| apiRegion | filter | eq | | </br>| productId | filter | eq | | </br>| subscriptionId | filter | eq | | </br>| apiId | filter | eq | | </br>| operationId | filter | eq | | </br>| callCountSuccess | select, orderBy | | | </br>| callCountBlocked | select, orderBy | | | </br>| callCountFailed | select, orderBy | | | </br>| callCountOther | select, orderBy | | | </br>| callCountTotal | select, orderBy | | | </br>| bandwidth | select, orderBy | | | </br>| cacheHitsCount | select | | | </br>| cacheMissCount | select | | | </br>| apiTimeAvg | select, orderBy | | | </br>| apiTimeMin | select | | | </br>| apiTimeMax | select | | | </br>| serviceTimeAvg | select | | | </br>| serviceTimeMin | select | | | </br>| serviceTimeMax | select | | | </br> + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByUserAsync(final String resourceGroupName, final String serviceName, final String filter); + + /** + * Lists report records by API Operations. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| timestamp | filter | ge, le | | </br>| displayName | select, orderBy | | | </br>| apiRegion | filter | eq | | </br>| userId | filter | eq | | </br>| productId | filter | eq | | </br>| subscriptionId | filter | eq | | </br>| apiId | filter | eq | | </br>| operationId | select, filter | eq | | </br>| callCountSuccess | select, orderBy | | | </br>| callCountBlocked | select, orderBy | | | </br>| callCountFailed | select, orderBy | | | </br>| callCountOther | select, orderBy | | | </br>| callCountTotal | select, orderBy | | | </br>| bandwidth | select, orderBy | | | </br>| cacheHitsCount | select | | | </br>| cacheMissCount | select | | | </br>| apiTimeAvg | select, orderBy | | | </br>| apiTimeMin | select | | | </br>| apiTimeMax | select | | | </br>| serviceTimeAvg | select | | | </br>| serviceTimeMin | select | | | </br>| serviceTimeMax | select | | | </br> + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByOperationAsync(final String resourceGroupName, final String serviceName, final String filter); + + /** + * Lists report records by Product. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| timestamp | filter | ge, le | | </br>| displayName | select, orderBy | | | </br>| apiRegion | filter | eq | | </br>| userId | filter | eq | | </br>| productId | select, filter | eq | | </br>| subscriptionId | filter | eq | | </br>| callCountSuccess | select, orderBy | | | </br>| callCountBlocked | select, orderBy | | | </br>| callCountFailed | select, orderBy | | | </br>| callCountOther | select, orderBy | | | </br>| callCountTotal | select, orderBy | | | </br>| bandwidth | select, orderBy | | | </br>| cacheHitsCount | select | | | </br>| cacheMissCount | select | | | </br>| apiTimeAvg | select, orderBy | | | </br>| apiTimeMin | select | | | </br>| apiTimeMax | select | | | </br>| serviceTimeAvg | select | | | </br>| serviceTimeMin | select | | | </br>| serviceTimeMax | select | | | </br> + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByProductAsync(final String resourceGroupName, final String serviceName, final String filter); + + /** + * Lists report records by geography. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| timestamp | filter | ge, le | | </br>| country | select | | | </br>| region | select | | | </br>| zip | select | | | </br>| apiRegion | filter | eq | | </br>| userId | filter | eq | | </br>| productId | filter | eq | | </br>| subscriptionId | filter | eq | | </br>| apiId | filter | eq | | </br>| operationId | filter | eq | | </br>| callCountSuccess | select | | | </br>| callCountBlocked | select | | | </br>| callCountFailed | select | | | </br>| callCountOther | select | | | </br>| bandwidth | select, orderBy | | | </br>| cacheHitsCount | select | | | </br>| cacheMissCount | select | | | </br>| apiTimeAvg | select | | | </br>| apiTimeMin | select | | | </br>| apiTimeMax | select | | | </br>| serviceTimeAvg | select | | | </br>| serviceTimeMin | select | | | </br>| serviceTimeMax | select | | | </br> + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByGeoAsync(final String resourceGroupName, final String serviceName, final String filter); + + /** + * Lists report records by subscription. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| timestamp | filter | ge, le | | </br>| displayName | select, orderBy | | | </br>| apiRegion | filter | eq | | </br>| userId | select, filter | eq | | </br>| productId | select, filter | eq | | </br>| subscriptionId | select, filter | eq | | </br>| callCountSuccess | select, orderBy | | | </br>| callCountBlocked | select, orderBy | | | </br>| callCountFailed | select, orderBy | | | </br>| callCountOther | select, orderBy | | | </br>| callCountTotal | select, orderBy | | | </br>| bandwidth | select, orderBy | | | </br>| cacheHitsCount | select | | | </br>| cacheMissCount | select | | | </br>| apiTimeAvg | select, orderBy | | | </br>| apiTimeMin | select | | | </br>| apiTimeMax | select | | | </br>| serviceTimeAvg | select | | | </br>| serviceTimeMin | select | | | </br>| serviceTimeMax | select | | | </br> + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listBySubscriptionAsync(final String resourceGroupName, final String serviceName, final String filter); + + /** + * Lists report records by Time. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| timestamp | filter, select | ge, le | | </br>| interval | select | | | </br>| apiRegion | filter | eq | | </br>| userId | filter | eq | | </br>| productId | filter | eq | | </br>| subscriptionId | filter | eq | | </br>| apiId | filter | eq | | </br>| operationId | filter | eq | | </br>| callCountSuccess | select | | | </br>| callCountBlocked | select | | | </br>| callCountFailed | select | | | </br>| callCountOther | select | | | </br>| bandwidth | select, orderBy | | | </br>| cacheHitsCount | select | | | </br>| cacheMissCount | select | | | </br>| apiTimeAvg | select | | | </br>| apiTimeMin | select | | | </br>| apiTimeMax | select | | | </br>| serviceTimeAvg | select | | | </br>| serviceTimeMin | select | | | </br>| serviceTimeMax | select | | | </br> + * @param interval By time interval. Interval must be multiple of 15 minutes and may not be zero. The value should be in ISO 8601 format (http://en.wikipedia.org/wiki/ISO_8601#Durations).This code can be used to convert TimeSpan to a valid interval string: XmlConvert.ToString(new TimeSpan(hours, minutes, seconds)). + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByTimeAsync(final String resourceGroupName, final String serviceName, final String filter, final Period interval); + + /** + * Lists report records by Request. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| timestamp | filter | ge, le | | </br>| apiId | filter | eq | | </br>| operationId | filter | eq | | </br>| productId | filter | eq | | </br>| userId | filter | eq | | </br>| apiRegion | filter | eq | | </br>| subscriptionId | filter | eq | | </br> + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByRequestAsync(String resourceGroupName, String serviceName, String filter); + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/RepresentationContract.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/RepresentationContract.java new file mode 100644 index 0000000000000..220e357f9204d --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/RepresentationContract.java @@ -0,0 +1,153 @@ +/** + * 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.apimanagement.v2019_01_01; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Operation request/response representation details. + */ +public class RepresentationContract { + /** + * Specifies a registered or custom content type for this representation, + * e.g. application/xml. + */ + @JsonProperty(value = "contentType", required = true) + private String contentType; + + /** + * An example of the representation. + */ + @JsonProperty(value = "sample") + private String sample; + + /** + * Schema identifier. Applicable only if 'contentType' value is neither + * 'application/x-www-form-urlencoded' nor 'multipart/form-data'. + */ + @JsonProperty(value = "schemaId") + private String schemaId; + + /** + * Type name defined by the schema. Applicable only if 'contentType' value + * is neither 'application/x-www-form-urlencoded' nor + * 'multipart/form-data'. + */ + @JsonProperty(value = "typeName") + private String typeName; + + /** + * Collection of form parameters. Required if 'contentType' value is either + * 'application/x-www-form-urlencoded' or 'multipart/form-data'.. + */ + @JsonProperty(value = "formParameters") + private List formParameters; + + /** + * Get specifies a registered or custom content type for this representation, e.g. application/xml. + * + * @return the contentType value + */ + public String contentType() { + return this.contentType; + } + + /** + * Set specifies a registered or custom content type for this representation, e.g. application/xml. + * + * @param contentType the contentType value to set + * @return the RepresentationContract object itself. + */ + public RepresentationContract withContentType(String contentType) { + this.contentType = contentType; + return this; + } + + /** + * Get an example of the representation. + * + * @return the sample value + */ + public String sample() { + return this.sample; + } + + /** + * Set an example of the representation. + * + * @param sample the sample value to set + * @return the RepresentationContract object itself. + */ + public RepresentationContract withSample(String sample) { + this.sample = sample; + return this; + } + + /** + * Get schema identifier. Applicable only if 'contentType' value is neither 'application/x-www-form-urlencoded' nor 'multipart/form-data'. + * + * @return the schemaId value + */ + public String schemaId() { + return this.schemaId; + } + + /** + * Set schema identifier. Applicable only if 'contentType' value is neither 'application/x-www-form-urlencoded' nor 'multipart/form-data'. + * + * @param schemaId the schemaId value to set + * @return the RepresentationContract object itself. + */ + public RepresentationContract withSchemaId(String schemaId) { + this.schemaId = schemaId; + return this; + } + + /** + * Get type name defined by the schema. Applicable only if 'contentType' value is neither 'application/x-www-form-urlencoded' nor 'multipart/form-data'. + * + * @return the typeName value + */ + public String typeName() { + return this.typeName; + } + + /** + * Set type name defined by the schema. Applicable only if 'contentType' value is neither 'application/x-www-form-urlencoded' nor 'multipart/form-data'. + * + * @param typeName the typeName value to set + * @return the RepresentationContract object itself. + */ + public RepresentationContract withTypeName(String typeName) { + this.typeName = typeName; + return this; + } + + /** + * Get collection of form parameters. Required if 'contentType' value is either 'application/x-www-form-urlencoded' or 'multipart/form-data'.. + * + * @return the formParameters value + */ + public List formParameters() { + return this.formParameters; + } + + /** + * Set collection of form parameters. Required if 'contentType' value is either 'application/x-www-form-urlencoded' or 'multipart/form-data'.. + * + * @param formParameters the formParameters value to set + * @return the RepresentationContract object itself. + */ + public RepresentationContract withFormParameters(List formParameters) { + this.formParameters = formParameters; + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/RequestContract.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/RequestContract.java new file mode 100644 index 0000000000000..6f69e724deb9d --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/RequestContract.java @@ -0,0 +1,122 @@ +/** + * 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.apimanagement.v2019_01_01; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Operation request details. + */ +public class RequestContract { + /** + * Operation request description. + */ + @JsonProperty(value = "description") + private String description; + + /** + * Collection of operation request query parameters. + */ + @JsonProperty(value = "queryParameters") + private List queryParameters; + + /** + * Collection of operation request headers. + */ + @JsonProperty(value = "headers") + private List headers; + + /** + * Collection of operation request representations. + */ + @JsonProperty(value = "representations") + private List representations; + + /** + * Get operation request description. + * + * @return the description value + */ + public String description() { + return this.description; + } + + /** + * Set operation request description. + * + * @param description the description value to set + * @return the RequestContract object itself. + */ + public RequestContract withDescription(String description) { + this.description = description; + return this; + } + + /** + * Get collection of operation request query parameters. + * + * @return the queryParameters value + */ + public List queryParameters() { + return this.queryParameters; + } + + /** + * Set collection of operation request query parameters. + * + * @param queryParameters the queryParameters value to set + * @return the RequestContract object itself. + */ + public RequestContract withQueryParameters(List queryParameters) { + this.queryParameters = queryParameters; + return this; + } + + /** + * Get collection of operation request headers. + * + * @return the headers value + */ + public List headers() { + return this.headers; + } + + /** + * Set collection of operation request headers. + * + * @param headers the headers value to set + * @return the RequestContract object itself. + */ + public RequestContract withHeaders(List headers) { + this.headers = headers; + return this; + } + + /** + * Get collection of operation request representations. + * + * @return the representations value + */ + public List representations() { + return this.representations; + } + + /** + * Set collection of operation request representations. + * + * @param representations the representations value to set + * @return the RequestContract object itself. + */ + public RequestContract withRepresentations(List representations) { + this.representations = representations; + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/RequestReportRecordContract.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/RequestReportRecordContract.java new file mode 100644 index 0000000000000..3c0933c4e733c --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/RequestReportRecordContract.java @@ -0,0 +1,111 @@ +/** + * 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.apimanagement.v2019_01_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.apimanagement.v2019_01_01.implementation.ApiManagementManager; +import com.microsoft.azure.management.apimanagement.v2019_01_01.implementation.RequestReportRecordContractInner; +import org.joda.time.DateTime; + +/** + * Type representing RequestReportRecordContract. + */ +public interface RequestReportRecordContract extends HasInner, HasManager { + /** + * @return the apiId value. + */ + String apiId(); + + /** + * @return the apiRegion value. + */ + String apiRegion(); + + /** + * @return the apiTime value. + */ + Double apiTime(); + + /** + * @return the backendResponseCode value. + */ + String backendResponseCode(); + + /** + * @return the cache value. + */ + String cache(); + + /** + * @return the ipAddress value. + */ + String ipAddress(); + + /** + * @return the method value. + */ + String method(); + + /** + * @return the operationId value. + */ + String operationId(); + + /** + * @return the productId value. + */ + String productId(); + + /** + * @return the requestId value. + */ + String requestId(); + + /** + * @return the requestSize value. + */ + Integer requestSize(); + + /** + * @return the responseCode value. + */ + Integer responseCode(); + + /** + * @return the responseSize value. + */ + Integer responseSize(); + + /** + * @return the serviceTime value. + */ + Double serviceTime(); + + /** + * @return the subscriptionId value. + */ + String subscriptionId(); + + /** + * @return the timestamp value. + */ + DateTime timestamp(); + + /** + * @return the url value. + */ + String url(); + + /** + * @return the userId value. + */ + String userId(); + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ResourceSku.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ResourceSku.java new file mode 100644 index 0000000000000..8b2b154428beb --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ResourceSku.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.apimanagement.v2019_01_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Describes an available API Management SKU. + */ +public class ResourceSku { + /** + * Name of the Sku. Possible values include: 'Developer', 'Standard', + * 'Premium', 'Basic', 'Consumption'. + */ + @JsonProperty(value = "name") + private SkuType name; + + /** + * Get name of the Sku. Possible values include: 'Developer', 'Standard', 'Premium', 'Basic', 'Consumption'. + * + * @return the name value + */ + public SkuType name() { + return this.name; + } + + /** + * Set name of the Sku. Possible values include: 'Developer', 'Standard', 'Premium', 'Basic', 'Consumption'. + * + * @param name the name value to set + * @return the ResourceSku object itself. + */ + public ResourceSku withName(SkuType name) { + this.name = name; + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ResourceSkuCapacity.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ResourceSkuCapacity.java new file mode 100644 index 0000000000000..d40dc0b6b04a7 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ResourceSkuCapacity.java @@ -0,0 +1,78 @@ +/** + * 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.apimanagement.v2019_01_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Describes scaling information of a SKU. + */ +public class ResourceSkuCapacity { + /** + * The minimum capacity. + */ + @JsonProperty(value = "minimum", access = JsonProperty.Access.WRITE_ONLY) + private Integer minimum; + + /** + * The maximum capacity that can be set. + */ + @JsonProperty(value = "maximum", access = JsonProperty.Access.WRITE_ONLY) + private Integer maximum; + + /** + * The default capacity. + */ + @JsonProperty(value = "default", access = JsonProperty.Access.WRITE_ONLY) + private Integer defaultProperty; + + /** + * The scale type applicable to the sku. Possible values include: + * 'automatic', 'manual', 'none'. + */ + @JsonProperty(value = "scaleType", access = JsonProperty.Access.WRITE_ONLY) + private ResourceSkuCapacityScaleType scaleType; + + /** + * Get the minimum capacity. + * + * @return the minimum value + */ + public Integer minimum() { + return this.minimum; + } + + /** + * Get the maximum capacity that can be set. + * + * @return the maximum value + */ + public Integer maximum() { + return this.maximum; + } + + /** + * Get the default capacity. + * + * @return the defaultProperty value + */ + public Integer defaultProperty() { + return this.defaultProperty; + } + + /** + * Get the scale type applicable to the sku. Possible values include: 'automatic', 'manual', 'none'. + * + * @return the scaleType value + */ + public ResourceSkuCapacityScaleType scaleType() { + return this.scaleType; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ResourceSkuCapacityScaleType.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ResourceSkuCapacityScaleType.java new file mode 100644 index 0000000000000..ae72db5f0f19f --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ResourceSkuCapacityScaleType.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.apimanagement.v2019_01_01; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for ResourceSkuCapacityScaleType. + */ +public final class ResourceSkuCapacityScaleType extends ExpandableStringEnum { + /** Static value automatic for ResourceSkuCapacityScaleType. */ + public static final ResourceSkuCapacityScaleType AUTOMATIC = fromString("automatic"); + + /** Static value manual for ResourceSkuCapacityScaleType. */ + public static final ResourceSkuCapacityScaleType MANUAL = fromString("manual"); + + /** Static value none for ResourceSkuCapacityScaleType. */ + public static final ResourceSkuCapacityScaleType NONE = fromString("none"); + + /** + * Creates or finds a ResourceSkuCapacityScaleType from its string representation. + * @param name a name to look for + * @return the corresponding ResourceSkuCapacityScaleType + */ + @JsonCreator + public static ResourceSkuCapacityScaleType fromString(String name) { + return fromString(name, ResourceSkuCapacityScaleType.class); + } + + /** + * @return known ResourceSkuCapacityScaleType values + */ + public static Collection values() { + return values(ResourceSkuCapacityScaleType.class); + } +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ResourceSkuResult.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ResourceSkuResult.java new file mode 100644 index 0000000000000..57e3bec613488 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ResourceSkuResult.java @@ -0,0 +1,35 @@ +/** + * 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.apimanagement.v2019_01_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.apimanagement.v2019_01_01.implementation.ApiManagementManager; +import com.microsoft.azure.management.apimanagement.v2019_01_01.implementation.ResourceSkuResultInner; + +/** + * Type representing ResourceSkuResult. + */ +public interface ResourceSkuResult extends HasInner, HasManager { + /** + * @return the capacity value. + */ + ResourceSkuCapacity capacity(); + + /** + * @return the resourceType value. + */ + String resourceType(); + + /** + * @return the sku value. + */ + ResourceSku sku(); + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ResponseContract.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ResponseContract.java new file mode 100644 index 0000000000000..307cdcdc8702a --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ResponseContract.java @@ -0,0 +1,122 @@ +/** + * 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.apimanagement.v2019_01_01; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Operation response details. + */ +public class ResponseContract { + /** + * Operation response HTTP status code. + */ + @JsonProperty(value = "statusCode", required = true) + private int statusCode; + + /** + * Operation response description. + */ + @JsonProperty(value = "description") + private String description; + + /** + * Collection of operation response representations. + */ + @JsonProperty(value = "representations") + private List representations; + + /** + * Collection of operation response headers. + */ + @JsonProperty(value = "headers") + private List headers; + + /** + * Get operation response HTTP status code. + * + * @return the statusCode value + */ + public int statusCode() { + return this.statusCode; + } + + /** + * Set operation response HTTP status code. + * + * @param statusCode the statusCode value to set + * @return the ResponseContract object itself. + */ + public ResponseContract withStatusCode(int statusCode) { + this.statusCode = statusCode; + return this; + } + + /** + * Get operation response description. + * + * @return the description value + */ + public String description() { + return this.description; + } + + /** + * Set operation response description. + * + * @param description the description value to set + * @return the ResponseContract object itself. + */ + public ResponseContract withDescription(String description) { + this.description = description; + return this; + } + + /** + * Get collection of operation response representations. + * + * @return the representations value + */ + public List representations() { + return this.representations; + } + + /** + * Set collection of operation response representations. + * + * @param representations the representations value to set + * @return the ResponseContract object itself. + */ + public ResponseContract withRepresentations(List representations) { + this.representations = representations; + return this; + } + + /** + * Get collection of operation response headers. + * + * @return the headers value + */ + public List headers() { + return this.headers; + } + + /** + * Set collection of operation response headers. + * + * @param headers the headers value to set + * @return the ResponseContract object itself. + */ + public ResponseContract withHeaders(List headers) { + this.headers = headers; + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/SamplingSettings.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/SamplingSettings.java new file mode 100644 index 0000000000000..7b699844168cd --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/SamplingSettings.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.apimanagement.v2019_01_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Sampling settings for Diagnostic. + */ +public class SamplingSettings { + /** + * Sampling type. Possible values include: 'fixed'. + */ + @JsonProperty(value = "samplingType") + private SamplingType samplingType; + + /** + * Rate of sampling for fixed-rate sampling. + */ + @JsonProperty(value = "percentage") + private Double percentage; + + /** + * Get sampling type. Possible values include: 'fixed'. + * + * @return the samplingType value + */ + public SamplingType samplingType() { + return this.samplingType; + } + + /** + * Set sampling type. Possible values include: 'fixed'. + * + * @param samplingType the samplingType value to set + * @return the SamplingSettings object itself. + */ + public SamplingSettings withSamplingType(SamplingType samplingType) { + this.samplingType = samplingType; + return this; + } + + /** + * Get rate of sampling for fixed-rate sampling. + * + * @return the percentage value + */ + public Double percentage() { + return this.percentage; + } + + /** + * Set rate of sampling for fixed-rate sampling. + * + * @param percentage the percentage value to set + * @return the SamplingSettings object itself. + */ + public SamplingSettings withPercentage(Double percentage) { + this.percentage = percentage; + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/SamplingType.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/SamplingType.java new file mode 100644 index 0000000000000..e2399da1f3dd6 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/SamplingType.java @@ -0,0 +1,38 @@ +/** + * 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.apimanagement.v2019_01_01; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for SamplingType. + */ +public final class SamplingType extends ExpandableStringEnum { + /** Static value fixed for SamplingType. */ + public static final SamplingType FIXED = fromString("fixed"); + + /** + * Creates or finds a SamplingType from its string representation. + * @param name a name to look for + * @return the corresponding SamplingType + */ + @JsonCreator + public static SamplingType fromString(String name) { + return fromString(name, SamplingType.class); + } + + /** + * @return known SamplingType values + */ + public static Collection values() { + return values(SamplingType.class); + } +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/SaveConfigurationParameter.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/SaveConfigurationParameter.java new file mode 100644 index 0000000000000..51591b13c6873 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/SaveConfigurationParameter.java @@ -0,0 +1,74 @@ +/** + * 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.apimanagement.v2019_01_01; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; + +/** + * Save Tenant Configuration Contract details. + */ +@JsonFlatten +public class SaveConfigurationParameter { + /** + * The name of the Git branch in which to commit the current configuration + * snapshot. + */ + @JsonProperty(value = "properties.branch", required = true) + private String branch; + + /** + * The value if true, the current configuration database is committed to + * the Git repository, even if the Git repository has newer changes that + * would be overwritten. + */ + @JsonProperty(value = "properties.force") + private Boolean force; + + /** + * Get the name of the Git branch in which to commit the current configuration snapshot. + * + * @return the branch value + */ + public String branch() { + return this.branch; + } + + /** + * Set the name of the Git branch in which to commit the current configuration snapshot. + * + * @param branch the branch value to set + * @return the SaveConfigurationParameter object itself. + */ + public SaveConfigurationParameter withBranch(String branch) { + this.branch = branch; + return this; + } + + /** + * Get the value if true, the current configuration database is committed to the Git repository, even if the Git repository has newer changes that would be overwritten. + * + * @return the force value + */ + public Boolean force() { + return this.force; + } + + /** + * Set the value if true, the current configuration database is committed to the Git repository, even if the Git repository has newer changes that would be overwritten. + * + * @param force the force value to set + * @return the SaveConfigurationParameter object itself. + */ + public SaveConfigurationParameter withForce(Boolean force) { + this.force = force; + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/SchemaContract.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/SchemaContract.java new file mode 100644 index 0000000000000..726d114748b03 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/SchemaContract.java @@ -0,0 +1,159 @@ +/** + * 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.apimanagement.v2019_01_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.apimanagement.v2019_01_01.implementation.SchemaContractInner; +import com.microsoft.azure.arm.model.Indexable; +import com.microsoft.azure.arm.model.Refreshable; +import com.microsoft.azure.arm.model.Updatable; +import com.microsoft.azure.arm.model.Appliable; +import com.microsoft.azure.arm.model.Creatable; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.apimanagement.v2019_01_01.implementation.ApiManagementManager; + +/** + * Type representing SchemaContract. + */ +public interface SchemaContract extends HasInner, Indexable, Refreshable, Updatable, HasManager { + /** + * @return the contentType value. + */ + String contentType(); + + /** + * @return the document value. + */ + Object document(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the type value. + */ + String type(); + + /** + * The entirety of the SchemaContract definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithApi, DefinitionStages.WithIfMatch, DefinitionStages.WithContentType, DefinitionStages.WithCreate { + } + + /** + * Grouping of SchemaContract definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a SchemaContract definition. + */ + interface Blank extends WithApi { + } + + /** + * The stage of the schemacontract definition allowing to specify Api. + */ + interface WithApi { + /** + * Specifies resourceGroupName, serviceName, apiId. + * @param resourceGroupName The name of the resource group + * @param serviceName The name of the API Management service + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number + * @return the next definition stage + */ + WithIfMatch withExistingApi(String resourceGroupName, String serviceName, String apiId); + } + + /** + * The stage of the schemacontract definition allowing to specify IfMatch. + */ + interface WithIfMatch { + /** + * Specifies ifMatch. + * @param ifMatch ETag of the Entity. Not required when creating an entity, but required when updating an entity + * @return the next definition stage + */ + WithContentType withIfMatch(String ifMatch); + } + + /** + * The stage of the schemacontract definition allowing to specify ContentType. + */ + interface WithContentType { + /** + * Specifies contentType. + * @param contentType Must be a valid a media type used in a Content-Type header as defined in the RFC 2616. Media type of the schema document (e.g. application/json, application/xml). </br> - `Swagger` Schema use `application/vnd.ms-azure-apim.swagger.definitions+json` </br> - `WSDL` Schema use `application/vnd.ms-azure-apim.xsd+xml` </br> - `OpenApi` Schema use `application/vnd.oai.openapi.components+json` </br> - `WADL Schema` use `application/vnd.ms-azure-apim.wadl.grammars+xml` + * @return the next definition stage + */ + WithCreate withContentType(String contentType); + } + + /** + * The stage of the schemacontract definition allowing to specify Value. + */ + interface WithValue { + /** + * Specifies value. + * @param value Json escaped string defining the document representing the Schema + * @return the next definition stage + */ + WithCreate withValue(String value); + } + + /** + * The stage of the definition which contains all the minimum required inputs for + * the resource to be created (via {@link WithCreate#create()}), but also allows + * for any other optional settings to be specified. + */ + interface WithCreate extends Creatable, DefinitionStages.WithValue { + } + } + /** + * The template for a SchemaContract update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithIfMatch, UpdateStages.WithValue { + } + + /** + * Grouping of SchemaContract update stages. + */ + interface UpdateStages { + /** + * The stage of the schemacontract update allowing to specify IfMatch. + */ + interface WithIfMatch { + /** + * Specifies ifMatch. + * @param ifMatch ETag of the Entity. Not required when creating an entity, but required when updating an entity + * @return the next update stage + */ + Update withIfMatch(String ifMatch); + } + + /** + * The stage of the schemacontract update allowing to specify Value. + */ + interface WithValue { + /** + * Specifies value. + * @param value Json escaped string defining the document representing the Schema + * @return the next update stage + */ + Update withValue(String value); + } + + } +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/SchemaCreateOrUpdateContract.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/SchemaCreateOrUpdateContract.java new file mode 100644 index 0000000000000..05feb05a47696 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/SchemaCreateOrUpdateContract.java @@ -0,0 +1,79 @@ +/** + * 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.apimanagement.v2019_01_01; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * Schema Contract details. + */ +@JsonFlatten +public class SchemaCreateOrUpdateContract extends ProxyResource { + /** + * Must be a valid a media type used in a Content-Type header as defined in + * the RFC 2616. Media type of the schema document (e.g. application/json, + * application/xml). </br> - `Swagger` Schema use + * `application/vnd.ms-azure-apim.swagger.definitions+json` </br> - + * `WSDL` Schema use `application/vnd.ms-azure-apim.xsd+xml` </br> - + * `OpenApi` Schema use `application/vnd.oai.openapi.components+json` + * </br> - `WADL Schema` use + * `application/vnd.ms-azure-apim.wadl.grammars+xml`. + */ + @JsonProperty(value = "properties.contentType", required = true) + private String contentType; + + /** + * Json escaped string defining the document representing the Schema. + */ + @JsonProperty(value = "properties.document.value") + private String value; + + /** + * Get must be a valid a media type used in a Content-Type header as defined in the RFC 2616. Media type of the schema document (e.g. application/json, application/xml). </br> - `Swagger` Schema use `application/vnd.ms-azure-apim.swagger.definitions+json` </br> - `WSDL` Schema use `application/vnd.ms-azure-apim.xsd+xml` </br> - `OpenApi` Schema use `application/vnd.oai.openapi.components+json` </br> - `WADL Schema` use `application/vnd.ms-azure-apim.wadl.grammars+xml`. + * + * @return the contentType value + */ + public String contentType() { + return this.contentType; + } + + /** + * Set must be a valid a media type used in a Content-Type header as defined in the RFC 2616. Media type of the schema document (e.g. application/json, application/xml). </br> - `Swagger` Schema use `application/vnd.ms-azure-apim.swagger.definitions+json` </br> - `WSDL` Schema use `application/vnd.ms-azure-apim.xsd+xml` </br> - `OpenApi` Schema use `application/vnd.oai.openapi.components+json` </br> - `WADL Schema` use `application/vnd.ms-azure-apim.wadl.grammars+xml`. + * + * @param contentType the contentType value to set + * @return the SchemaCreateOrUpdateContract object itself. + */ + public SchemaCreateOrUpdateContract withContentType(String contentType) { + this.contentType = contentType; + return this; + } + + /** + * Get json escaped string defining the document representing the Schema. + * + * @return the value value + */ + public String value() { + return this.value; + } + + /** + * Set json escaped string defining the document representing the Schema. + * + * @param value the value value to set + * @return the SchemaCreateOrUpdateContract object itself. + */ + public SchemaCreateOrUpdateContract withValue(String value) { + this.value = value; + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/SignInSettings.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/SignInSettings.java new file mode 100644 index 0000000000000..679457e787bda --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/SignInSettings.java @@ -0,0 +1,61 @@ +/** + * 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.apimanagement.v2019_01_01; + +import rx.Completable; +import rx.Observable; +import com.microsoft.azure.management.apimanagement.v2019_01_01.implementation.SignInSettingsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing SignInSettings. + */ +public interface SignInSettings extends HasInner { + /** + * Gets the entity state (Etag) version of the SignInSettings. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable getEntityTagAsync(String resourceGroupName, String serviceName); + + /** + * Get Sign In Settings for the Portal. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String resourceGroupName, String serviceName); + + /** + * Update Sign-In settings. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable updateAsync(String resourceGroupName, String serviceName, String ifMatch); + + /** + * Create or Update Sign-In settings. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable createOrUpdateAsync(String resourceGroupName, String serviceName); + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/SignInSettingsGetEntityTagHeaders.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/SignInSettingsGetEntityTagHeaders.java new file mode 100644 index 0000000000000..ac499920d09b2 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/SignInSettingsGetEntityTagHeaders.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.apimanagement.v2019_01_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for GetEntityTag operation. + */ +public class SignInSettingsGetEntityTagHeaders { + /** + * Current entity state version. Should be treated as opaque and used to + * make conditional HTTP requests. + */ + @JsonProperty(value = "ETag") + private String eTag; + + /** + * Get current entity state version. Should be treated as opaque and used to make conditional HTTP requests. + * + * @return the eTag value + */ + public String eTag() { + return this.eTag; + } + + /** + * Set current entity state version. Should be treated as opaque and used to make conditional HTTP requests. + * + * @param eTag the eTag value to set + * @return the SignInSettingsGetEntityTagHeaders object itself. + */ + public SignInSettingsGetEntityTagHeaders withETag(String eTag) { + this.eTag = eTag; + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/SignInSettingsGetHeaders.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/SignInSettingsGetHeaders.java new file mode 100644 index 0000000000000..e6cebb6be15bd --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/SignInSettingsGetHeaders.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.apimanagement.v2019_01_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for Get operation. + */ +public class SignInSettingsGetHeaders { + /** + * Current entity state version. Should be treated as opaque and used to + * make conditional HTTP requests. + */ + @JsonProperty(value = "ETag") + private String eTag; + + /** + * Get current entity state version. Should be treated as opaque and used to make conditional HTTP requests. + * + * @return the eTag value + */ + public String eTag() { + return this.eTag; + } + + /** + * Set current entity state version. Should be treated as opaque and used to make conditional HTTP requests. + * + * @param eTag the eTag value to set + * @return the SignInSettingsGetHeaders object itself. + */ + public SignInSettingsGetHeaders withETag(String eTag) { + this.eTag = eTag; + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/SignUpSettings.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/SignUpSettings.java new file mode 100644 index 0000000000000..169f63e91d86d --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/SignUpSettings.java @@ -0,0 +1,64 @@ +/** + * 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.apimanagement.v2019_01_01; + +import rx.Completable; +import rx.Observable; +import com.microsoft.azure.management.apimanagement.v2019_01_01.implementation.PortalSignupSettingsInner; +import com.microsoft.azure.management.apimanagement.v2019_01_01.implementation.SignUpSettingsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing SignUpSettings. + */ +public interface SignUpSettings extends HasInner { + /** + * Gets the entity state (Etag) version of the SignUpSettings. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable getEntityTagAsync(String resourceGroupName, String serviceName); + + /** + * Get Sign Up Settings for the Portal. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String resourceGroupName, String serviceName); + + /** + * Update Sign-Up settings. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param parameters Update Sign-Up settings. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable updateAsync(String resourceGroupName, String serviceName, PortalSignupSettingsInner parameters, String ifMatch); + + /** + * Create or Update Sign-Up settings. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param parameters Create or update parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable createOrUpdateAsync(String resourceGroupName, String serviceName, PortalSignupSettingsInner parameters); + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/SignUpSettingsGetEntityTagHeaders.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/SignUpSettingsGetEntityTagHeaders.java new file mode 100644 index 0000000000000..72254246d4167 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/SignUpSettingsGetEntityTagHeaders.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.apimanagement.v2019_01_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for GetEntityTag operation. + */ +public class SignUpSettingsGetEntityTagHeaders { + /** + * Current entity state version. Should be treated as opaque and used to + * make conditional HTTP requests. + */ + @JsonProperty(value = "ETag") + private String eTag; + + /** + * Get current entity state version. Should be treated as opaque and used to make conditional HTTP requests. + * + * @return the eTag value + */ + public String eTag() { + return this.eTag; + } + + /** + * Set current entity state version. Should be treated as opaque and used to make conditional HTTP requests. + * + * @param eTag the eTag value to set + * @return the SignUpSettingsGetEntityTagHeaders object itself. + */ + public SignUpSettingsGetEntityTagHeaders withETag(String eTag) { + this.eTag = eTag; + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/SignUpSettingsGetHeaders.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/SignUpSettingsGetHeaders.java new file mode 100644 index 0000000000000..168ce1e2dec08 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/SignUpSettingsGetHeaders.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.apimanagement.v2019_01_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for Get operation. + */ +public class SignUpSettingsGetHeaders { + /** + * Current entity state version. Should be treated as opaque and used to + * make conditional HTTP requests. + */ + @JsonProperty(value = "ETag") + private String eTag; + + /** + * Get current entity state version. Should be treated as opaque and used to make conditional HTTP requests. + * + * @return the eTag value + */ + public String eTag() { + return this.eTag; + } + + /** + * Set current entity state version. Should be treated as opaque and used to make conditional HTTP requests. + * + * @param eTag the eTag value to set + * @return the SignUpSettingsGetHeaders object itself. + */ + public SignUpSettingsGetHeaders withETag(String eTag) { + this.eTag = eTag; + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/SkuType.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/SkuType.java new file mode 100644 index 0000000000000..729a05eccea48 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/SkuType.java @@ -0,0 +1,50 @@ +/** + * 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.apimanagement.v2019_01_01; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for SkuType. + */ +public final class SkuType extends ExpandableStringEnum { + /** Static value Developer for SkuType. */ + public static final SkuType DEVELOPER = fromString("Developer"); + + /** Static value Standard for SkuType. */ + public static final SkuType STANDARD = fromString("Standard"); + + /** Static value Premium for SkuType. */ + public static final SkuType PREMIUM = fromString("Premium"); + + /** Static value Basic for SkuType. */ + public static final SkuType BASIC = fromString("Basic"); + + /** Static value Consumption for SkuType. */ + public static final SkuType CONSUMPTION = fromString("Consumption"); + + /** + * Creates or finds a SkuType from its string representation. + * @param name a name to look for + * @return the corresponding SkuType + */ + @JsonCreator + public static SkuType fromString(String name) { + return fromString(name, SkuType.class); + } + + /** + * @return known SkuType values + */ + public static Collection values() { + return values(SkuType.class); + } +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/SoapApiType.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/SoapApiType.java new file mode 100644 index 0000000000000..59d13bfc568a8 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/SoapApiType.java @@ -0,0 +1,41 @@ +/** + * 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.apimanagement.v2019_01_01; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for SoapApiType. + */ +public final class SoapApiType extends ExpandableStringEnum { + /** Static value http for SoapApiType. */ + public static final SoapApiType SOAP_TO_REST = fromString("http"); + + /** Static value soap for SoapApiType. */ + public static final SoapApiType SOAP_PASS_THROUGH = fromString("soap"); + + /** + * Creates or finds a SoapApiType from its string representation. + * @param name a name to look for + * @return the corresponding SoapApiType + */ + @JsonCreator + public static SoapApiType fromString(String name) { + return fromString(name, SoapApiType.class); + } + + /** + * @return known SoapApiType values + */ + public static Collection values() { + return values(SoapApiType.class); + } +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/State.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/State.java new file mode 100644 index 0000000000000..58695b010c6d6 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/State.java @@ -0,0 +1,50 @@ +/** + * 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.apimanagement.v2019_01_01; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for State. + */ +public final class State extends ExpandableStringEnum { + /** Static value proposed for State. */ + public static final State PROPOSED = fromString("proposed"); + + /** Static value open for State. */ + public static final State OPEN = fromString("open"); + + /** Static value removed for State. */ + public static final State REMOVED = fromString("removed"); + + /** Static value resolved for State. */ + public static final State RESOLVED = fromString("resolved"); + + /** Static value closed for State. */ + public static final State CLOSED = fromString("closed"); + + /** + * Creates or finds a State from its string representation. + * @param name a name to look for + * @return the corresponding State + */ + @JsonCreator + public static State fromString(String name) { + return fromString(name, State.class); + } + + /** + * @return known State values + */ + public static Collection values() { + return values(State.class); + } +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/SubscriptionContract.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/SubscriptionContract.java new file mode 100644 index 0000000000000..ecaa5048fb5ce --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/SubscriptionContract.java @@ -0,0 +1,360 @@ +/** + * 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.apimanagement.v2019_01_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.apimanagement.v2019_01_01.implementation.SubscriptionContractInner; +import com.microsoft.azure.arm.model.Indexable; +import com.microsoft.azure.arm.model.Creatable; +import com.microsoft.azure.arm.model.Updatable; +import com.microsoft.azure.arm.model.Appliable; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.apimanagement.v2019_01_01.implementation.ApiManagementManager; +import org.joda.time.DateTime; + +/** + * Type representing SubscriptionContract. + */ +public interface SubscriptionContract extends HasInner, Indexable, Updatable, HasManager { + /** + * @return the allowTracing value. + */ + Boolean allowTracing(); + + /** + * @return the createdDate value. + */ + DateTime createdDate(); + + /** + * @return the displayName value. + */ + String displayName(); + + /** + * @return the endDate value. + */ + DateTime endDate(); + + /** + * @return the expirationDate value. + */ + DateTime expirationDate(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the notificationDate value. + */ + DateTime notificationDate(); + + /** + * @return the ownerId value. + */ + String ownerId(); + + /** + * @return the primaryKey value. + */ + String primaryKey(); + + /** + * @return the scope value. + */ + String scope(); + + /** + * @return the secondaryKey value. + */ + String secondaryKey(); + + /** + * @return the startDate value. + */ + DateTime startDate(); + + /** + * @return the state value. + */ + SubscriptionState state(); + + /** + * @return the stateComment value. + */ + String stateComment(); + + /** + * @return the type value. + */ + String type(); + + /** + * The entirety of the SubscriptionContract definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithResourceGroupName, DefinitionStages.WithServiceName, DefinitionStages.WithNotify, DefinitionStages.WithIfMatch, DefinitionStages.WithDisplayName, DefinitionStages.WithScope, DefinitionStages.WithCreate { + } + + /** + * Grouping of SubscriptionContract definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a SubscriptionContract definition. + */ + interface Blank extends WithResourceGroupName { + } + + /** + * The stage of the subscriptioncontract definition allowing to specify ResourceGroupName. + */ + interface WithResourceGroupName { + /** + * Specifies resourceGroupName. + * @param resourceGroupName The name of the resource group + * @return the next definition stage + */ + WithServiceName withResourceGroupName(String resourceGroupName); + } + + /** + * The stage of the subscriptioncontract definition allowing to specify ServiceName. + */ + interface WithServiceName { + /** + * Specifies serviceName. + * @param serviceName The name of the API Management service + * @return the next definition stage + */ + WithNotify withServiceName(String serviceName); + } + + /** + * The stage of the subscriptioncontract definition allowing to specify Notify. + */ + interface WithNotify { + /** + * Specifies notify. + * @param notify Notify change in Subscription State. + - If false, do not send any email notification for change of state of subscription + - If true, send email notification of change of state of subscription + * @return the next definition stage + */ + WithIfMatch withNotify(Boolean notify); + } + + /** + * The stage of the subscriptioncontract definition allowing to specify IfMatch. + */ + interface WithIfMatch { + /** + * Specifies ifMatch. + * @param ifMatch ETag of the Entity. Not required when creating an entity, but required when updating an entity + * @return the next definition stage + */ + WithDisplayName withIfMatch(String ifMatch); + } + + /** + * The stage of the subscriptioncontract definition allowing to specify DisplayName. + */ + interface WithDisplayName { + /** + * Specifies displayName. + * @param displayName Subscription name + * @return the next definition stage + */ + WithScope withDisplayName(String displayName); + } + + /** + * The stage of the subscriptioncontract definition allowing to specify Scope. + */ + interface WithScope { + /** + * Specifies scope. + * @param scope Scope like /products/{productId} or /apis or /apis/{apiId} + * @return the next definition stage + */ + WithCreate withScope(String scope); + } + + /** + * The stage of the subscriptioncontract definition allowing to specify AllowTracing. + */ + interface WithAllowTracing { + /** + * Specifies allowTracing. + * @param allowTracing Determines whether tracing can be enabled + * @return the next definition stage + */ + WithCreate withAllowTracing(Boolean allowTracing); + } + + /** + * The stage of the subscriptioncontract definition allowing to specify OwnerId. + */ + interface WithOwnerId { + /** + * Specifies ownerId. + * @param ownerId User (user id path) for whom subscription is being created in form /users/{userId} + * @return the next definition stage + */ + WithCreate withOwnerId(String ownerId); + } + + /** + * The stage of the subscriptioncontract definition allowing to specify PrimaryKey. + */ + interface WithPrimaryKey { + /** + * Specifies primaryKey. + * @param primaryKey Primary subscription key. If not specified during request key will be generated automatically + * @return the next definition stage + */ + WithCreate withPrimaryKey(String primaryKey); + } + + /** + * The stage of the subscriptioncontract definition allowing to specify SecondaryKey. + */ + interface WithSecondaryKey { + /** + * Specifies secondaryKey. + * @param secondaryKey Secondary subscription key. If not specified during request key will be generated automatically + * @return the next definition stage + */ + WithCreate withSecondaryKey(String secondaryKey); + } + + /** + * The stage of the subscriptioncontract definition allowing to specify State. + */ + interface WithState { + /** + * Specifies state. + * @param state Initial subscription state. If no value is specified, subscription is created with Submitted state. Possible states are * active – the subscription is active, * suspended – the subscription is blocked, and the subscriber cannot call any APIs of the product, * submitted – the subscription request has been made by the developer, but has not yet been approved or rejected, * rejected – the subscription request has been denied by an administrator, * cancelled – the subscription has been cancelled by the developer or administrator, * expired – the subscription reached its expiration date and was deactivated. Possible values include: 'suspended', 'active', 'expired', 'submitted', 'rejected', 'cancelled' + * @return the next definition stage + */ + WithCreate withState(SubscriptionState state); + } + + /** + * The stage of the definition which contains all the minimum required inputs for + * the resource to be created (via {@link WithCreate#create()}), but also allows + * for any other optional settings to be specified. + */ + interface WithCreate extends Creatable, DefinitionStages.WithAllowTracing, DefinitionStages.WithOwnerId, DefinitionStages.WithPrimaryKey, DefinitionStages.WithSecondaryKey, DefinitionStages.WithState { + } + } + /** + * The template for a SubscriptionContract update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithNotify, UpdateStages.WithIfMatch, UpdateStages.WithAllowTracing, UpdateStages.WithOwnerId, UpdateStages.WithPrimaryKey, UpdateStages.WithSecondaryKey, UpdateStages.WithState { + } + + /** + * Grouping of SubscriptionContract update stages. + */ + interface UpdateStages { + /** + * The stage of the subscriptioncontract update allowing to specify Notify. + */ + interface WithNotify { + /** + * Specifies notify. + * @param notify Notify change in Subscription State. + - If false, do not send any email notification for change of state of subscription + - If true, send email notification of change of state of subscription + * @return the next update stage + */ + Update withNotify(Boolean notify); + } + + /** + * The stage of the subscriptioncontract update allowing to specify IfMatch. + */ + interface WithIfMatch { + /** + * Specifies ifMatch. + * @param ifMatch ETag of the Entity. Not required when creating an entity, but required when updating an entity + * @return the next update stage + */ + Update withIfMatch(String ifMatch); + } + + /** + * The stage of the subscriptioncontract update allowing to specify AllowTracing. + */ + interface WithAllowTracing { + /** + * Specifies allowTracing. + * @param allowTracing Determines whether tracing can be enabled + * @return the next update stage + */ + Update withAllowTracing(Boolean allowTracing); + } + + /** + * The stage of the subscriptioncontract update allowing to specify OwnerId. + */ + interface WithOwnerId { + /** + * Specifies ownerId. + * @param ownerId User (user id path) for whom subscription is being created in form /users/{userId} + * @return the next update stage + */ + Update withOwnerId(String ownerId); + } + + /** + * The stage of the subscriptioncontract update allowing to specify PrimaryKey. + */ + interface WithPrimaryKey { + /** + * Specifies primaryKey. + * @param primaryKey Primary subscription key. If not specified during request key will be generated automatically + * @return the next update stage + */ + Update withPrimaryKey(String primaryKey); + } + + /** + * The stage of the subscriptioncontract update allowing to specify SecondaryKey. + */ + interface WithSecondaryKey { + /** + * Specifies secondaryKey. + * @param secondaryKey Secondary subscription key. If not specified during request key will be generated automatically + * @return the next update stage + */ + Update withSecondaryKey(String secondaryKey); + } + + /** + * The stage of the subscriptioncontract update allowing to specify State. + */ + interface WithState { + /** + * Specifies state. + * @param state Initial subscription state. If no value is specified, subscription is created with Submitted state. Possible states are * active – the subscription is active, * suspended – the subscription is blocked, and the subscriber cannot call any APIs of the product, * submitted – the subscription request has been made by the developer, but has not yet been approved or rejected, * rejected – the subscription request has been denied by an administrator, * cancelled – the subscription has been cancelled by the developer or administrator, * expired – the subscription reached its expiration date and was deactivated. Possible values include: 'suspended', 'active', 'expired', 'submitted', 'rejected', 'cancelled' + * @return the next update stage + */ + Update withState(SubscriptionState state); + } + + } +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/SubscriptionCreateOrUpdateHeaders.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/SubscriptionCreateOrUpdateHeaders.java new file mode 100644 index 0000000000000..be309d9ea680a --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/SubscriptionCreateOrUpdateHeaders.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.apimanagement.v2019_01_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for CreateOrUpdate operation. + */ +public class SubscriptionCreateOrUpdateHeaders { + /** + * Current entity state version. Should be treated as opaque and used to + * make conditional HTTP requests. + */ + @JsonProperty(value = "ETag") + private String eTag; + + /** + * Get current entity state version. Should be treated as opaque and used to make conditional HTTP requests. + * + * @return the eTag value + */ + public String eTag() { + return this.eTag; + } + + /** + * Set current entity state version. Should be treated as opaque and used to make conditional HTTP requests. + * + * @param eTag the eTag value to set + * @return the SubscriptionCreateOrUpdateHeaders object itself. + */ + public SubscriptionCreateOrUpdateHeaders withETag(String eTag) { + this.eTag = eTag; + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/SubscriptionCreateParameters.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/SubscriptionCreateParameters.java new file mode 100644 index 0000000000000..8725049ebe208 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/SubscriptionCreateParameters.java @@ -0,0 +1,214 @@ +/** + * 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.apimanagement.v2019_01_01; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; + +/** + * Subscription create details. + */ +@JsonFlatten +public class SubscriptionCreateParameters { + /** + * User (user id path) for whom subscription is being created in form + * /users/{userId}. + */ + @JsonProperty(value = "properties.ownerId") + private String ownerId; + + /** + * Scope like /products/{productId} or /apis or /apis/{apiId}. + */ + @JsonProperty(value = "properties.scope", required = true) + private String scope; + + /** + * Subscription name. + */ + @JsonProperty(value = "properties.displayName", required = true) + private String displayName; + + /** + * Primary subscription key. If not specified during request key will be + * generated automatically. + */ + @JsonProperty(value = "properties.primaryKey") + private String primaryKey; + + /** + * Secondary subscription key. If not specified during request key will be + * generated automatically. + */ + @JsonProperty(value = "properties.secondaryKey") + private String secondaryKey; + + /** + * Initial subscription state. If no value is specified, subscription is + * created with Submitted state. Possible states are * active – the + * subscription is active, * suspended – the subscription is blocked, and + * the subscriber cannot call any APIs of the product, * submitted – the + * subscription request has been made by the developer, but has not yet + * been approved or rejected, * rejected – the subscription request has + * been denied by an administrator, * cancelled – the subscription has been + * cancelled by the developer or administrator, * expired – the + * subscription reached its expiration date and was deactivated. Possible + * values include: 'suspended', 'active', 'expired', 'submitted', + * 'rejected', 'cancelled'. + */ + @JsonProperty(value = "properties.state") + private SubscriptionState state; + + /** + * Determines whether tracing can be enabled. + */ + @JsonProperty(value = "properties.allowTracing") + private Boolean allowTracing; + + /** + * Get user (user id path) for whom subscription is being created in form /users/{userId}. + * + * @return the ownerId value + */ + public String ownerId() { + return this.ownerId; + } + + /** + * Set user (user id path) for whom subscription is being created in form /users/{userId}. + * + * @param ownerId the ownerId value to set + * @return the SubscriptionCreateParameters object itself. + */ + public SubscriptionCreateParameters withOwnerId(String ownerId) { + this.ownerId = ownerId; + return this; + } + + /** + * Get scope like /products/{productId} or /apis or /apis/{apiId}. + * + * @return the scope value + */ + public String scope() { + return this.scope; + } + + /** + * Set scope like /products/{productId} or /apis or /apis/{apiId}. + * + * @param scope the scope value to set + * @return the SubscriptionCreateParameters object itself. + */ + public SubscriptionCreateParameters withScope(String scope) { + this.scope = scope; + return this; + } + + /** + * Get subscription name. + * + * @return the displayName value + */ + public String displayName() { + return this.displayName; + } + + /** + * Set subscription name. + * + * @param displayName the displayName value to set + * @return the SubscriptionCreateParameters object itself. + */ + public SubscriptionCreateParameters withDisplayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Get primary subscription key. If not specified during request key will be generated automatically. + * + * @return the primaryKey value + */ + public String primaryKey() { + return this.primaryKey; + } + + /** + * Set primary subscription key. If not specified during request key will be generated automatically. + * + * @param primaryKey the primaryKey value to set + * @return the SubscriptionCreateParameters object itself. + */ + public SubscriptionCreateParameters withPrimaryKey(String primaryKey) { + this.primaryKey = primaryKey; + return this; + } + + /** + * Get secondary subscription key. If not specified during request key will be generated automatically. + * + * @return the secondaryKey value + */ + public String secondaryKey() { + return this.secondaryKey; + } + + /** + * Set secondary subscription key. If not specified during request key will be generated automatically. + * + * @param secondaryKey the secondaryKey value to set + * @return the SubscriptionCreateParameters object itself. + */ + public SubscriptionCreateParameters withSecondaryKey(String secondaryKey) { + this.secondaryKey = secondaryKey; + return this; + } + + /** + * Get initial subscription state. If no value is specified, subscription is created with Submitted state. Possible states are * active – the subscription is active, * suspended – the subscription is blocked, and the subscriber cannot call any APIs of the product, * submitted – the subscription request has been made by the developer, but has not yet been approved or rejected, * rejected – the subscription request has been denied by an administrator, * cancelled – the subscription has been cancelled by the developer or administrator, * expired – the subscription reached its expiration date and was deactivated. Possible values include: 'suspended', 'active', 'expired', 'submitted', 'rejected', 'cancelled'. + * + * @return the state value + */ + public SubscriptionState state() { + return this.state; + } + + /** + * Set initial subscription state. If no value is specified, subscription is created with Submitted state. Possible states are * active – the subscription is active, * suspended – the subscription is blocked, and the subscriber cannot call any APIs of the product, * submitted – the subscription request has been made by the developer, but has not yet been approved or rejected, * rejected – the subscription request has been denied by an administrator, * cancelled – the subscription has been cancelled by the developer or administrator, * expired – the subscription reached its expiration date and was deactivated. Possible values include: 'suspended', 'active', 'expired', 'submitted', 'rejected', 'cancelled'. + * + * @param state the state value to set + * @return the SubscriptionCreateParameters object itself. + */ + public SubscriptionCreateParameters withState(SubscriptionState state) { + this.state = state; + return this; + } + + /** + * Get determines whether tracing can be enabled. + * + * @return the allowTracing value + */ + public Boolean allowTracing() { + return this.allowTracing; + } + + /** + * Set determines whether tracing can be enabled. + * + * @param allowTracing the allowTracing value to set + * @return the SubscriptionCreateParameters object itself. + */ + public SubscriptionCreateParameters withAllowTracing(Boolean allowTracing) { + this.allowTracing = allowTracing; + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/SubscriptionGetEntityTagHeaders.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/SubscriptionGetEntityTagHeaders.java new file mode 100644 index 0000000000000..c355773bd9012 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/SubscriptionGetEntityTagHeaders.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.apimanagement.v2019_01_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for GetEntityTag operation. + */ +public class SubscriptionGetEntityTagHeaders { + /** + * Current entity state version. Should be treated as opaque and used to + * make conditional HTTP requests. + */ + @JsonProperty(value = "ETag") + private String eTag; + + /** + * Get current entity state version. Should be treated as opaque and used to make conditional HTTP requests. + * + * @return the eTag value + */ + public String eTag() { + return this.eTag; + } + + /** + * Set current entity state version. Should be treated as opaque and used to make conditional HTTP requests. + * + * @param eTag the eTag value to set + * @return the SubscriptionGetEntityTagHeaders object itself. + */ + public SubscriptionGetEntityTagHeaders withETag(String eTag) { + this.eTag = eTag; + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/SubscriptionGetHeaders.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/SubscriptionGetHeaders.java new file mode 100644 index 0000000000000..bc0e7d4ad29dd --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/SubscriptionGetHeaders.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.apimanagement.v2019_01_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for Get operation. + */ +public class SubscriptionGetHeaders { + /** + * Current entity state version. Should be treated as opaque and used to + * make conditional HTTP requests. + */ + @JsonProperty(value = "ETag") + private String eTag; + + /** + * Get current entity state version. Should be treated as opaque and used to make conditional HTTP requests. + * + * @return the eTag value + */ + public String eTag() { + return this.eTag; + } + + /** + * Set current entity state version. Should be treated as opaque and used to make conditional HTTP requests. + * + * @param eTag the eTag value to set + * @return the SubscriptionGetHeaders object itself. + */ + public SubscriptionGetHeaders withETag(String eTag) { + this.eTag = eTag; + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/SubscriptionKeyParameterNamesContract.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/SubscriptionKeyParameterNamesContract.java new file mode 100644 index 0000000000000..e8477b2b053e3 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/SubscriptionKeyParameterNamesContract.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.apimanagement.v2019_01_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Subscription key parameter names details. + */ +public class SubscriptionKeyParameterNamesContract { + /** + * Subscription key header name. + */ + @JsonProperty(value = "header") + private String headerProperty; + + /** + * Subscription key query string parameter name. + */ + @JsonProperty(value = "query") + private String query; + + /** + * Get subscription key header name. + * + * @return the headerProperty value + */ + public String headerProperty() { + return this.headerProperty; + } + + /** + * Set subscription key header name. + * + * @param headerProperty the headerProperty value to set + * @return the SubscriptionKeyParameterNamesContract object itself. + */ + public SubscriptionKeyParameterNamesContract withHeaderProperty(String headerProperty) { + this.headerProperty = headerProperty; + return this; + } + + /** + * Get subscription key query string parameter name. + * + * @return the query value + */ + public String query() { + return this.query; + } + + /** + * Set subscription key query string parameter name. + * + * @param query the query value to set + * @return the SubscriptionKeyParameterNamesContract object itself. + */ + public SubscriptionKeyParameterNamesContract withQuery(String query) { + this.query = query; + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/SubscriptionState.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/SubscriptionState.java new file mode 100644 index 0000000000000..f5f5329087534 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/SubscriptionState.java @@ -0,0 +1,65 @@ +/** + * 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.apimanagement.v2019_01_01; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for SubscriptionState. + */ +public enum SubscriptionState { + /** Enum value suspended. */ + SUSPENDED("suspended"), + + /** Enum value active. */ + ACTIVE("active"), + + /** Enum value expired. */ + EXPIRED("expired"), + + /** Enum value submitted. */ + SUBMITTED("submitted"), + + /** Enum value rejected. */ + REJECTED("rejected"), + + /** Enum value cancelled. */ + CANCELLED("cancelled"); + + /** The actual serialized value for a SubscriptionState instance. */ + private String value; + + SubscriptionState(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a SubscriptionState instance. + * + * @param value the serialized value to parse. + * @return the parsed SubscriptionState object, or null if unable to parse. + */ + @JsonCreator + public static SubscriptionState fromString(String value) { + SubscriptionState[] items = SubscriptionState.values(); + for (SubscriptionState item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/SubscriptionUpdateParameters.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/SubscriptionUpdateParameters.java new file mode 100644 index 0000000000000..1cacfec180cc5 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/SubscriptionUpdateParameters.java @@ -0,0 +1,266 @@ +/** + * 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.apimanagement.v2019_01_01; + +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; + +/** + * Subscription update details. + */ +@JsonFlatten +public class SubscriptionUpdateParameters { + /** + * User identifier path: /users/{userId}. + */ + @JsonProperty(value = "properties.ownerId") + private String ownerId; + + /** + * Scope like /products/{productId} or /apis or /apis/{apiId}. + */ + @JsonProperty(value = "properties.scope") + private String scope; + + /** + * Subscription expiration date. The setting is for audit purposes only and + * the subscription is not automatically expired. The subscription + * lifecycle can be managed by using the `state` property. The date + * conforms to the following format: `yyyy-MM-ddTHH:mm:ssZ` as specified by + * the ISO 8601 standard. + */ + @JsonProperty(value = "properties.expirationDate") + private DateTime expirationDate; + + /** + * Subscription name. + */ + @JsonProperty(value = "properties.displayName") + private String displayName; + + /** + * Primary subscription key. + */ + @JsonProperty(value = "properties.primaryKey") + private String primaryKey; + + /** + * Secondary subscription key. + */ + @JsonProperty(value = "properties.secondaryKey") + private String secondaryKey; + + /** + * Subscription state. Possible states are * active – the subscription is + * active, * suspended – the subscription is blocked, and the subscriber + * cannot call any APIs of the product, * submitted – the subscription + * request has been made by the developer, but has not yet been approved or + * rejected, * rejected – the subscription request has been denied by an + * administrator, * cancelled – the subscription has been cancelled by the + * developer or administrator, * expired – the subscription reached its + * expiration date and was deactivated. Possible values include: + * 'suspended', 'active', 'expired', 'submitted', 'rejected', 'cancelled'. + */ + @JsonProperty(value = "properties.state") + private SubscriptionState state; + + /** + * Comments describing subscription state change by the administrator. + */ + @JsonProperty(value = "properties.stateComment") + private String stateComment; + + /** + * Determines whether tracing can be enabled. + */ + @JsonProperty(value = "properties.allowTracing") + private Boolean allowTracing; + + /** + * Get user identifier path: /users/{userId}. + * + * @return the ownerId value + */ + public String ownerId() { + return this.ownerId; + } + + /** + * Set user identifier path: /users/{userId}. + * + * @param ownerId the ownerId value to set + * @return the SubscriptionUpdateParameters object itself. + */ + public SubscriptionUpdateParameters withOwnerId(String ownerId) { + this.ownerId = ownerId; + return this; + } + + /** + * Get scope like /products/{productId} or /apis or /apis/{apiId}. + * + * @return the scope value + */ + public String scope() { + return this.scope; + } + + /** + * Set scope like /products/{productId} or /apis or /apis/{apiId}. + * + * @param scope the scope value to set + * @return the SubscriptionUpdateParameters object itself. + */ + public SubscriptionUpdateParameters withScope(String scope) { + this.scope = scope; + return this; + } + + /** + * Get subscription expiration date. The setting is for audit purposes only and the subscription is not automatically expired. The subscription lifecycle can be managed by using the `state` property. The date conforms to the following format: `yyyy-MM-ddTHH:mm:ssZ` as specified by the ISO 8601 standard. + * + * @return the expirationDate value + */ + public DateTime expirationDate() { + return this.expirationDate; + } + + /** + * Set subscription expiration date. The setting is for audit purposes only and the subscription is not automatically expired. The subscription lifecycle can be managed by using the `state` property. The date conforms to the following format: `yyyy-MM-ddTHH:mm:ssZ` as specified by the ISO 8601 standard. + * + * @param expirationDate the expirationDate value to set + * @return the SubscriptionUpdateParameters object itself. + */ + public SubscriptionUpdateParameters withExpirationDate(DateTime expirationDate) { + this.expirationDate = expirationDate; + return this; + } + + /** + * Get subscription name. + * + * @return the displayName value + */ + public String displayName() { + return this.displayName; + } + + /** + * Set subscription name. + * + * @param displayName the displayName value to set + * @return the SubscriptionUpdateParameters object itself. + */ + public SubscriptionUpdateParameters withDisplayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Get primary subscription key. + * + * @return the primaryKey value + */ + public String primaryKey() { + return this.primaryKey; + } + + /** + * Set primary subscription key. + * + * @param primaryKey the primaryKey value to set + * @return the SubscriptionUpdateParameters object itself. + */ + public SubscriptionUpdateParameters withPrimaryKey(String primaryKey) { + this.primaryKey = primaryKey; + return this; + } + + /** + * Get secondary subscription key. + * + * @return the secondaryKey value + */ + public String secondaryKey() { + return this.secondaryKey; + } + + /** + * Set secondary subscription key. + * + * @param secondaryKey the secondaryKey value to set + * @return the SubscriptionUpdateParameters object itself. + */ + public SubscriptionUpdateParameters withSecondaryKey(String secondaryKey) { + this.secondaryKey = secondaryKey; + return this; + } + + /** + * Get subscription state. Possible states are * active – the subscription is active, * suspended – the subscription is blocked, and the subscriber cannot call any APIs of the product, * submitted – the subscription request has been made by the developer, but has not yet been approved or rejected, * rejected – the subscription request has been denied by an administrator, * cancelled – the subscription has been cancelled by the developer or administrator, * expired – the subscription reached its expiration date and was deactivated. Possible values include: 'suspended', 'active', 'expired', 'submitted', 'rejected', 'cancelled'. + * + * @return the state value + */ + public SubscriptionState state() { + return this.state; + } + + /** + * Set subscription state. Possible states are * active – the subscription is active, * suspended – the subscription is blocked, and the subscriber cannot call any APIs of the product, * submitted – the subscription request has been made by the developer, but has not yet been approved or rejected, * rejected – the subscription request has been denied by an administrator, * cancelled – the subscription has been cancelled by the developer or administrator, * expired – the subscription reached its expiration date and was deactivated. Possible values include: 'suspended', 'active', 'expired', 'submitted', 'rejected', 'cancelled'. + * + * @param state the state value to set + * @return the SubscriptionUpdateParameters object itself. + */ + public SubscriptionUpdateParameters withState(SubscriptionState state) { + this.state = state; + return this; + } + + /** + * Get comments describing subscription state change by the administrator. + * + * @return the stateComment value + */ + public String stateComment() { + return this.stateComment; + } + + /** + * Set comments describing subscription state change by the administrator. + * + * @param stateComment the stateComment value to set + * @return the SubscriptionUpdateParameters object itself. + */ + public SubscriptionUpdateParameters withStateComment(String stateComment) { + this.stateComment = stateComment; + return this; + } + + /** + * Get determines whether tracing can be enabled. + * + * @return the allowTracing value + */ + public Boolean allowTracing() { + return this.allowTracing; + } + + /** + * Set determines whether tracing can be enabled. + * + * @param allowTracing the allowTracing value to set + * @return the SubscriptionUpdateParameters object itself. + */ + public SubscriptionUpdateParameters withAllowTracing(Boolean allowTracing) { + this.allowTracing = allowTracing; + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/Subscriptions.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/Subscriptions.java new file mode 100644 index 0000000000000..c419d4d54af4e --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/Subscriptions.java @@ -0,0 +1,87 @@ +/** + * 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.apimanagement.v2019_01_01; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import rx.Completable; +import rx.Observable; +import com.microsoft.azure.management.apimanagement.v2019_01_01.implementation.SubscriptionsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing Subscriptions. + */ +public interface Subscriptions extends SupportsCreating, HasInner { + /** + * Lists all subscriptions of the API Management service instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listAsync(final String resourceGroupName, final String serviceName); + + /** + * Gets the entity state (Etag) version of the apimanagement subscription specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param sid Subscription entity Identifier. The entity represents the association between a user and a product in API Management. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable getEntityTagAsync(String resourceGroupName, String serviceName, String sid); + + /** + * Gets the specified Subscription entity. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param sid Subscription entity Identifier. The entity represents the association between a user and a product in API Management. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String resourceGroupName, String serviceName, String sid); + + /** + * Deletes the specified subscription. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param sid Subscription entity Identifier. The entity represents the association between a user and a product in API Management. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable deleteAsync(String resourceGroupName, String serviceName, String sid, String ifMatch); + + /** + * Regenerates primary key of existing subscription of the API Management service instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param sid Subscription entity Identifier. The entity represents the association between a user and a product in API Management. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable regeneratePrimaryKeyAsync(String resourceGroupName, String serviceName, String sid); + + /** + * Regenerates secondary key of existing subscription of the API Management service instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param sid Subscription entity Identifier. The entity represents the association between a user and a product in API Management. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable regenerateSecondaryKeyAsync(String resourceGroupName, String serviceName, String sid); + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/SubscriptionsDelegationSettingsProperties.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/SubscriptionsDelegationSettingsProperties.java new file mode 100644 index 0000000000000..9a1f3657e46f4 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/SubscriptionsDelegationSettingsProperties.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.apimanagement.v2019_01_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Subscriptions delegation settings properties. + */ +public class SubscriptionsDelegationSettingsProperties { + /** + * Enable or disable delegation for subscriptions. + */ + @JsonProperty(value = "enabled") + private Boolean enabled; + + /** + * Get enable or disable delegation for subscriptions. + * + * @return the enabled value + */ + public Boolean enabled() { + return this.enabled; + } + + /** + * Set enable or disable delegation for subscriptions. + * + * @param enabled the enabled value to set + * @return the SubscriptionsDelegationSettingsProperties object itself. + */ + public SubscriptionsDelegationSettingsProperties withEnabled(Boolean enabled) { + this.enabled = enabled; + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/TagAssignToApiHeaders.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/TagAssignToApiHeaders.java new file mode 100644 index 0000000000000..9756418b23cca --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/TagAssignToApiHeaders.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.apimanagement.v2019_01_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for AssignToApi operation. + */ +public class TagAssignToApiHeaders { + /** + * Current entity state version. Should be treated as opaque and used to + * make conditional HTTP requests. + */ + @JsonProperty(value = "ETag") + private String eTag; + + /** + * Get current entity state version. Should be treated as opaque and used to make conditional HTTP requests. + * + * @return the eTag value + */ + public String eTag() { + return this.eTag; + } + + /** + * Set current entity state version. Should be treated as opaque and used to make conditional HTTP requests. + * + * @param eTag the eTag value to set + * @return the TagAssignToApiHeaders object itself. + */ + public TagAssignToApiHeaders withETag(String eTag) { + this.eTag = eTag; + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/TagContract.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/TagContract.java new file mode 100644 index 0000000000000..690b5a79d6cb5 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/TagContract.java @@ -0,0 +1,95 @@ +/** + * 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.apimanagement.v2019_01_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.apimanagement.v2019_01_01.implementation.TagContractInner; +import com.microsoft.azure.arm.model.Indexable; +import com.microsoft.azure.arm.model.Refreshable; +import com.microsoft.azure.arm.model.Updatable; +import com.microsoft.azure.arm.model.Appliable; +import com.microsoft.azure.arm.model.Creatable; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.apimanagement.v2019_01_01.implementation.ApiManagementManager; + +/** + * Type representing TagContract. + */ +public interface TagContract extends HasInner, Indexable, Refreshable, Updatable, HasManager { + /** + * @return the displayName value. + */ + String displayName(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the type value. + */ + String type(); + + /** + * The entirety of the TagContract definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithOperation, DefinitionStages.WithCreate { + } + + /** + * Grouping of TagContract definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a TagContract definition. + */ + interface Blank extends WithOperation { + } + + /** + * The stage of the tagcontract definition allowing to specify Operation. + */ + interface WithOperation { + /** + * Specifies resourceGroupName, serviceName, apiId, operationId. + * @param resourceGroupName The name of the resource group + * @param serviceName The name of the API Management service + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number + * @param operationId Operation identifier within an API. Must be unique in the current API Management service instance + * @return the next definition stage + */ + WithCreate withExistingOperation(String resourceGroupName, String serviceName, String apiId, String operationId); + } + + /** + * The stage of the definition which contains all the minimum required inputs for + * the resource to be created (via {@link WithCreate#create()}), but also allows + * for any other optional settings to be specified. + */ + interface WithCreate extends Creatable { + } + } + /** + * The template for a TagContract update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable { + } + + /** + * Grouping of TagContract update stages. + */ + interface UpdateStages { + } +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/TagCreateOrUpdateHeaders.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/TagCreateOrUpdateHeaders.java new file mode 100644 index 0000000000000..0cbdcb3825d57 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/TagCreateOrUpdateHeaders.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.apimanagement.v2019_01_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for CreateOrUpdate operation. + */ +public class TagCreateOrUpdateHeaders { + /** + * Current entity state version. Should be treated as opaque and used to + * make conditional HTTP requests. + */ + @JsonProperty(value = "ETag") + private String eTag; + + /** + * Get current entity state version. Should be treated as opaque and used to make conditional HTTP requests. + * + * @return the eTag value + */ + public String eTag() { + return this.eTag; + } + + /** + * Set current entity state version. Should be treated as opaque and used to make conditional HTTP requests. + * + * @param eTag the eTag value to set + * @return the TagCreateOrUpdateHeaders object itself. + */ + public TagCreateOrUpdateHeaders withETag(String eTag) { + this.eTag = eTag; + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/TagCreateUpdateParameters.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/TagCreateUpdateParameters.java new file mode 100644 index 0000000000000..9ded3687d856d --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/TagCreateUpdateParameters.java @@ -0,0 +1,45 @@ +/** + * 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.apimanagement.v2019_01_01; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; + +/** + * Parameters supplied to Create/Update Tag operations. + */ +@JsonFlatten +public class TagCreateUpdateParameters { + /** + * Tag name. + */ + @JsonProperty(value = "properties.displayName", required = true) + private String displayName; + + /** + * Get tag name. + * + * @return the displayName value + */ + public String displayName() { + return this.displayName; + } + + /** + * Set tag name. + * + * @param displayName the displayName value to set + * @return the TagCreateUpdateParameters object itself. + */ + public TagCreateUpdateParameters withDisplayName(String displayName) { + this.displayName = displayName; + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/TagDescriptionContract.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/TagDescriptionContract.java new file mode 100644 index 0000000000000..106db42622b39 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/TagDescriptionContract.java @@ -0,0 +1,205 @@ +/** + * 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.apimanagement.v2019_01_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.apimanagement.v2019_01_01.implementation.TagDescriptionContractInner; +import com.microsoft.azure.arm.model.Indexable; +import com.microsoft.azure.arm.model.Refreshable; +import com.microsoft.azure.arm.model.Updatable; +import com.microsoft.azure.arm.model.Appliable; +import com.microsoft.azure.arm.model.Creatable; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.apimanagement.v2019_01_01.implementation.ApiManagementManager; + +/** + * Type representing TagDescriptionContract. + */ +public interface TagDescriptionContract extends HasInner, Indexable, Refreshable, Updatable, HasManager { + /** + * @return the description value. + */ + String description(); + + /** + * @return the displayName value. + */ + String displayName(); + + /** + * @return the externalDocsDescription value. + */ + String externalDocsDescription(); + + /** + * @return the externalDocsUrl value. + */ + String externalDocsUrl(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the type value. + */ + String type(); + + /** + * The entirety of the TagDescriptionContract definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithApi, DefinitionStages.WithIfMatch, DefinitionStages.WithCreate { + } + + /** + * Grouping of TagDescriptionContract definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a TagDescriptionContract definition. + */ + interface Blank extends WithApi { + } + + /** + * The stage of the tagdescriptioncontract definition allowing to specify Api. + */ + interface WithApi { + /** + * Specifies resourceGroupName, serviceName, apiId. + * @param resourceGroupName The name of the resource group + * @param serviceName The name of the API Management service + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number + * @return the next definition stage + */ + WithIfMatch withExistingApi(String resourceGroupName, String serviceName, String apiId); + } + + /** + * The stage of the tagdescriptioncontract definition allowing to specify IfMatch. + */ + interface WithIfMatch { + /** + * Specifies ifMatch. + * @param ifMatch ETag of the Entity. Not required when creating an entity, but required when updating an entity + * @return the next definition stage + */ + WithCreate withIfMatch(String ifMatch); + } + + /** + * The stage of the tagdescriptioncontract definition allowing to specify Description. + */ + interface WithDescription { + /** + * Specifies description. + * @param description Description of the Tag + * @return the next definition stage + */ + WithCreate withDescription(String description); + } + + /** + * The stage of the tagdescriptioncontract definition allowing to specify ExternalDocsDescription. + */ + interface WithExternalDocsDescription { + /** + * Specifies externalDocsDescription. + * @param externalDocsDescription Description of the external resources describing the tag + * @return the next definition stage + */ + WithCreate withExternalDocsDescription(String externalDocsDescription); + } + + /** + * The stage of the tagdescriptioncontract definition allowing to specify ExternalDocsUrl. + */ + interface WithExternalDocsUrl { + /** + * Specifies externalDocsUrl. + * @param externalDocsUrl Absolute URL of external resources describing the tag + * @return the next definition stage + */ + WithCreate withExternalDocsUrl(String externalDocsUrl); + } + + /** + * The stage of the definition which contains all the minimum required inputs for + * the resource to be created (via {@link WithCreate#create()}), but also allows + * for any other optional settings to be specified. + */ + interface WithCreate extends Creatable, DefinitionStages.WithDescription, DefinitionStages.WithExternalDocsDescription, DefinitionStages.WithExternalDocsUrl { + } + } + /** + * The template for a TagDescriptionContract update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithIfMatch, UpdateStages.WithDescription, UpdateStages.WithExternalDocsDescription, UpdateStages.WithExternalDocsUrl { + } + + /** + * Grouping of TagDescriptionContract update stages. + */ + interface UpdateStages { + /** + * The stage of the tagdescriptioncontract update allowing to specify IfMatch. + */ + interface WithIfMatch { + /** + * Specifies ifMatch. + * @param ifMatch ETag of the Entity. Not required when creating an entity, but required when updating an entity + * @return the next update stage + */ + Update withIfMatch(String ifMatch); + } + + /** + * The stage of the tagdescriptioncontract update allowing to specify Description. + */ + interface WithDescription { + /** + * Specifies description. + * @param description Description of the Tag + * @return the next update stage + */ + Update withDescription(String description); + } + + /** + * The stage of the tagdescriptioncontract update allowing to specify ExternalDocsDescription. + */ + interface WithExternalDocsDescription { + /** + * Specifies externalDocsDescription. + * @param externalDocsDescription Description of the external resources describing the tag + * @return the next update stage + */ + Update withExternalDocsDescription(String externalDocsDescription); + } + + /** + * The stage of the tagdescriptioncontract update allowing to specify ExternalDocsUrl. + */ + interface WithExternalDocsUrl { + /** + * Specifies externalDocsUrl. + * @param externalDocsUrl Absolute URL of external resources describing the tag + * @return the next update stage + */ + Update withExternalDocsUrl(String externalDocsUrl); + } + + } +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/TagDescriptionCreateParameters.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/TagDescriptionCreateParameters.java new file mode 100644 index 0000000000000..f45cf08fcf614 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/TagDescriptionCreateParameters.java @@ -0,0 +1,97 @@ +/** + * 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.apimanagement.v2019_01_01; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; + +/** + * Parameters supplied to the Create TagDescription operation. + */ +@JsonFlatten +public class TagDescriptionCreateParameters { + /** + * Description of the Tag. + */ + @JsonProperty(value = "properties.description") + private String description; + + /** + * Absolute URL of external resources describing the tag. + */ + @JsonProperty(value = "properties.externalDocsUrl") + private String externalDocsUrl; + + /** + * Description of the external resources describing the tag. + */ + @JsonProperty(value = "properties.externalDocsDescription") + private String externalDocsDescription; + + /** + * Get description of the Tag. + * + * @return the description value + */ + public String description() { + return this.description; + } + + /** + * Set description of the Tag. + * + * @param description the description value to set + * @return the TagDescriptionCreateParameters object itself. + */ + public TagDescriptionCreateParameters withDescription(String description) { + this.description = description; + return this; + } + + /** + * Get absolute URL of external resources describing the tag. + * + * @return the externalDocsUrl value + */ + public String externalDocsUrl() { + return this.externalDocsUrl; + } + + /** + * Set absolute URL of external resources describing the tag. + * + * @param externalDocsUrl the externalDocsUrl value to set + * @return the TagDescriptionCreateParameters object itself. + */ + public TagDescriptionCreateParameters withExternalDocsUrl(String externalDocsUrl) { + this.externalDocsUrl = externalDocsUrl; + return this; + } + + /** + * Get description of the external resources describing the tag. + * + * @return the externalDocsDescription value + */ + public String externalDocsDescription() { + return this.externalDocsDescription; + } + + /** + * Set description of the external resources describing the tag. + * + * @param externalDocsDescription the externalDocsDescription value to set + * @return the TagDescriptionCreateParameters object itself. + */ + public TagDescriptionCreateParameters withExternalDocsDescription(String externalDocsDescription) { + this.externalDocsDescription = externalDocsDescription; + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/TagGetByApiHeaders.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/TagGetByApiHeaders.java new file mode 100644 index 0000000000000..6b92b770229d7 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/TagGetByApiHeaders.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.apimanagement.v2019_01_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for GetByApi operation. + */ +public class TagGetByApiHeaders { + /** + * Current entity state version. Should be treated as opaque and used to + * make conditional HTTP requests. + */ + @JsonProperty(value = "ETag") + private String eTag; + + /** + * Get current entity state version. Should be treated as opaque and used to make conditional HTTP requests. + * + * @return the eTag value + */ + public String eTag() { + return this.eTag; + } + + /** + * Set current entity state version. Should be treated as opaque and used to make conditional HTTP requests. + * + * @param eTag the eTag value to set + * @return the TagGetByApiHeaders object itself. + */ + public TagGetByApiHeaders withETag(String eTag) { + this.eTag = eTag; + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/TagGetByOperationHeaders.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/TagGetByOperationHeaders.java new file mode 100644 index 0000000000000..e08f8840b0205 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/TagGetByOperationHeaders.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.apimanagement.v2019_01_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for GetByOperation operation. + */ +public class TagGetByOperationHeaders { + /** + * Current entity state version. Should be treated as opaque and used to + * make conditional HTTP requests. + */ + @JsonProperty(value = "ETag") + private String eTag; + + /** + * Get current entity state version. Should be treated as opaque and used to make conditional HTTP requests. + * + * @return the eTag value + */ + public String eTag() { + return this.eTag; + } + + /** + * Set current entity state version. Should be treated as opaque and used to make conditional HTTP requests. + * + * @param eTag the eTag value to set + * @return the TagGetByOperationHeaders object itself. + */ + public TagGetByOperationHeaders withETag(String eTag) { + this.eTag = eTag; + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/TagGetByProductHeaders.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/TagGetByProductHeaders.java new file mode 100644 index 0000000000000..14958fe6deac5 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/TagGetByProductHeaders.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.apimanagement.v2019_01_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for GetByProduct operation. + */ +public class TagGetByProductHeaders { + /** + * Current entity state version. Should be treated as opaque and used to + * make conditional HTTP requests. + */ + @JsonProperty(value = "ETag") + private String eTag; + + /** + * Get current entity state version. Should be treated as opaque and used to make conditional HTTP requests. + * + * @return the eTag value + */ + public String eTag() { + return this.eTag; + } + + /** + * Set current entity state version. Should be treated as opaque and used to make conditional HTTP requests. + * + * @param eTag the eTag value to set + * @return the TagGetByProductHeaders object itself. + */ + public TagGetByProductHeaders withETag(String eTag) { + this.eTag = eTag; + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/TagGetEntityStateByApiHeaders.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/TagGetEntityStateByApiHeaders.java new file mode 100644 index 0000000000000..d8626d1f45218 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/TagGetEntityStateByApiHeaders.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.apimanagement.v2019_01_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for GetEntityStateByApi operation. + */ +public class TagGetEntityStateByApiHeaders { + /** + * Current entity state version. Should be treated as opaque and used to + * make conditional HTTP requests. + */ + @JsonProperty(value = "ETag") + private String eTag; + + /** + * Get current entity state version. Should be treated as opaque and used to make conditional HTTP requests. + * + * @return the eTag value + */ + public String eTag() { + return this.eTag; + } + + /** + * Set current entity state version. Should be treated as opaque and used to make conditional HTTP requests. + * + * @param eTag the eTag value to set + * @return the TagGetEntityStateByApiHeaders object itself. + */ + public TagGetEntityStateByApiHeaders withETag(String eTag) { + this.eTag = eTag; + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/TagGetEntityStateByOperationHeaders.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/TagGetEntityStateByOperationHeaders.java new file mode 100644 index 0000000000000..7ddba1c5a08a4 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/TagGetEntityStateByOperationHeaders.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.apimanagement.v2019_01_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for GetEntityStateByOperation operation. + */ +public class TagGetEntityStateByOperationHeaders { + /** + * Current entity state version. Should be treated as opaque and used to + * make conditional HTTP requests. + */ + @JsonProperty(value = "ETag") + private String eTag; + + /** + * Get current entity state version. Should be treated as opaque and used to make conditional HTTP requests. + * + * @return the eTag value + */ + public String eTag() { + return this.eTag; + } + + /** + * Set current entity state version. Should be treated as opaque and used to make conditional HTTP requests. + * + * @param eTag the eTag value to set + * @return the TagGetEntityStateByOperationHeaders object itself. + */ + public TagGetEntityStateByOperationHeaders withETag(String eTag) { + this.eTag = eTag; + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/TagGetEntityStateByProductHeaders.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/TagGetEntityStateByProductHeaders.java new file mode 100644 index 0000000000000..32c181445ab14 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/TagGetEntityStateByProductHeaders.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.apimanagement.v2019_01_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for GetEntityStateByProduct operation. + */ +public class TagGetEntityStateByProductHeaders { + /** + * Current entity state version. Should be treated as opaque and used to + * make conditional HTTP requests. + */ + @JsonProperty(value = "ETag") + private String eTag; + + /** + * Get current entity state version. Should be treated as opaque and used to make conditional HTTP requests. + * + * @return the eTag value + */ + public String eTag() { + return this.eTag; + } + + /** + * Set current entity state version. Should be treated as opaque and used to make conditional HTTP requests. + * + * @param eTag the eTag value to set + * @return the TagGetEntityStateByProductHeaders object itself. + */ + public TagGetEntityStateByProductHeaders withETag(String eTag) { + this.eTag = eTag; + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/TagGetEntityStateHeaders.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/TagGetEntityStateHeaders.java new file mode 100644 index 0000000000000..c4d00a5c71d9e --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/TagGetEntityStateHeaders.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.apimanagement.v2019_01_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for GetEntityState operation. + */ +public class TagGetEntityStateHeaders { + /** + * Current entity state version. Should be treated as opaque and used to + * make conditional HTTP requests. + */ + @JsonProperty(value = "ETag") + private String eTag; + + /** + * Get current entity state version. Should be treated as opaque and used to make conditional HTTP requests. + * + * @return the eTag value + */ + public String eTag() { + return this.eTag; + } + + /** + * Set current entity state version. Should be treated as opaque and used to make conditional HTTP requests. + * + * @param eTag the eTag value to set + * @return the TagGetEntityStateHeaders object itself. + */ + public TagGetEntityStateHeaders withETag(String eTag) { + this.eTag = eTag; + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/TagGetHeaders.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/TagGetHeaders.java new file mode 100644 index 0000000000000..8ad76b8a09666 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/TagGetHeaders.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.apimanagement.v2019_01_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for Get operation. + */ +public class TagGetHeaders { + /** + * Current entity state version. Should be treated as opaque and used to + * make conditional HTTP requests. + */ + @JsonProperty(value = "ETag") + private String eTag; + + /** + * Get current entity state version. Should be treated as opaque and used to make conditional HTTP requests. + * + * @return the eTag value + */ + public String eTag() { + return this.eTag; + } + + /** + * Set current entity state version. Should be treated as opaque and used to make conditional HTTP requests. + * + * @param eTag the eTag value to set + * @return the TagGetHeaders object itself. + */ + public TagGetHeaders withETag(String eTag) { + this.eTag = eTag; + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/TagResourceContract.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/TagResourceContract.java new file mode 100644 index 0000000000000..d25de20599a43 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/TagResourceContract.java @@ -0,0 +1,40 @@ +/** + * 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.apimanagement.v2019_01_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.apimanagement.v2019_01_01.implementation.TagResourceContractInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.apimanagement.v2019_01_01.implementation.ApiManagementManager; + +/** + * Type representing TagResourceContract. + */ +public interface TagResourceContract extends HasInner, HasManager { + /** + * @return the api value. + */ + ApiTagResourceContractProperties api(); + + /** + * @return the operation value. + */ + OperationTagResourceContractProperties operation(); + + /** + * @return the product value. + */ + ProductTagResourceContractProperties product(); + + /** + * @return the tag value. + */ + TagTagResourceContractProperties tag(); + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/TagResources.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/TagResources.java new file mode 100644 index 0000000000000..005d7a7bb9027 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/TagResources.java @@ -0,0 +1,29 @@ +/** + * 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.apimanagement.v2019_01_01; + +import rx.Observable; +import com.microsoft.azure.management.apimanagement.v2019_01_01.implementation.TagResourcesInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing TagResources. + */ +public interface TagResources extends HasInner { + /** + * Lists a collection of resources associated with tags. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByServiceAsync(final String resourceGroupName, final String serviceName); + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/TagTagResourceContractProperties.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/TagTagResourceContractProperties.java new file mode 100644 index 0000000000000..119de1ff1a7b8 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/TagTagResourceContractProperties.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.apimanagement.v2019_01_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Contract defining the Tag property in the Tag Resource Contract. + */ +public class TagTagResourceContractProperties { + /** + * Tag identifier. + */ + @JsonProperty(value = "id") + private String id; + + /** + * Tag Name. + */ + @JsonProperty(value = "name") + private String name; + + /** + * Get tag identifier. + * + * @return the id value + */ + public String id() { + return this.id; + } + + /** + * Set tag identifier. + * + * @param id the id value to set + * @return the TagTagResourceContractProperties object itself. + */ + public TagTagResourceContractProperties withId(String id) { + this.id = id; + return this; + } + + /** + * Get tag Name. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set tag Name. + * + * @param name the name value to set + * @return the TagTagResourceContractProperties object itself. + */ + public TagTagResourceContractProperties withName(String name) { + this.name = name; + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/Tags.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/Tags.java new file mode 100644 index 0000000000000..09fabceff52c4 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/Tags.java @@ -0,0 +1,259 @@ +/** + * 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.apimanagement.v2019_01_01; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import rx.Completable; +import rx.Observable; +import com.microsoft.azure.management.apimanagement.v2019_01_01.implementation.TagsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing Tags. + */ +public interface Tags extends SupportsCreating, HasInner { + /** + * Gets the entity state version of the tag specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @param operationId Operation identifier within an API. Must be unique in the current API Management service instance. + * @param tagId Tag identifier. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable getEntityStateByOperationAsync(String resourceGroupName, String serviceName, String apiId, String operationId, String tagId); + + /** + * Lists all Tags associated with the API. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByApiAsync(final String resourceGroupName, final String serviceName, final String apiId); + + /** + * Gets the entity state version of the tag specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @param tagId Tag identifier. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable getEntityStateByApiAsync(String resourceGroupName, String serviceName, String apiId, String tagId); + + /** + * Get tag associated with the API. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @param tagId Tag identifier. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getByApiAsync(String resourceGroupName, String serviceName, String apiId, String tagId); + + /** + * Assign tag to the Api. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @param tagId Tag identifier. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable assignToApiAsync(String resourceGroupName, String serviceName, String apiId, String tagId); + + /** + * Detach the tag from the Api. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @param tagId Tag identifier. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable detachFromApiAsync(String resourceGroupName, String serviceName, String apiId, String tagId); + + /** + * Lists all Tags associated with the Product. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param productId Product identifier. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByProductAsync(final String resourceGroupName, final String serviceName, final String productId); + + /** + * Gets the entity state version of the tag specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param productId Product identifier. Must be unique in the current API Management service instance. + * @param tagId Tag identifier. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable getEntityStateByProductAsync(String resourceGroupName, String serviceName, String productId, String tagId); + + /** + * Get tag associated with the Product. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param productId Product identifier. Must be unique in the current API Management service instance. + * @param tagId Tag identifier. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getByProductAsync(String resourceGroupName, String serviceName, String productId, String tagId); + + /** + * Assign tag to the Product. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param productId Product identifier. Must be unique in the current API Management service instance. + * @param tagId Tag identifier. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable assignToProductAsync(String resourceGroupName, String serviceName, String productId, String tagId); + + /** + * Detach the tag from the Product. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param productId Product identifier. Must be unique in the current API Management service instance. + * @param tagId Tag identifier. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable detachFromProductAsync(String resourceGroupName, String serviceName, String productId, String tagId); + + /** + * Lists a collection of tags defined within a service instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByServiceAsync(final String resourceGroupName, final String serviceName); + + /** + * Gets the entity state version of the tag specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param tagId Tag identifier. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable getEntityStateAsync(String resourceGroupName, String serviceName, String tagId); + + /** + * Gets the details of the tag specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param tagId Tag identifier. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String resourceGroupName, String serviceName, String tagId); + + /** + * Creates a tag. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param tagId Tag identifier. Must be unique in the current API Management service instance. + * @param displayName Tag name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable createOrUpdateAsync(String resourceGroupName, String serviceName, String tagId, String displayName); + + /** + * Updates the details of the tag specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param tagId Tag identifier. Must be unique in the current API Management service instance. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @param displayName Tag name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable updateAsync(String resourceGroupName, String serviceName, String tagId, String ifMatch, String displayName); + + /** + * Deletes specific tag of the API Management service instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param tagId Tag identifier. Must be unique in the current API Management service instance. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable deleteAsync(String resourceGroupName, String serviceName, String tagId, String ifMatch); + + /** + * Get tag associated with the Operation. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @param operationId Operation identifier within an API. Must be unique in the current API Management service instance. + * @param tagId Tag identifier. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getByOperationAsync(String resourceGroupName, String serviceName, String apiId, String operationId, String tagId); + + /** + * Lists all Tags associated with the Operation. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @param operationId Operation identifier within an API. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByOperationAsync(final String resourceGroupName, final String serviceName, final String apiId, final String operationId); + + /** + * Detach the tag from the Operation. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @param operationId Operation identifier within an API. Must be unique in the current API Management service instance. + * @param tagId Tag identifier. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable detachFromOperationAsync(String resourceGroupName, String serviceName, String apiId, String operationId, String tagId); + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/TemplateName.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/TemplateName.java new file mode 100644 index 0000000000000..547e62388292f --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/TemplateName.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.apimanagement.v2019_01_01; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for TemplateName. + */ +public final class TemplateName extends ExpandableStringEnum { + /** Static value applicationApprovedNotificationMessage for TemplateName. */ + public static final TemplateName APPLICATION_APPROVED_NOTIFICATION_MESSAGE = fromString("applicationApprovedNotificationMessage"); + + /** Static value accountClosedDeveloper for TemplateName. */ + public static final TemplateName ACCOUNT_CLOSED_DEVELOPER = fromString("accountClosedDeveloper"); + + /** Static value quotaLimitApproachingDeveloperNotificationMessage for TemplateName. */ + public static final TemplateName QUOTA_LIMIT_APPROACHING_DEVELOPER_NOTIFICATION_MESSAGE = fromString("quotaLimitApproachingDeveloperNotificationMessage"); + + /** Static value newDeveloperNotificationMessage for TemplateName. */ + public static final TemplateName NEW_DEVELOPER_NOTIFICATION_MESSAGE = fromString("newDeveloperNotificationMessage"); + + /** Static value emailChangeIdentityDefault for TemplateName. */ + public static final TemplateName EMAIL_CHANGE_IDENTITY_DEFAULT = fromString("emailChangeIdentityDefault"); + + /** Static value inviteUserNotificationMessage for TemplateName. */ + public static final TemplateName INVITE_USER_NOTIFICATION_MESSAGE = fromString("inviteUserNotificationMessage"); + + /** Static value newCommentNotificationMessage for TemplateName. */ + public static final TemplateName NEW_COMMENT_NOTIFICATION_MESSAGE = fromString("newCommentNotificationMessage"); + + /** Static value confirmSignUpIdentityDefault for TemplateName. */ + public static final TemplateName CONFIRM_SIGN_UP_IDENTITY_DEFAULT = fromString("confirmSignUpIdentityDefault"); + + /** Static value newIssueNotificationMessage for TemplateName. */ + public static final TemplateName NEW_ISSUE_NOTIFICATION_MESSAGE = fromString("newIssueNotificationMessage"); + + /** Static value purchaseDeveloperNotificationMessage for TemplateName. */ + public static final TemplateName PURCHASE_DEVELOPER_NOTIFICATION_MESSAGE = fromString("purchaseDeveloperNotificationMessage"); + + /** Static value passwordResetIdentityDefault for TemplateName. */ + public static final TemplateName PASSWORD_RESET_IDENTITY_DEFAULT = fromString("passwordResetIdentityDefault"); + + /** Static value passwordResetByAdminNotificationMessage for TemplateName. */ + public static final TemplateName PASSWORD_RESET_BY_ADMIN_NOTIFICATION_MESSAGE = fromString("passwordResetByAdminNotificationMessage"); + + /** Static value rejectDeveloperNotificationMessage for TemplateName. */ + public static final TemplateName REJECT_DEVELOPER_NOTIFICATION_MESSAGE = fromString("rejectDeveloperNotificationMessage"); + + /** Static value requestDeveloperNotificationMessage for TemplateName. */ + public static final TemplateName REQUEST_DEVELOPER_NOTIFICATION_MESSAGE = fromString("requestDeveloperNotificationMessage"); + + /** + * Creates or finds a TemplateName from its string representation. + * @param name a name to look for + * @return the corresponding TemplateName + */ + @JsonCreator + public static TemplateName fromString(String name) { + return fromString(name, TemplateName.class); + } + + /** + * @return known TemplateName values + */ + public static Collection values() { + return values(TemplateName.class); + } +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/TenantAccess.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/TenantAccess.java new file mode 100644 index 0000000000000..96d16b5453b12 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/TenantAccess.java @@ -0,0 +1,71 @@ +/** + * 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.apimanagement.v2019_01_01; + +import rx.Completable; +import rx.Observable; +import com.microsoft.azure.management.apimanagement.v2019_01_01.implementation.TenantAccessInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing TenantAccess. + */ +public interface TenantAccess extends HasInner { + /** + * Tenant access metadata. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable getEntityTagAsync(String resourceGroupName, String serviceName); + + /** + * Get tenant access information details. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String resourceGroupName, String serviceName); + + /** + * Update tenant access information details. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable updateAsync(String resourceGroupName, String serviceName, String ifMatch); + + /** + * Regenerate primary access key. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable regeneratePrimaryKeyAsync(String resourceGroupName, String serviceName); + + /** + * Regenerate secondary access key. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable regenerateSecondaryKeyAsync(String resourceGroupName, String serviceName); + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/TenantAccessGetEntityTagHeaders.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/TenantAccessGetEntityTagHeaders.java new file mode 100644 index 0000000000000..f90ac1e9082bb --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/TenantAccessGetEntityTagHeaders.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.apimanagement.v2019_01_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for GetEntityTag operation. + */ +public class TenantAccessGetEntityTagHeaders { + /** + * Current entity state version. Should be treated as opaque and used to + * make conditional HTTP requests. + */ + @JsonProperty(value = "ETag") + private String eTag; + + /** + * Get current entity state version. Should be treated as opaque and used to make conditional HTTP requests. + * + * @return the eTag value + */ + public String eTag() { + return this.eTag; + } + + /** + * Set current entity state version. Should be treated as opaque and used to make conditional HTTP requests. + * + * @param eTag the eTag value to set + * @return the TenantAccessGetEntityTagHeaders object itself. + */ + public TenantAccessGetEntityTagHeaders withETag(String eTag) { + this.eTag = eTag; + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/TenantAccessGetHeaders.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/TenantAccessGetHeaders.java new file mode 100644 index 0000000000000..457abbcac254d --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/TenantAccessGetHeaders.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.apimanagement.v2019_01_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for Get operation. + */ +public class TenantAccessGetHeaders { + /** + * Current entity state version. Should be treated as opaque and used to + * make conditional HTTP requests. + */ + @JsonProperty(value = "ETag") + private String eTag; + + /** + * Get current entity state version. Should be treated as opaque and used to make conditional HTTP requests. + * + * @return the eTag value + */ + public String eTag() { + return this.eTag; + } + + /** + * Set current entity state version. Should be treated as opaque and used to make conditional HTTP requests. + * + * @param eTag the eTag value to set + * @return the TenantAccessGetHeaders object itself. + */ + public TenantAccessGetHeaders withETag(String eTag) { + this.eTag = eTag; + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/TenantAccessGitGetHeaders.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/TenantAccessGitGetHeaders.java new file mode 100644 index 0000000000000..709f9f3b73b3c --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/TenantAccessGitGetHeaders.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.apimanagement.v2019_01_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for Get operation. + */ +public class TenantAccessGitGetHeaders { + /** + * Current entity state version. Should be treated as opaque and used to + * make conditional HTTP requests. + */ + @JsonProperty(value = "ETag") + private String eTag; + + /** + * Get current entity state version. Should be treated as opaque and used to make conditional HTTP requests. + * + * @return the eTag value + */ + public String eTag() { + return this.eTag; + } + + /** + * Set current entity state version. Should be treated as opaque and used to make conditional HTTP requests. + * + * @param eTag the eTag value to set + * @return the TenantAccessGitGetHeaders object itself. + */ + public TenantAccessGitGetHeaders withETag(String eTag) { + this.eTag = eTag; + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/TenantAccessGits.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/TenantAccessGits.java new file mode 100644 index 0000000000000..df634071df413 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/TenantAccessGits.java @@ -0,0 +1,50 @@ +/** + * 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.apimanagement.v2019_01_01; + +import rx.Completable; +import rx.Observable; +import com.microsoft.azure.management.apimanagement.v2019_01_01.implementation.TenantAccessGitsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing TenantAccessGits. + */ +public interface TenantAccessGits extends HasInner { + /** + * Gets the Git access configuration for the tenant. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String resourceGroupName, String serviceName); + + /** + * Regenerate primary access key for GIT. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable regeneratePrimaryKeyAsync(String resourceGroupName, String serviceName); + + /** + * Regenerate secondary access key for GIT. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable regenerateSecondaryKeyAsync(String resourceGroupName, String serviceName); + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/TenantConfigurationSyncStateContract.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/TenantConfigurationSyncStateContract.java new file mode 100644 index 0000000000000..1249067cdd224 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/TenantConfigurationSyncStateContract.java @@ -0,0 +1,56 @@ +/** + * 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.apimanagement.v2019_01_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.apimanagement.v2019_01_01.implementation.ApiManagementManager; +import com.microsoft.azure.management.apimanagement.v2019_01_01.implementation.TenantConfigurationSyncStateContractInner; +import org.joda.time.DateTime; + +/** + * Type representing TenantConfigurationSyncStateContract. + */ +public interface TenantConfigurationSyncStateContract extends HasInner, HasManager { + /** + * @return the branch value. + */ + String branch(); + + /** + * @return the commitId value. + */ + String commitId(); + + /** + * @return the configurationChangeDate value. + */ + DateTime configurationChangeDate(); + + /** + * @return the isExport value. + */ + Boolean isExport(); + + /** + * @return the isGitEnabled value. + */ + Boolean isGitEnabled(); + + /** + * @return the isSynced value. + */ + Boolean isSynced(); + + /** + * @return the syncDate value. + */ + DateTime syncDate(); + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/TenantConfigurations.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/TenantConfigurations.java new file mode 100644 index 0000000000000..74a44ae342130 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/TenantConfigurations.java @@ -0,0 +1,62 @@ +/** + * 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.apimanagement.v2019_01_01; + +import rx.Observable; +import com.microsoft.azure.management.apimanagement.v2019_01_01.implementation.TenantConfigurationsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing TenantConfigurations. + */ +public interface TenantConfigurations extends HasInner { + /** + * This operation applies changes from the specified Git branch to the configuration database. This is a long running operation and could take several minutes to complete. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param parameters Deploy Configuration parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable deployAsync(String resourceGroupName, String serviceName, DeployConfigurationParameters parameters); + + /** + * This operation creates a commit with the current configuration snapshot to the specified branch in the repository. This is a long running operation and could take several minutes to complete. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param parameters Save Configuration parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable saveAsync(String resourceGroupName, String serviceName, SaveConfigurationParameter parameters); + + /** + * This operation validates the changes in the specified Git branch. This is a long running operation and could take several minutes to complete. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param parameters Validate Configuration parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable validateAsync(String resourceGroupName, String serviceName, DeployConfigurationParameters parameters); + + /** + * Gets the status of the most recent synchronization between the configuration database and the Git repository. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getSyncStateAsync(String resourceGroupName, String serviceName); + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/TermsOfServiceProperties.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/TermsOfServiceProperties.java new file mode 100644 index 0000000000000..bd4f7f23bc84e --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/TermsOfServiceProperties.java @@ -0,0 +1,95 @@ +/** + * 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.apimanagement.v2019_01_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Terms of service contract properties. + */ +public class TermsOfServiceProperties { + /** + * A terms of service text. + */ + @JsonProperty(value = "text") + private String text; + + /** + * Display terms of service during a sign-up process. + */ + @JsonProperty(value = "enabled") + private Boolean enabled; + + /** + * Ask user for consent to the terms of service. + */ + @JsonProperty(value = "consentRequired") + private Boolean consentRequired; + + /** + * Get a terms of service text. + * + * @return the text value + */ + public String text() { + return this.text; + } + + /** + * Set a terms of service text. + * + * @param text the text value to set + * @return the TermsOfServiceProperties object itself. + */ + public TermsOfServiceProperties withText(String text) { + this.text = text; + return this; + } + + /** + * Get display terms of service during a sign-up process. + * + * @return the enabled value + */ + public Boolean enabled() { + return this.enabled; + } + + /** + * Set display terms of service during a sign-up process. + * + * @param enabled the enabled value to set + * @return the TermsOfServiceProperties object itself. + */ + public TermsOfServiceProperties withEnabled(Boolean enabled) { + this.enabled = enabled; + return this; + } + + /** + * Get ask user for consent to the terms of service. + * + * @return the consentRequired value + */ + public Boolean consentRequired() { + return this.consentRequired; + } + + /** + * Set ask user for consent to the terms of service. + * + * @param consentRequired the consentRequired value to set + * @return the TermsOfServiceProperties object itself. + */ + public TermsOfServiceProperties withConsentRequired(Boolean consentRequired) { + this.consentRequired = consentRequired; + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/TokenBodyParameterContract.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/TokenBodyParameterContract.java new file mode 100644 index 0000000000000..3f9d282dc163c --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/TokenBodyParameterContract.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.apimanagement.v2019_01_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * OAuth acquire token request body parameter (www-url-form-encoded). + */ +public class TokenBodyParameterContract { + /** + * body parameter name. + */ + @JsonProperty(value = "name", required = true) + private String name; + + /** + * body parameter value. + */ + @JsonProperty(value = "value", required = true) + private String value; + + /** + * Get body parameter name. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set body parameter name. + * + * @param name the name value to set + * @return the TokenBodyParameterContract object itself. + */ + public TokenBodyParameterContract withName(String name) { + this.name = name; + return this; + } + + /** + * Get body parameter value. + * + * @return the value value + */ + public String value() { + return this.value; + } + + /** + * Set body parameter value. + * + * @param value the value value to set + * @return the TokenBodyParameterContract object itself. + */ + public TokenBodyParameterContract withValue(String value) { + this.value = value; + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/UserConfirmationPasswords.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/UserConfirmationPasswords.java new file mode 100644 index 0000000000000..418ed7c068a16 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/UserConfirmationPasswords.java @@ -0,0 +1,30 @@ +/** + * 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.apimanagement.v2019_01_01; + +import rx.Completable; +import com.microsoft.azure.management.apimanagement.v2019_01_01.implementation.UserConfirmationPasswordsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing UserConfirmationPasswords. + */ +public interface UserConfirmationPasswords extends HasInner { + /** + * Sends confirmation. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param userId User identifier. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable sendAsync(String resourceGroupName, String serviceName, String userId); + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/UserContract.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/UserContract.java new file mode 100644 index 0000000000000..44d61f667b6a1 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/UserContract.java @@ -0,0 +1,321 @@ +/** + * 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.apimanagement.v2019_01_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.apimanagement.v2019_01_01.implementation.UserContractInner; +import com.microsoft.azure.arm.model.Indexable; +import com.microsoft.azure.arm.model.Creatable; +import com.microsoft.azure.arm.model.Updatable; +import com.microsoft.azure.arm.model.Appliable; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.apimanagement.v2019_01_01.implementation.ApiManagementManager; +import java.util.List; +import com.microsoft.azure.management.apimanagement.v2019_01_01.implementation.UserIdentityContractInner; +import org.joda.time.DateTime; + +/** + * Type representing UserContract. + */ +public interface UserContract extends HasInner, Indexable, Updatable, HasManager { + /** + * @return the email value. + */ + String email(); + + /** + * @return the firstName value. + */ + String firstName(); + + /** + * @return the groups value. + */ + List groups(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the identities value. + */ + List identities(); + + /** + * @return the lastName value. + */ + String lastName(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the note value. + */ + String note(); + + /** + * @return the registrationDate value. + */ + DateTime registrationDate(); + + /** + * @return the state value. + */ + UserState state(); + + /** + * @return the type value. + */ + String type(); + + /** + * The entirety of the UserContract definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithResourceGroupName, DefinitionStages.WithServiceName, DefinitionStages.WithIfMatch, DefinitionStages.WithEmail, DefinitionStages.WithFirstName, DefinitionStages.WithLastName, DefinitionStages.WithCreate { + } + + /** + * Grouping of UserContract definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a UserContract definition. + */ + interface Blank extends WithResourceGroupName { + } + + /** + * The stage of the usercontract definition allowing to specify ResourceGroupName. + */ + interface WithResourceGroupName { + /** + * Specifies resourceGroupName. + * @param resourceGroupName The name of the resource group + * @return the next definition stage + */ + WithServiceName withResourceGroupName(String resourceGroupName); + } + + /** + * The stage of the usercontract definition allowing to specify ServiceName. + */ + interface WithServiceName { + /** + * Specifies serviceName. + * @param serviceName The name of the API Management service + * @return the next definition stage + */ + WithIfMatch withServiceName(String serviceName); + } + + /** + * The stage of the usercontract definition allowing to specify IfMatch. + */ + interface WithIfMatch { + /** + * Specifies ifMatch. + * @param ifMatch ETag of the Entity. Not required when creating an entity, but required when updating an entity + * @return the next definition stage + */ + WithEmail withIfMatch(String ifMatch); + } + + /** + * The stage of the usercontract definition allowing to specify Email. + */ + interface WithEmail { + /** + * Specifies email. + * @param email Email address. Must not be empty and must be unique within the service instance + * @return the next definition stage + */ + WithFirstName withEmail(String email); + } + + /** + * The stage of the usercontract definition allowing to specify FirstName. + */ + interface WithFirstName { + /** + * Specifies firstName. + * @param firstName First name + * @return the next definition stage + */ + WithLastName withFirstName(String firstName); + } + + /** + * The stage of the usercontract definition allowing to specify LastName. + */ + interface WithLastName { + /** + * Specifies lastName. + * @param lastName Last name + * @return the next definition stage + */ + WithCreate withLastName(String lastName); + } + + /** + * The stage of the usercontract definition allowing to specify Confirmation. + */ + interface WithConfirmation { + /** + * Specifies confirmation. + * @param confirmation Determines the type of confirmation e-mail that will be sent to the newly created user. Possible values include: 'signup', 'invite' + * @return the next definition stage + */ + WithCreate withConfirmation(Confirmation confirmation); + } + + /** + * The stage of the usercontract definition allowing to specify Identities. + */ + interface WithIdentities { + /** + * Specifies identities. + * @param identities Collection of user identities + * @return the next definition stage + */ + WithCreate withIdentities(List identities); + } + + /** + * The stage of the usercontract definition allowing to specify Note. + */ + interface WithNote { + /** + * Specifies note. + * @param note Optional note about a user set by the administrator + * @return the next definition stage + */ + WithCreate withNote(String note); + } + + /** + * The stage of the usercontract definition allowing to specify Password. + */ + interface WithPassword { + /** + * Specifies password. + * @param password User Password. If no value is provided, a default password is generated + * @return the next definition stage + */ + WithCreate withPassword(String password); + } + + /** + * The stage of the usercontract definition allowing to specify State. + */ + interface WithState { + /** + * Specifies state. + * @param state Account state. Specifies whether the user is active or not. Blocked users are unable to sign into the developer portal or call any APIs of subscribed products. Default state is Active. Possible values include: 'active', 'blocked', 'pending', 'deleted' + * @return the next definition stage + */ + WithCreate withState(UserState state); + } + + /** + * The stage of the definition which contains all the minimum required inputs for + * the resource to be created (via {@link WithCreate#create()}), but also allows + * for any other optional settings to be specified. + */ + interface WithCreate extends Creatable, DefinitionStages.WithConfirmation, DefinitionStages.WithIdentities, DefinitionStages.WithNote, DefinitionStages.WithPassword, DefinitionStages.WithState { + } + } + /** + * The template for a UserContract update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithIfMatch, UpdateStages.WithConfirmation, UpdateStages.WithIdentities, UpdateStages.WithNote, UpdateStages.WithPassword, UpdateStages.WithState { + } + + /** + * Grouping of UserContract update stages. + */ + interface UpdateStages { + /** + * The stage of the usercontract update allowing to specify IfMatch. + */ + interface WithIfMatch { + /** + * Specifies ifMatch. + * @param ifMatch ETag of the Entity. Not required when creating an entity, but required when updating an entity + * @return the next update stage + */ + Update withIfMatch(String ifMatch); + } + + /** + * The stage of the usercontract update allowing to specify Confirmation. + */ + interface WithConfirmation { + /** + * Specifies confirmation. + * @param confirmation Determines the type of confirmation e-mail that will be sent to the newly created user. Possible values include: 'signup', 'invite' + * @return the next update stage + */ + Update withConfirmation(Confirmation confirmation); + } + + /** + * The stage of the usercontract update allowing to specify Identities. + */ + interface WithIdentities { + /** + * Specifies identities. + * @param identities Collection of user identities + * @return the next update stage + */ + Update withIdentities(List identities); + } + + /** + * The stage of the usercontract update allowing to specify Note. + */ + interface WithNote { + /** + * Specifies note. + * @param note Optional note about a user set by the administrator + * @return the next update stage + */ + Update withNote(String note); + } + + /** + * The stage of the usercontract update allowing to specify Password. + */ + interface WithPassword { + /** + * Specifies password. + * @param password User Password. If no value is provided, a default password is generated + * @return the next update stage + */ + Update withPassword(String password); + } + + /** + * The stage of the usercontract update allowing to specify State. + */ + interface WithState { + /** + * Specifies state. + * @param state Account state. Specifies whether the user is active or not. Blocked users are unable to sign into the developer portal or call any APIs of subscribed products. Default state is Active. Possible values include: 'active', 'blocked', 'pending', 'deleted' + * @return the next update stage + */ + Update withState(UserState state); + } + + } +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/UserCreateOrUpdateHeaders.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/UserCreateOrUpdateHeaders.java new file mode 100644 index 0000000000000..7c3ad827112c9 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/UserCreateOrUpdateHeaders.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.apimanagement.v2019_01_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for CreateOrUpdate operation. + */ +public class UserCreateOrUpdateHeaders { + /** + * Current entity state version. Should be treated as opaque and used to + * make conditional HTTP requests. + */ + @JsonProperty(value = "ETag") + private String eTag; + + /** + * Get current entity state version. Should be treated as opaque and used to make conditional HTTP requests. + * + * @return the eTag value + */ + public String eTag() { + return this.eTag; + } + + /** + * Set current entity state version. Should be treated as opaque and used to make conditional HTTP requests. + * + * @param eTag the eTag value to set + * @return the UserCreateOrUpdateHeaders object itself. + */ + public UserCreateOrUpdateHeaders withETag(String eTag) { + this.eTag = eTag; + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/UserCreateParameters.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/UserCreateParameters.java new file mode 100644 index 0000000000000..64406fce76eee --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/UserCreateParameters.java @@ -0,0 +1,234 @@ +/** + * 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.apimanagement.v2019_01_01; + +import java.util.List; +import com.microsoft.azure.management.apimanagement.v2019_01_01.implementation.UserIdentityContractInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; + +/** + * User create details. + */ +@JsonFlatten +public class UserCreateParameters { + /** + * Account state. Specifies whether the user is active or not. Blocked + * users are unable to sign into the developer portal or call any APIs of + * subscribed products. Default state is Active. Possible values include: + * 'active', 'blocked', 'pending', 'deleted'. + */ + @JsonProperty(value = "properties.state") + private UserState state; + + /** + * Optional note about a user set by the administrator. + */ + @JsonProperty(value = "properties.note") + private String note; + + /** + * Collection of user identities. + */ + @JsonProperty(value = "properties.identities") + private List identities; + + /** + * Email address. Must not be empty and must be unique within the service + * instance. + */ + @JsonProperty(value = "properties.email", required = true) + private String email; + + /** + * First name. + */ + @JsonProperty(value = "properties.firstName", required = true) + private String firstName; + + /** + * Last name. + */ + @JsonProperty(value = "properties.lastName", required = true) + private String lastName; + + /** + * User Password. If no value is provided, a default password is generated. + */ + @JsonProperty(value = "properties.password") + private String password; + + /** + * Determines the type of confirmation e-mail that will be sent to the + * newly created user. Possible values include: 'signup', 'invite'. + */ + @JsonProperty(value = "properties.confirmation") + private Confirmation confirmation; + + /** + * Get account state. Specifies whether the user is active or not. Blocked users are unable to sign into the developer portal or call any APIs of subscribed products. Default state is Active. Possible values include: 'active', 'blocked', 'pending', 'deleted'. + * + * @return the state value + */ + public UserState state() { + return this.state; + } + + /** + * Set account state. Specifies whether the user is active or not. Blocked users are unable to sign into the developer portal or call any APIs of subscribed products. Default state is Active. Possible values include: 'active', 'blocked', 'pending', 'deleted'. + * + * @param state the state value to set + * @return the UserCreateParameters object itself. + */ + public UserCreateParameters withState(UserState state) { + this.state = state; + return this; + } + + /** + * Get optional note about a user set by the administrator. + * + * @return the note value + */ + public String note() { + return this.note; + } + + /** + * Set optional note about a user set by the administrator. + * + * @param note the note value to set + * @return the UserCreateParameters object itself. + */ + public UserCreateParameters withNote(String note) { + this.note = note; + return this; + } + + /** + * Get collection of user identities. + * + * @return the identities value + */ + public List identities() { + return this.identities; + } + + /** + * Set collection of user identities. + * + * @param identities the identities value to set + * @return the UserCreateParameters object itself. + */ + public UserCreateParameters withIdentities(List identities) { + this.identities = identities; + return this; + } + + /** + * Get email address. Must not be empty and must be unique within the service instance. + * + * @return the email value + */ + public String email() { + return this.email; + } + + /** + * Set email address. Must not be empty and must be unique within the service instance. + * + * @param email the email value to set + * @return the UserCreateParameters object itself. + */ + public UserCreateParameters withEmail(String email) { + this.email = email; + return this; + } + + /** + * Get first name. + * + * @return the firstName value + */ + public String firstName() { + return this.firstName; + } + + /** + * Set first name. + * + * @param firstName the firstName value to set + * @return the UserCreateParameters object itself. + */ + public UserCreateParameters withFirstName(String firstName) { + this.firstName = firstName; + return this; + } + + /** + * Get last name. + * + * @return the lastName value + */ + public String lastName() { + return this.lastName; + } + + /** + * Set last name. + * + * @param lastName the lastName value to set + * @return the UserCreateParameters object itself. + */ + public UserCreateParameters withLastName(String lastName) { + this.lastName = lastName; + return this; + } + + /** + * Get user Password. If no value is provided, a default password is generated. + * + * @return the password value + */ + public String password() { + return this.password; + } + + /** + * Set user Password. If no value is provided, a default password is generated. + * + * @param password the password value to set + * @return the UserCreateParameters object itself. + */ + public UserCreateParameters withPassword(String password) { + this.password = password; + return this; + } + + /** + * Get determines the type of confirmation e-mail that will be sent to the newly created user. Possible values include: 'signup', 'invite'. + * + * @return the confirmation value + */ + public Confirmation confirmation() { + return this.confirmation; + } + + /** + * Set determines the type of confirmation e-mail that will be sent to the newly created user. Possible values include: 'signup', 'invite'. + * + * @param confirmation the confirmation value to set + * @return the UserCreateParameters object itself. + */ + public UserCreateParameters withConfirmation(Confirmation confirmation) { + this.confirmation = confirmation; + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/UserEntityBaseParameters.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/UserEntityBaseParameters.java new file mode 100644 index 0000000000000..5ddfe2630cdd7 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/UserEntityBaseParameters.java @@ -0,0 +1,100 @@ +/** + * 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.apimanagement.v2019_01_01; + +import java.util.List; +import com.microsoft.azure.management.apimanagement.v2019_01_01.implementation.UserIdentityContractInner; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * User Entity Base Parameters set. + */ +public class UserEntityBaseParameters { + /** + * Account state. Specifies whether the user is active or not. Blocked + * users are unable to sign into the developer portal or call any APIs of + * subscribed products. Default state is Active. Possible values include: + * 'active', 'blocked', 'pending', 'deleted'. + */ + @JsonProperty(value = "state") + private UserState state; + + /** + * Optional note about a user set by the administrator. + */ + @JsonProperty(value = "note") + private String note; + + /** + * Collection of user identities. + */ + @JsonProperty(value = "identities") + private List identities; + + /** + * Get account state. Specifies whether the user is active or not. Blocked users are unable to sign into the developer portal or call any APIs of subscribed products. Default state is Active. Possible values include: 'active', 'blocked', 'pending', 'deleted'. + * + * @return the state value + */ + public UserState state() { + return this.state; + } + + /** + * Set account state. Specifies whether the user is active or not. Blocked users are unable to sign into the developer portal or call any APIs of subscribed products. Default state is Active. Possible values include: 'active', 'blocked', 'pending', 'deleted'. + * + * @param state the state value to set + * @return the UserEntityBaseParameters object itself. + */ + public UserEntityBaseParameters withState(UserState state) { + this.state = state; + return this; + } + + /** + * Get optional note about a user set by the administrator. + * + * @return the note value + */ + public String note() { + return this.note; + } + + /** + * Set optional note about a user set by the administrator. + * + * @param note the note value to set + * @return the UserEntityBaseParameters object itself. + */ + public UserEntityBaseParameters withNote(String note) { + this.note = note; + return this; + } + + /** + * Get collection of user identities. + * + * @return the identities value + */ + public List identities() { + return this.identities; + } + + /** + * Set collection of user identities. + * + * @param identities the identities value to set + * @return the UserEntityBaseParameters object itself. + */ + public UserEntityBaseParameters withIdentities(List identities) { + this.identities = identities; + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/UserGetEntityTagHeaders.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/UserGetEntityTagHeaders.java new file mode 100644 index 0000000000000..b8e48c47c771f --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/UserGetEntityTagHeaders.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.apimanagement.v2019_01_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for GetEntityTag operation. + */ +public class UserGetEntityTagHeaders { + /** + * Current entity state version. Should be treated as opaque and used to + * make conditional HTTP requests. + */ + @JsonProperty(value = "ETag") + private String eTag; + + /** + * Get current entity state version. Should be treated as opaque and used to make conditional HTTP requests. + * + * @return the eTag value + */ + public String eTag() { + return this.eTag; + } + + /** + * Set current entity state version. Should be treated as opaque and used to make conditional HTTP requests. + * + * @param eTag the eTag value to set + * @return the UserGetEntityTagHeaders object itself. + */ + public UserGetEntityTagHeaders withETag(String eTag) { + this.eTag = eTag; + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/UserGetHeaders.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/UserGetHeaders.java new file mode 100644 index 0000000000000..f5f91319ea148 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/UserGetHeaders.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.apimanagement.v2019_01_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for Get operation. + */ +public class UserGetHeaders { + /** + * Current entity state version. Should be treated as opaque and used to + * make conditional HTTP requests. + */ + @JsonProperty(value = "ETag") + private String eTag; + + /** + * Get current entity state version. Should be treated as opaque and used to make conditional HTTP requests. + * + * @return the eTag value + */ + public String eTag() { + return this.eTag; + } + + /** + * Set current entity state version. Should be treated as opaque and used to make conditional HTTP requests. + * + * @param eTag the eTag value to set + * @return the UserGetHeaders object itself. + */ + public UserGetHeaders withETag(String eTag) { + this.eTag = eTag; + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/UserGroupContract.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/UserGroupContract.java new file mode 100644 index 0000000000000..d5c5688e3dc4e --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/UserGroupContract.java @@ -0,0 +1,60 @@ +/** + * 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.apimanagement.v2019_01_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.apimanagement.v2019_01_01.implementation.GroupContractInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.apimanagement.v2019_01_01.implementation.ApiManagementManager; + +/** + * Type representing UserGroupContract. + */ +public interface UserGroupContract extends HasInner, HasManager { + /** + * @return the builtIn value. + */ + Boolean builtIn(); + + /** + * @return the description value. + */ + String description(); + + /** + * @return the displayName value. + */ + String displayName(); + + /** + * @return the externalId value. + */ + String externalId(); + + /** + * @return the groupContractType value. + */ + GroupType groupContractType(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the type value. + */ + String type(); + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/UserGroups.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/UserGroups.java new file mode 100644 index 0000000000000..d17b9cb180dd9 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/UserGroups.java @@ -0,0 +1,30 @@ +/** + * 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.apimanagement.v2019_01_01; + +import rx.Observable; +import com.microsoft.azure.management.apimanagement.v2019_01_01.implementation.UserGroupsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing UserGroups. + */ +public interface UserGroups extends HasInner { + /** + * Lists all user groups. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param userId User identifier. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listAsync(final String resourceGroupName, final String serviceName, final String userId); + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/UserIdentities.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/UserIdentities.java new file mode 100644 index 0000000000000..e06685287692a --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/UserIdentities.java @@ -0,0 +1,30 @@ +/** + * 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.apimanagement.v2019_01_01; + +import rx.Observable; +import com.microsoft.azure.management.apimanagement.v2019_01_01.implementation.UserIdentitiesInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing UserIdentities. + */ +public interface UserIdentities extends HasInner { + /** + * List of all user identities. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param userId User identifier. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listAsync(final String resourceGroupName, final String serviceName, final String userId); + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/UserIdentityContract.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/UserIdentityContract.java new file mode 100644 index 0000000000000..1e8d9b5101922 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/UserIdentityContract.java @@ -0,0 +1,30 @@ +/** + * 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.apimanagement.v2019_01_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.apimanagement.v2019_01_01.implementation.UserIdentityContractInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.apimanagement.v2019_01_01.implementation.ApiManagementManager; + +/** + * Type representing UserIdentityContract. + */ +public interface UserIdentityContract extends HasInner, HasManager { + /** + * @return the id value. + */ + String id(); + + /** + * @return the provider value. + */ + String provider(); + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/UserState.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/UserState.java new file mode 100644 index 0000000000000..beff6a1a14274 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/UserState.java @@ -0,0 +1,47 @@ +/** + * 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.apimanagement.v2019_01_01; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for UserState. + */ +public final class UserState extends ExpandableStringEnum { + /** Static value active for UserState. */ + public static final UserState ACTIVE = fromString("active"); + + /** Static value blocked for UserState. */ + public static final UserState BLOCKED = fromString("blocked"); + + /** Static value pending for UserState. */ + public static final UserState PENDING = fromString("pending"); + + /** Static value deleted for UserState. */ + public static final UserState DELETED = fromString("deleted"); + + /** + * Creates or finds a UserState from its string representation. + * @param name a name to look for + * @return the corresponding UserState + */ + @JsonCreator + public static UserState fromString(String name) { + return fromString(name, UserState.class); + } + + /** + * @return known UserState values + */ + public static Collection values() { + return values(UserState.class); + } +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/UserSubscriptionContract.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/UserSubscriptionContract.java new file mode 100644 index 0000000000000..9602bdae7bb59 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/UserSubscriptionContract.java @@ -0,0 +1,101 @@ +/** + * 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.apimanagement.v2019_01_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.apimanagement.v2019_01_01.implementation.SubscriptionContractInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.apimanagement.v2019_01_01.implementation.ApiManagementManager; +import org.joda.time.DateTime; + +/** + * Type representing UserSubscriptionContract. + */ +public interface UserSubscriptionContract extends HasInner, HasManager { + /** + * @return the allowTracing value. + */ + Boolean allowTracing(); + + /** + * @return the createdDate value. + */ + DateTime createdDate(); + + /** + * @return the displayName value. + */ + String displayName(); + + /** + * @return the endDate value. + */ + DateTime endDate(); + + /** + * @return the expirationDate value. + */ + DateTime expirationDate(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the notificationDate value. + */ + DateTime notificationDate(); + + /** + * @return the ownerId value. + */ + String ownerId(); + + /** + * @return the primaryKey value. + */ + String primaryKey(); + + /** + * @return the scope value. + */ + String scope(); + + /** + * @return the secondaryKey value. + */ + String secondaryKey(); + + /** + * @return the startDate value. + */ + DateTime startDate(); + + /** + * @return the state value. + */ + SubscriptionState state(); + + /** + * @return the stateComment value. + */ + String stateComment(); + + /** + * @return the type value. + */ + String type(); + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/UserSubscriptions.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/UserSubscriptions.java new file mode 100644 index 0000000000000..1bdd8c66eef54 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/UserSubscriptions.java @@ -0,0 +1,30 @@ +/** + * 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.apimanagement.v2019_01_01; + +import rx.Observable; +import com.microsoft.azure.management.apimanagement.v2019_01_01.implementation.UserSubscriptionsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing UserSubscriptions. + */ +public interface UserSubscriptions extends HasInner { + /** + * Lists the collection of subscriptions of the specified user. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param userId User identifier. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listAsync(final String resourceGroupName, final String serviceName, final String userId); + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/UserTokenParameters.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/UserTokenParameters.java new file mode 100644 index 0000000000000..897315a2ccc6f --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/UserTokenParameters.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.apimanagement.v2019_01_01; + +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; + +/** + * Get User Token parameters. + */ +@JsonFlatten +public class UserTokenParameters { + /** + * The Key to be used to generate token for user. Possible values include: + * 'primary', 'secondary'. + */ + @JsonProperty(value = "properties.keyType", required = true) + private KeyType keyType; + + /** + * The Expiry time of the Token. Maximum token expiry time is set to 30 + * days. The date conforms to the following format: `yyyy-MM-ddTHH:mm:ssZ` + * as specified by the ISO 8601 standard. + */ + @JsonProperty(value = "properties.expiry", required = true) + private DateTime expiry; + + /** + * Get the Key to be used to generate token for user. Possible values include: 'primary', 'secondary'. + * + * @return the keyType value + */ + public KeyType keyType() { + return this.keyType; + } + + /** + * Set the Key to be used to generate token for user. Possible values include: 'primary', 'secondary'. + * + * @param keyType the keyType value to set + * @return the UserTokenParameters object itself. + */ + public UserTokenParameters withKeyType(KeyType keyType) { + this.keyType = keyType; + return this; + } + + /** + * Get the Expiry time of the Token. Maximum token expiry time is set to 30 days. The date conforms to the following format: `yyyy-MM-ddTHH:mm:ssZ` as specified by the ISO 8601 standard. + * + * @return the expiry value + */ + public DateTime expiry() { + return this.expiry; + } + + /** + * Set the Expiry time of the Token. Maximum token expiry time is set to 30 days. The date conforms to the following format: `yyyy-MM-ddTHH:mm:ssZ` as specified by the ISO 8601 standard. + * + * @param expiry the expiry value to set + * @return the UserTokenParameters object itself. + */ + public UserTokenParameters withExpiry(DateTime expiry) { + this.expiry = expiry; + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/UserTokenResult.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/UserTokenResult.java new file mode 100644 index 0000000000000..7323afc045d54 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/UserTokenResult.java @@ -0,0 +1,25 @@ +/** + * 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.apimanagement.v2019_01_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.apimanagement.v2019_01_01.implementation.ApiManagementManager; +import com.microsoft.azure.management.apimanagement.v2019_01_01.implementation.UserTokenResultInner; + +/** + * Type representing UserTokenResult. + */ +public interface UserTokenResult extends HasInner, HasManager { + /** + * @return the value value. + */ + String value(); + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/UserUpdateParameters.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/UserUpdateParameters.java new file mode 100644 index 0000000000000..29605d9817209 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/UserUpdateParameters.java @@ -0,0 +1,207 @@ +/** + * 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.apimanagement.v2019_01_01; + +import java.util.List; +import com.microsoft.azure.management.apimanagement.v2019_01_01.implementation.UserIdentityContractInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; + +/** + * User update parameters. + */ +@JsonFlatten +public class UserUpdateParameters { + /** + * Account state. Specifies whether the user is active or not. Blocked + * users are unable to sign into the developer portal or call any APIs of + * subscribed products. Default state is Active. Possible values include: + * 'active', 'blocked', 'pending', 'deleted'. + */ + @JsonProperty(value = "properties.state") + private UserState state; + + /** + * Optional note about a user set by the administrator. + */ + @JsonProperty(value = "properties.note") + private String note; + + /** + * Collection of user identities. + */ + @JsonProperty(value = "properties.identities") + private List identities; + + /** + * Email address. Must not be empty and must be unique within the service + * instance. + */ + @JsonProperty(value = "properties.email") + private String email; + + /** + * User Password. + */ + @JsonProperty(value = "properties.password") + private String password; + + /** + * First name. + */ + @JsonProperty(value = "properties.firstName") + private String firstName; + + /** + * Last name. + */ + @JsonProperty(value = "properties.lastName") + private String lastName; + + /** + * Get account state. Specifies whether the user is active or not. Blocked users are unable to sign into the developer portal or call any APIs of subscribed products. Default state is Active. Possible values include: 'active', 'blocked', 'pending', 'deleted'. + * + * @return the state value + */ + public UserState state() { + return this.state; + } + + /** + * Set account state. Specifies whether the user is active or not. Blocked users are unable to sign into the developer portal or call any APIs of subscribed products. Default state is Active. Possible values include: 'active', 'blocked', 'pending', 'deleted'. + * + * @param state the state value to set + * @return the UserUpdateParameters object itself. + */ + public UserUpdateParameters withState(UserState state) { + this.state = state; + return this; + } + + /** + * Get optional note about a user set by the administrator. + * + * @return the note value + */ + public String note() { + return this.note; + } + + /** + * Set optional note about a user set by the administrator. + * + * @param note the note value to set + * @return the UserUpdateParameters object itself. + */ + public UserUpdateParameters withNote(String note) { + this.note = note; + return this; + } + + /** + * Get collection of user identities. + * + * @return the identities value + */ + public List identities() { + return this.identities; + } + + /** + * Set collection of user identities. + * + * @param identities the identities value to set + * @return the UserUpdateParameters object itself. + */ + public UserUpdateParameters withIdentities(List identities) { + this.identities = identities; + return this; + } + + /** + * Get email address. Must not be empty and must be unique within the service instance. + * + * @return the email value + */ + public String email() { + return this.email; + } + + /** + * Set email address. Must not be empty and must be unique within the service instance. + * + * @param email the email value to set + * @return the UserUpdateParameters object itself. + */ + public UserUpdateParameters withEmail(String email) { + this.email = email; + return this; + } + + /** + * Get user Password. + * + * @return the password value + */ + public String password() { + return this.password; + } + + /** + * Set user Password. + * + * @param password the password value to set + * @return the UserUpdateParameters object itself. + */ + public UserUpdateParameters withPassword(String password) { + this.password = password; + return this; + } + + /** + * Get first name. + * + * @return the firstName value + */ + public String firstName() { + return this.firstName; + } + + /** + * Set first name. + * + * @param firstName the firstName value to set + * @return the UserUpdateParameters object itself. + */ + public UserUpdateParameters withFirstName(String firstName) { + this.firstName = firstName; + return this; + } + + /** + * Get last name. + * + * @return the lastName value + */ + public String lastName() { + return this.lastName; + } + + /** + * Set last name. + * + * @param lastName the lastName value to set + * @return the UserUpdateParameters object itself. + */ + public UserUpdateParameters withLastName(String lastName) { + this.lastName = lastName; + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/Users.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/Users.java new file mode 100644 index 0000000000000..2c63786ca7f6d --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/Users.java @@ -0,0 +1,88 @@ +/** + * 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.apimanagement.v2019_01_01; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import rx.Completable; +import rx.Observable; +import com.microsoft.azure.management.apimanagement.v2019_01_01.implementation.UsersInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing Users. + */ +public interface Users extends SupportsCreating, HasInner { + /** + * Lists a collection of registered users in the specified service instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByServiceAsync(final String resourceGroupName, final String serviceName); + + /** + * Gets the entity state (Etag) version of the user specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param userId User identifier. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable getEntityTagAsync(String resourceGroupName, String serviceName, String userId); + + /** + * Gets the details of the user specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param userId User identifier. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String resourceGroupName, String serviceName, String userId); + + /** + * Deletes specific user. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param userId User identifier. Must be unique in the current API Management service instance. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable deleteAsync(String resourceGroupName, String serviceName, String userId, String ifMatch); + + /** + * Retrieves a redirection URL containing an authentication token for signing a given user into the developer portal. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param userId User identifier. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable generateSsoUrlAsync(String resourceGroupName, String serviceName, String userId); + + /** + * Gets the Shared Access Authorization Token for the User. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param userId User identifier. Must be unique in the current API Management service instance. + * @param parameters Create Authorization Token parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getSharedAccessTokenAsync(String resourceGroupName, String serviceName, String userId, UserTokenParameters parameters); + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/VersioningScheme.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/VersioningScheme.java new file mode 100644 index 0000000000000..0bac67921e015 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/VersioningScheme.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.apimanagement.v2019_01_01; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for VersioningScheme. + */ +public final class VersioningScheme extends ExpandableStringEnum { + /** Static value Segment for VersioningScheme. */ + public static final VersioningScheme SEGMENT = fromString("Segment"); + + /** Static value Query for VersioningScheme. */ + public static final VersioningScheme QUERY = fromString("Query"); + + /** Static value Header for VersioningScheme. */ + public static final VersioningScheme HEADER = fromString("Header"); + + /** + * Creates or finds a VersioningScheme from its string representation. + * @param name a name to look for + * @return the corresponding VersioningScheme + */ + @JsonCreator + public static VersioningScheme fromString(String name) { + return fromString(name, VersioningScheme.class); + } + + /** + * @return known VersioningScheme values + */ + public static Collection values() { + return values(VersioningScheme.class); + } +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/VirtualNetworkConfiguration.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/VirtualNetworkConfiguration.java new file mode 100644 index 0000000000000..5998bdda387e0 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/VirtualNetworkConfiguration.java @@ -0,0 +1,76 @@ +/** + * 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.apimanagement.v2019_01_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Configuration of a virtual network to which API Management service is + * deployed. + */ +public class VirtualNetworkConfiguration { + /** + * The virtual network ID. This is typically a GUID. Expect a null GUID by + * default. + */ + @JsonProperty(value = "vnetid", access = JsonProperty.Access.WRITE_ONLY) + private String vnetid; + + /** + * The name of the subnet. + */ + @JsonProperty(value = "subnetname", access = JsonProperty.Access.WRITE_ONLY) + private String subnetname; + + /** + * The full resource ID of a subnet in a virtual network to deploy the API + * Management service in. + */ + @JsonProperty(value = "subnetResourceId") + private String subnetResourceId; + + /** + * Get the virtual network ID. This is typically a GUID. Expect a null GUID by default. + * + * @return the vnetid value + */ + public String vnetid() { + return this.vnetid; + } + + /** + * Get the name of the subnet. + * + * @return the subnetname value + */ + public String subnetname() { + return this.subnetname; + } + + /** + * Get the full resource ID of a subnet in a virtual network to deploy the API Management service in. + * + * @return the subnetResourceId value + */ + public String subnetResourceId() { + return this.subnetResourceId; + } + + /** + * Set the full resource ID of a subnet in a virtual network to deploy the API Management service in. + * + * @param subnetResourceId the subnetResourceId value to set + * @return the VirtualNetworkConfiguration object itself. + */ + public VirtualNetworkConfiguration withSubnetResourceId(String subnetResourceId) { + this.subnetResourceId = subnetResourceId; + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/VirtualNetworkType.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/VirtualNetworkType.java new file mode 100644 index 0000000000000..ad40f4dcb2d2d --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/VirtualNetworkType.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.apimanagement.v2019_01_01; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for VirtualNetworkType. + */ +public final class VirtualNetworkType extends ExpandableStringEnum { + /** Static value None for VirtualNetworkType. */ + public static final VirtualNetworkType NONE = fromString("None"); + + /** Static value External for VirtualNetworkType. */ + public static final VirtualNetworkType EXTERNAL = fromString("External"); + + /** Static value Internal for VirtualNetworkType. */ + public static final VirtualNetworkType INTERNAL = fromString("Internal"); + + /** + * Creates or finds a VirtualNetworkType from its string representation. + * @param name a name to look for + * @return the corresponding VirtualNetworkType + */ + @JsonCreator + public static VirtualNetworkType fromString(String name) { + return fromString(name, VirtualNetworkType.class); + } + + /** + * @return known VirtualNetworkType values + */ + public static Collection values() { + return values(VirtualNetworkType.class); + } +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/X509CertificateName.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/X509CertificateName.java new file mode 100644 index 0000000000000..089e158d33b98 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/X509CertificateName.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.apimanagement.v2019_01_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Properties of server X509Names. + */ +public class X509CertificateName { + /** + * Common Name of the Certificate. + */ + @JsonProperty(value = "name") + private String name; + + /** + * Thumbprint for the Issuer of the Certificate. + */ + @JsonProperty(value = "issuerCertificateThumbprint") + private String issuerCertificateThumbprint; + + /** + * Get common Name of the Certificate. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set common Name of the Certificate. + * + * @param name the name value to set + * @return the X509CertificateName object itself. + */ + public X509CertificateName withName(String name) { + this.name = name; + return this; + } + + /** + * Get thumbprint for the Issuer of the Certificate. + * + * @return the issuerCertificateThumbprint value + */ + public String issuerCertificateThumbprint() { + return this.issuerCertificateThumbprint; + } + + /** + * Set thumbprint for the Issuer of the Certificate. + * + * @param issuerCertificateThumbprint the issuerCertificateThumbprint value to set + * @return the X509CertificateName object itself. + */ + public X509CertificateName withIssuerCertificateThumbprint(String issuerCertificateThumbprint) { + this.issuerCertificateThumbprint = issuerCertificateThumbprint; + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/AccessInformationContractImpl.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/AccessInformationContractImpl.java new file mode 100644 index 0000000000000..9ffb8ef0ec90f --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/AccessInformationContractImpl.java @@ -0,0 +1,46 @@ +/** + * 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.apimanagement.v2019_01_01.implementation; + +import com.microsoft.azure.management.apimanagement.v2019_01_01.AccessInformationContract; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; + +class AccessInformationContractImpl extends WrapperImpl implements AccessInformationContract { + private final ApiManagementManager manager; + AccessInformationContractImpl(AccessInformationContractInner inner, ApiManagementManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public ApiManagementManager manager() { + return this.manager; + } + + @Override + public Boolean enabled() { + return this.inner().enabled(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String primaryKey() { + return this.inner().primaryKey(); + } + + @Override + public String secondaryKey() { + return this.inner().secondaryKey(); + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/AccessInformationContractInner.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/AccessInformationContractInner.java new file mode 100644 index 0000000000000..7e6d43c2fb344 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/AccessInformationContractInner.java @@ -0,0 +1,121 @@ +/** + * 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.apimanagement.v2019_01_01.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Tenant access information contract of the API Management service. + */ +public class AccessInformationContractInner { + /** + * Identifier. + */ + @JsonProperty(value = "id") + private String id; + + /** + * Primary access key. + */ + @JsonProperty(value = "primaryKey") + private String primaryKey; + + /** + * Secondary access key. + */ + @JsonProperty(value = "secondaryKey") + private String secondaryKey; + + /** + * Determines whether direct access is enabled. + */ + @JsonProperty(value = "enabled") + private Boolean enabled; + + /** + * Get identifier. + * + * @return the id value + */ + public String id() { + return this.id; + } + + /** + * Set identifier. + * + * @param id the id value to set + * @return the AccessInformationContractInner object itself. + */ + public AccessInformationContractInner withId(String id) { + this.id = id; + return this; + } + + /** + * Get primary access key. + * + * @return the primaryKey value + */ + public String primaryKey() { + return this.primaryKey; + } + + /** + * Set primary access key. + * + * @param primaryKey the primaryKey value to set + * @return the AccessInformationContractInner object itself. + */ + public AccessInformationContractInner withPrimaryKey(String primaryKey) { + this.primaryKey = primaryKey; + return this; + } + + /** + * Get secondary access key. + * + * @return the secondaryKey value + */ + public String secondaryKey() { + return this.secondaryKey; + } + + /** + * Set secondary access key. + * + * @param secondaryKey the secondaryKey value to set + * @return the AccessInformationContractInner object itself. + */ + public AccessInformationContractInner withSecondaryKey(String secondaryKey) { + this.secondaryKey = secondaryKey; + return this; + } + + /** + * Get determines whether direct access is enabled. + * + * @return the enabled value + */ + public Boolean enabled() { + return this.enabled; + } + + /** + * Set determines whether direct access is enabled. + * + * @param enabled the enabled value to set + * @return the AccessInformationContractInner object itself. + */ + public AccessInformationContractInner withEnabled(Boolean enabled) { + this.enabled = enabled; + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ApiContractImpl.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ApiContractImpl.java new file mode 100644 index 0000000000000..968141ce8f825 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ApiContractImpl.java @@ -0,0 +1,359 @@ +/** + * 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.apimanagement.v2019_01_01.implementation; + +import com.microsoft.azure.management.apimanagement.v2019_01_01.ApiContract; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import com.microsoft.azure.management.apimanagement.v2019_01_01.ApiCreateOrUpdateParameter; +import java.util.List; +import com.microsoft.azure.management.apimanagement.v2019_01_01.ApiType; +import com.microsoft.azure.management.apimanagement.v2019_01_01.ApiVersionSetContractDetails; +import com.microsoft.azure.management.apimanagement.v2019_01_01.AuthenticationSettingsContract; +import com.microsoft.azure.management.apimanagement.v2019_01_01.Protocol; +import com.microsoft.azure.management.apimanagement.v2019_01_01.SubscriptionKeyParameterNamesContract; +import com.microsoft.azure.management.apimanagement.v2019_01_01.ContentFormat; +import com.microsoft.azure.management.apimanagement.v2019_01_01.SoapApiType; +import com.microsoft.azure.management.apimanagement.v2019_01_01.ApiCreateOrUpdatePropertiesWsdlSelector; +import rx.functions.Func1; + +class ApiContractImpl extends CreatableUpdatableImpl implements ApiContract, ApiContract.Definition, ApiContract.Update { + private String resourceGroupName; + private String serviceName; + private String apiId; + private String cifMatch; + private String uifMatch; + private ApiCreateOrUpdateParameter createOrUpdateParameter; + private final ApiManagementManager manager; + + ApiContractImpl(String name, ApiManagementManager manager) { + super(name, new ApiContractInner()); + this.manager = manager; + // Set resource name + this.apiId = name; + // + this.createOrUpdateParameter = new ApiCreateOrUpdateParameter(); + } + + ApiContractImpl(ApiContractInner inner, ApiManagementManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.apiId = inner.name(); + // set resource ancestor and positional variables + this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourceGroups"); + this.serviceName = IdParsingUtils.getValueFromIdByName(inner.id(), "service"); + this.apiId = IdParsingUtils.getValueFromIdByName(inner.id(), "apis"); + // set other parameters for create and update + this.createOrUpdateParameter = new ApiCreateOrUpdateParameter(); + } + + @Override + public ApiManagementManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + ApisInner client = this.manager().inner().apis(); + return client.createOrUpdateAsync(this.resourceGroupName, this.serviceName, this.apiId, this.createOrUpdateParameter, this.cifMatch) + .map(new Func1() { + @Override + public ApiContractInner call(ApiContractInner resource) { + resetCreateUpdateParameters(); + return resource; + } + }) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + ApisInner client = this.manager().inner().apis(); + return client.createOrUpdateAsync(this.resourceGroupName, this.serviceName, this.apiId, this.createOrUpdateParameter, this.uifMatch) + .map(new Func1() { + @Override + public ApiContractInner call(ApiContractInner resource) { + resetCreateUpdateParameters(); + return resource; + } + }) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + ApisInner client = this.manager().inner().apis(); + return null; // NOP getInnerAsync implementation as get is not supported + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + private void resetCreateUpdateParameters() { + this.createOrUpdateParameter = new ApiCreateOrUpdateParameter(); + } + + @Override + public String apiRevision() { + return this.inner().apiRevision(); + } + + @Override + public String apiRevisionDescription() { + return this.inner().apiRevisionDescription(); + } + + @Override + public ApiType apiType() { + return this.inner().apiType(); + } + + @Override + public String apiVersion() { + return this.inner().apiVersion(); + } + + @Override + public String apiVersionDescription() { + return this.inner().apiVersionDescription(); + } + + @Override + public ApiVersionSetContractDetails apiVersionSet() { + return this.inner().apiVersionSet(); + } + + @Override + public String apiVersionSetId() { + return this.inner().apiVersionSetId(); + } + + @Override + public AuthenticationSettingsContract authenticationSettings() { + return this.inner().authenticationSettings(); + } + + @Override + public String description() { + return this.inner().description(); + } + + @Override + public String displayName() { + return this.inner().displayName(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public Boolean isCurrent() { + return this.inner().isCurrent(); + } + + @Override + public Boolean isOnline() { + return this.inner().isOnline(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public String path() { + return this.inner().path(); + } + + @Override + public List protocols() { + return this.inner().protocols(); + } + + @Override + public String serviceUrl() { + return this.inner().serviceUrl(); + } + + @Override + public String sourceApiId() { + return this.inner().sourceApiId(); + } + + @Override + public SubscriptionKeyParameterNamesContract subscriptionKeyParameterNames() { + return this.inner().subscriptionKeyParameterNames(); + } + + @Override + public Boolean subscriptionRequired() { + return this.inner().subscriptionRequired(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public ApiContractImpl withResourceGroupName(String resourceGroupName) { + this.resourceGroupName = resourceGroupName; + return this; + } + + @Override + public ApiContractImpl withServiceName(String serviceName) { + this.serviceName = serviceName; + return this; + } + + @Override + public ApiContractImpl withPath(String path) { + this.createOrUpdateParameter.withPath(path); + return this; + } + + @Override + public ApiContractImpl withIfMatch(String ifMatch) { + if (isInCreateMode()) { + this.cifMatch = ifMatch; + } else { + this.uifMatch = ifMatch; + } + return this; + } + + @Override + public ApiContractImpl withApiRevision(String apiRevision) { + this.createOrUpdateParameter.withApiRevision(apiRevision); + return this; + } + + @Override + public ApiContractImpl withApiRevisionDescription(String apiRevisionDescription) { + this.createOrUpdateParameter.withApiRevisionDescription(apiRevisionDescription); + return this; + } + + @Override + public ApiContractImpl withApiType(ApiType apiType) { + this.createOrUpdateParameter.withApiType(apiType); + return this; + } + + @Override + public ApiContractImpl withApiVersion(String apiVersion) { + this.createOrUpdateParameter.withApiVersion(apiVersion); + return this; + } + + @Override + public ApiContractImpl withApiVersionDescription(String apiVersionDescription) { + this.createOrUpdateParameter.withApiVersionDescription(apiVersionDescription); + return this; + } + + @Override + public ApiContractImpl withApiVersionSet(ApiVersionSetContractDetails apiVersionSet) { + this.createOrUpdateParameter.withApiVersionSet(apiVersionSet); + return this; + } + + @Override + public ApiContractImpl withApiVersionSetId(String apiVersionSetId) { + this.createOrUpdateParameter.withApiVersionSetId(apiVersionSetId); + return this; + } + + @Override + public ApiContractImpl withAuthenticationSettings(AuthenticationSettingsContract authenticationSettings) { + this.createOrUpdateParameter.withAuthenticationSettings(authenticationSettings); + return this; + } + + @Override + public ApiContractImpl withDescription(String description) { + this.createOrUpdateParameter.withDescription(description); + return this; + } + + @Override + public ApiContractImpl withDisplayName(String displayName) { + this.createOrUpdateParameter.withDisplayName(displayName); + return this; + } + + @Override + public ApiContractImpl withFormat(ContentFormat format) { + this.createOrUpdateParameter.withFormat(format); + return this; + } + + @Override + public ApiContractImpl withIsCurrent(Boolean isCurrent) { + this.createOrUpdateParameter.withIsCurrent(isCurrent); + return this; + } + + @Override + public ApiContractImpl withProtocols(List protocols) { + this.createOrUpdateParameter.withProtocols(protocols); + return this; + } + + @Override + public ApiContractImpl withServiceUrl(String serviceUrl) { + this.createOrUpdateParameter.withServiceUrl(serviceUrl); + return this; + } + + @Override + public ApiContractImpl withSoapApiType(SoapApiType soapApiType) { + this.createOrUpdateParameter.withSoapApiType(soapApiType); + return this; + } + + @Override + public ApiContractImpl withSourceApiId(String sourceApiId) { + this.createOrUpdateParameter.withSourceApiId(sourceApiId); + return this; + } + + @Override + public ApiContractImpl withSubscriptionKeyParameterNames(SubscriptionKeyParameterNamesContract subscriptionKeyParameterNames) { + this.createOrUpdateParameter.withSubscriptionKeyParameterNames(subscriptionKeyParameterNames); + return this; + } + + @Override + public ApiContractImpl withSubscriptionRequired(Boolean subscriptionRequired) { + this.createOrUpdateParameter.withSubscriptionRequired(subscriptionRequired); + return this; + } + + @Override + public ApiContractImpl withValue(String value) { + this.createOrUpdateParameter.withValue(value); + return this; + } + + @Override + public ApiContractImpl withWsdlSelector(ApiCreateOrUpdatePropertiesWsdlSelector wsdlSelector) { + this.createOrUpdateParameter.withWsdlSelector(wsdlSelector); + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ApiContractInner.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ApiContractInner.java new file mode 100644 index 0000000000000..42a9705ee245b --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ApiContractInner.java @@ -0,0 +1,489 @@ +/** + * 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.apimanagement.v2019_01_01.implementation; + +import com.microsoft.azure.management.apimanagement.v2019_01_01.AuthenticationSettingsContract; +import com.microsoft.azure.management.apimanagement.v2019_01_01.SubscriptionKeyParameterNamesContract; +import com.microsoft.azure.management.apimanagement.v2019_01_01.ApiType; +import java.util.List; +import com.microsoft.azure.management.apimanagement.v2019_01_01.Protocol; +import com.microsoft.azure.management.apimanagement.v2019_01_01.ApiVersionSetContractDetails; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * Api details. + */ +@JsonFlatten +public class ApiContractInner extends ProxyResource { + /** + * Description of the API. May include HTML formatting tags. + */ + @JsonProperty(value = "properties.description") + private String description; + + /** + * Collection of authentication settings included into this API. + */ + @JsonProperty(value = "properties.authenticationSettings") + private AuthenticationSettingsContract authenticationSettings; + + /** + * Protocols over which API is made available. + */ + @JsonProperty(value = "properties.subscriptionKeyParameterNames") + private SubscriptionKeyParameterNamesContract subscriptionKeyParameterNames; + + /** + * Type of API. Possible values include: 'http', 'soap'. + */ + @JsonProperty(value = "properties.type") + private ApiType apiType; + + /** + * Describes the Revision of the Api. If no value is provided, default + * revision 1 is created. + */ + @JsonProperty(value = "properties.apiRevision") + private String apiRevision; + + /** + * Indicates the Version identifier of the API if the API is versioned. + */ + @JsonProperty(value = "properties.apiVersion") + private String apiVersion; + + /** + * Indicates if API revision is current api revision. + */ + @JsonProperty(value = "properties.isCurrent") + private Boolean isCurrent; + + /** + * Indicates if API revision is accessible via the gateway. + */ + @JsonProperty(value = "properties.isOnline", access = JsonProperty.Access.WRITE_ONLY) + private Boolean isOnline; + + /** + * Description of the Api Revision. + */ + @JsonProperty(value = "properties.apiRevisionDescription") + private String apiRevisionDescription; + + /** + * Description of the Api Version. + */ + @JsonProperty(value = "properties.apiVersionDescription") + private String apiVersionDescription; + + /** + * A resource identifier for the related ApiVersionSet. + */ + @JsonProperty(value = "properties.apiVersionSetId") + private String apiVersionSetId; + + /** + * Specifies whether an API or Product subscription is required for + * accessing the API. + */ + @JsonProperty(value = "properties.subscriptionRequired") + private Boolean subscriptionRequired; + + /** + * API identifier of the source API. + */ + @JsonProperty(value = "properties.sourceApiId") + private String sourceApiId; + + /** + * API name. Must be 1 to 300 characters long. + */ + @JsonProperty(value = "properties.displayName") + private String displayName; + + /** + * Absolute URL of the backend service implementing this API. Cannot be + * more than 2000 characters long. + */ + @JsonProperty(value = "properties.serviceUrl") + private String serviceUrl; + + /** + * Relative URL uniquely identifying this API and all of its resource paths + * within the API Management service instance. It is appended to the API + * endpoint base URL specified during the service instance creation to form + * a public URL for this API. + */ + @JsonProperty(value = "properties.path", required = true) + private String path; + + /** + * Describes on which protocols the operations in this API can be invoked. + */ + @JsonProperty(value = "properties.protocols") + private List protocols; + + /** + * Version set details. + */ + @JsonProperty(value = "properties.apiVersionSet") + private ApiVersionSetContractDetails apiVersionSet; + + /** + * Get description of the API. May include HTML formatting tags. + * + * @return the description value + */ + public String description() { + return this.description; + } + + /** + * Set description of the API. May include HTML formatting tags. + * + * @param description the description value to set + * @return the ApiContractInner object itself. + */ + public ApiContractInner withDescription(String description) { + this.description = description; + return this; + } + + /** + * Get collection of authentication settings included into this API. + * + * @return the authenticationSettings value + */ + public AuthenticationSettingsContract authenticationSettings() { + return this.authenticationSettings; + } + + /** + * Set collection of authentication settings included into this API. + * + * @param authenticationSettings the authenticationSettings value to set + * @return the ApiContractInner object itself. + */ + public ApiContractInner withAuthenticationSettings(AuthenticationSettingsContract authenticationSettings) { + this.authenticationSettings = authenticationSettings; + return this; + } + + /** + * Get protocols over which API is made available. + * + * @return the subscriptionKeyParameterNames value + */ + public SubscriptionKeyParameterNamesContract subscriptionKeyParameterNames() { + return this.subscriptionKeyParameterNames; + } + + /** + * Set protocols over which API is made available. + * + * @param subscriptionKeyParameterNames the subscriptionKeyParameterNames value to set + * @return the ApiContractInner object itself. + */ + public ApiContractInner withSubscriptionKeyParameterNames(SubscriptionKeyParameterNamesContract subscriptionKeyParameterNames) { + this.subscriptionKeyParameterNames = subscriptionKeyParameterNames; + return this; + } + + /** + * Get type of API. Possible values include: 'http', 'soap'. + * + * @return the apiType value + */ + public ApiType apiType() { + return this.apiType; + } + + /** + * Set type of API. Possible values include: 'http', 'soap'. + * + * @param apiType the apiType value to set + * @return the ApiContractInner object itself. + */ + public ApiContractInner withApiType(ApiType apiType) { + this.apiType = apiType; + return this; + } + + /** + * Get describes the Revision of the Api. If no value is provided, default revision 1 is created. + * + * @return the apiRevision value + */ + public String apiRevision() { + return this.apiRevision; + } + + /** + * Set describes the Revision of the Api. If no value is provided, default revision 1 is created. + * + * @param apiRevision the apiRevision value to set + * @return the ApiContractInner object itself. + */ + public ApiContractInner withApiRevision(String apiRevision) { + this.apiRevision = apiRevision; + return this; + } + + /** + * Get indicates the Version identifier of the API if the API is versioned. + * + * @return the apiVersion value + */ + public String apiVersion() { + return this.apiVersion; + } + + /** + * Set indicates the Version identifier of the API if the API is versioned. + * + * @param apiVersion the apiVersion value to set + * @return the ApiContractInner object itself. + */ + public ApiContractInner withApiVersion(String apiVersion) { + this.apiVersion = apiVersion; + return this; + } + + /** + * Get indicates if API revision is current api revision. + * + * @return the isCurrent value + */ + public Boolean isCurrent() { + return this.isCurrent; + } + + /** + * Set indicates if API revision is current api revision. + * + * @param isCurrent the isCurrent value to set + * @return the ApiContractInner object itself. + */ + public ApiContractInner withIsCurrent(Boolean isCurrent) { + this.isCurrent = isCurrent; + return this; + } + + /** + * Get indicates if API revision is accessible via the gateway. + * + * @return the isOnline value + */ + public Boolean isOnline() { + return this.isOnline; + } + + /** + * Get description of the Api Revision. + * + * @return the apiRevisionDescription value + */ + public String apiRevisionDescription() { + return this.apiRevisionDescription; + } + + /** + * Set description of the Api Revision. + * + * @param apiRevisionDescription the apiRevisionDescription value to set + * @return the ApiContractInner object itself. + */ + public ApiContractInner withApiRevisionDescription(String apiRevisionDescription) { + this.apiRevisionDescription = apiRevisionDescription; + return this; + } + + /** + * Get description of the Api Version. + * + * @return the apiVersionDescription value + */ + public String apiVersionDescription() { + return this.apiVersionDescription; + } + + /** + * Set description of the Api Version. + * + * @param apiVersionDescription the apiVersionDescription value to set + * @return the ApiContractInner object itself. + */ + public ApiContractInner withApiVersionDescription(String apiVersionDescription) { + this.apiVersionDescription = apiVersionDescription; + return this; + } + + /** + * Get a resource identifier for the related ApiVersionSet. + * + * @return the apiVersionSetId value + */ + public String apiVersionSetId() { + return this.apiVersionSetId; + } + + /** + * Set a resource identifier for the related ApiVersionSet. + * + * @param apiVersionSetId the apiVersionSetId value to set + * @return the ApiContractInner object itself. + */ + public ApiContractInner withApiVersionSetId(String apiVersionSetId) { + this.apiVersionSetId = apiVersionSetId; + return this; + } + + /** + * Get specifies whether an API or Product subscription is required for accessing the API. + * + * @return the subscriptionRequired value + */ + public Boolean subscriptionRequired() { + return this.subscriptionRequired; + } + + /** + * Set specifies whether an API or Product subscription is required for accessing the API. + * + * @param subscriptionRequired the subscriptionRequired value to set + * @return the ApiContractInner object itself. + */ + public ApiContractInner withSubscriptionRequired(Boolean subscriptionRequired) { + this.subscriptionRequired = subscriptionRequired; + return this; + } + + /** + * Get aPI identifier of the source API. + * + * @return the sourceApiId value + */ + public String sourceApiId() { + return this.sourceApiId; + } + + /** + * Set aPI identifier of the source API. + * + * @param sourceApiId the sourceApiId value to set + * @return the ApiContractInner object itself. + */ + public ApiContractInner withSourceApiId(String sourceApiId) { + this.sourceApiId = sourceApiId; + return this; + } + + /** + * Get aPI name. Must be 1 to 300 characters long. + * + * @return the displayName value + */ + public String displayName() { + return this.displayName; + } + + /** + * Set aPI name. Must be 1 to 300 characters long. + * + * @param displayName the displayName value to set + * @return the ApiContractInner object itself. + */ + public ApiContractInner withDisplayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Get absolute URL of the backend service implementing this API. Cannot be more than 2000 characters long. + * + * @return the serviceUrl value + */ + public String serviceUrl() { + return this.serviceUrl; + } + + /** + * Set absolute URL of the backend service implementing this API. Cannot be more than 2000 characters long. + * + * @param serviceUrl the serviceUrl value to set + * @return the ApiContractInner object itself. + */ + public ApiContractInner withServiceUrl(String serviceUrl) { + this.serviceUrl = serviceUrl; + return this; + } + + /** + * Get relative URL uniquely identifying this API and all of its resource paths within the API Management service instance. It is appended to the API endpoint base URL specified during the service instance creation to form a public URL for this API. + * + * @return the path value + */ + public String path() { + return this.path; + } + + /** + * Set relative URL uniquely identifying this API and all of its resource paths within the API Management service instance. It is appended to the API endpoint base URL specified during the service instance creation to form a public URL for this API. + * + * @param path the path value to set + * @return the ApiContractInner object itself. + */ + public ApiContractInner withPath(String path) { + this.path = path; + return this; + } + + /** + * Get describes on which protocols the operations in this API can be invoked. + * + * @return the protocols value + */ + public List protocols() { + return this.protocols; + } + + /** + * Set describes on which protocols the operations in this API can be invoked. + * + * @param protocols the protocols value to set + * @return the ApiContractInner object itself. + */ + public ApiContractInner withProtocols(List protocols) { + this.protocols = protocols; + return this; + } + + /** + * Get version set details. + * + * @return the apiVersionSet value + */ + public ApiVersionSetContractDetails apiVersionSet() { + return this.apiVersionSet; + } + + /** + * Set version set details. + * + * @param apiVersionSet the apiVersionSet value to set + * @return the ApiContractInner object itself. + */ + public ApiContractInner withApiVersionSet(ApiVersionSetContractDetails apiVersionSet) { + this.apiVersionSet = apiVersionSet; + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ApiDiagnosticContractImpl.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ApiDiagnosticContractImpl.java new file mode 100644 index 0000000000000..fad342adf386e --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ApiDiagnosticContractImpl.java @@ -0,0 +1,178 @@ +/** + * 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.apimanagement.v2019_01_01.implementation; + +import com.microsoft.azure.management.apimanagement.v2019_01_01.ApiDiagnosticContract; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import com.microsoft.azure.management.apimanagement.v2019_01_01.AlwaysLog; +import com.microsoft.azure.management.apimanagement.v2019_01_01.SamplingSettings; +import com.microsoft.azure.management.apimanagement.v2019_01_01.PipelineDiagnosticSettings; + +class ApiDiagnosticContractImpl extends CreatableUpdatableImpl implements ApiDiagnosticContract, ApiDiagnosticContract.Definition, ApiDiagnosticContract.Update { + private final ApiManagementManager manager; + private String resourceGroupName; + private String serviceName; + private String apiId; + private String diagnosticId; + private String cifMatch; + private String uifMatch; + + ApiDiagnosticContractImpl(String name, ApiManagementManager manager) { + super(name, new DiagnosticContractInner()); + this.manager = manager; + // Set resource name + this.diagnosticId = name; + // + } + + ApiDiagnosticContractImpl(DiagnosticContractInner inner, ApiManagementManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.diagnosticId = inner.name(); + // set resource ancestor and positional variables + this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourceGroups"); + this.serviceName = IdParsingUtils.getValueFromIdByName(inner.id(), "service"); + this.apiId = IdParsingUtils.getValueFromIdByName(inner.id(), "apis"); + this.diagnosticId = IdParsingUtils.getValueFromIdByName(inner.id(), "diagnostics"); + // + } + + @Override + public ApiManagementManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + ApiDiagnosticsInner client = this.manager().inner().apiDiagnostics(); + return client.createOrUpdateAsync(this.resourceGroupName, this.serviceName, this.apiId, this.diagnosticId, this.inner(), this.cifMatch) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + ApiDiagnosticsInner client = this.manager().inner().apiDiagnostics(); + return client.createOrUpdateAsync(this.resourceGroupName, this.serviceName, this.apiId, this.diagnosticId, this.inner(), this.uifMatch) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + ApiDiagnosticsInner client = this.manager().inner().apiDiagnostics(); + return client.getAsync(this.resourceGroupName, this.serviceName, this.apiId, this.diagnosticId); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + + @Override + public AlwaysLog alwaysLog() { + return this.inner().alwaysLog(); + } + + @Override + public PipelineDiagnosticSettings backend() { + return this.inner().backend(); + } + + @Override + public Boolean enableHttpCorrelationHeaders() { + return this.inner().enableHttpCorrelationHeaders(); + } + + @Override + public PipelineDiagnosticSettings frontend() { + return this.inner().frontend(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String loggerId() { + return this.inner().loggerId(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public SamplingSettings sampling() { + return this.inner().sampling(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public ApiDiagnosticContractImpl withExistingApi(String resourceGroupName, String serviceName, String apiId) { + this.resourceGroupName = resourceGroupName; + this.serviceName = serviceName; + this.apiId = apiId; + return this; + } + + @Override + public ApiDiagnosticContractImpl withLoggerId(String loggerId) { + this.inner().withLoggerId(loggerId); + return this; + } + + @Override + public ApiDiagnosticContractImpl withIfMatch(String ifMatch) { + if (isInCreateMode()) { + this.cifMatch = ifMatch; + } else { + this.uifMatch = ifMatch; + } + return this; + } + + @Override + public ApiDiagnosticContractImpl withAlwaysLog(AlwaysLog alwaysLog) { + this.inner().withAlwaysLog(alwaysLog); + return this; + } + + @Override + public ApiDiagnosticContractImpl withBackend(PipelineDiagnosticSettings backend) { + this.inner().withBackend(backend); + return this; + } + + @Override + public ApiDiagnosticContractImpl withEnableHttpCorrelationHeaders(Boolean enableHttpCorrelationHeaders) { + this.inner().withEnableHttpCorrelationHeaders(enableHttpCorrelationHeaders); + return this; + } + + @Override + public ApiDiagnosticContractImpl withFrontend(PipelineDiagnosticSettings frontend) { + this.inner().withFrontend(frontend); + return this; + } + + @Override + public ApiDiagnosticContractImpl withSampling(SamplingSettings sampling) { + this.inner().withSampling(sampling); + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ApiDiagnosticsImpl.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ApiDiagnosticsImpl.java new file mode 100644 index 0000000000000..ae6104dd75844 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ApiDiagnosticsImpl.java @@ -0,0 +1,87 @@ +/** + * 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.apimanagement.v2019_01_01.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.apimanagement.v2019_01_01.ApiDiagnostics; +import rx.Completable; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.apimanagement.v2019_01_01.ApiDiagnosticContract; + +class ApiDiagnosticsImpl extends WrapperImpl implements ApiDiagnostics { + private final ApiManagementManager manager; + + ApiDiagnosticsImpl(ApiManagementManager manager) { + super(manager.inner().apiDiagnostics()); + this.manager = manager; + } + + public ApiManagementManager manager() { + return this.manager; + } + + @Override + public ApiDiagnosticContractImpl define(String name) { + return wrapModel(name); + } + + private ApiDiagnosticContractImpl wrapModel(DiagnosticContractInner inner) { + return new ApiDiagnosticContractImpl(inner, manager()); + } + + private ApiDiagnosticContractImpl wrapModel(String name) { + return new ApiDiagnosticContractImpl(name, this.manager()); + } + + @Override + public Completable getEntityTagAsync(String resourceGroupName, String serviceName, String apiId, String diagnosticId) { + ApiDiagnosticsInner client = this.inner(); + return client.getEntityTagAsync(resourceGroupName, serviceName, apiId, diagnosticId).toCompletable(); + } + + @Override + public Observable listByServiceAsync(final String resourceGroupName, final String serviceName, final String apiId) { + ApiDiagnosticsInner client = this.inner(); + return client.listByServiceAsync(resourceGroupName, serviceName, apiId) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public ApiDiagnosticContract call(DiagnosticContractInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Observable getAsync(String resourceGroupName, String serviceName, String apiId, String diagnosticId) { + ApiDiagnosticsInner client = this.inner(); + return client.getAsync(resourceGroupName, serviceName, apiId, diagnosticId) + .map(new Func1() { + @Override + public ApiDiagnosticContract call(DiagnosticContractInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Completable deleteAsync(String resourceGroupName, String serviceName, String apiId, String diagnosticId, String ifMatch) { + ApiDiagnosticsInner client = this.inner(); + return client.deleteAsync(resourceGroupName, serviceName, apiId, diagnosticId, ifMatch).toCompletable(); + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ApiDiagnosticsInner.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ApiDiagnosticsInner.java new file mode 100644 index 0000000000000..2757cd9075900 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ApiDiagnosticsInner.java @@ -0,0 +1,1119 @@ +/** + * 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.apimanagement.v2019_01_01.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.apimanagement.v2019_01_01.ApiDiagnosticCreateOrUpdateHeaders; +import com.microsoft.azure.management.apimanagement.v2019_01_01.ApiDiagnosticGetEntityTagHeaders; +import com.microsoft.azure.management.apimanagement.v2019_01_01.ApiDiagnosticGetHeaders; +import com.microsoft.azure.management.apimanagement.v2019_01_01.ErrorResponseException; +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.ServiceResponseWithHeaders; +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.HEAD; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.HTTP; +import retrofit2.http.PATCH; +import retrofit2.http.Path; +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 ApiDiagnostics. + */ +public class ApiDiagnosticsInner { + /** The Retrofit service to perform REST calls. */ + private ApiDiagnosticsService service; + /** The service client containing this operation class. */ + private ApiManagementClientImpl client; + + /** + * Initializes an instance of ApiDiagnosticsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public ApiDiagnosticsInner(Retrofit retrofit, ApiManagementClientImpl client) { + this.service = retrofit.create(ApiDiagnosticsService.class); + this.client = client; + } + + /** + * The interface defining all the services for ApiDiagnostics to be + * used by Retrofit to perform actually REST calls. + */ + interface ApiDiagnosticsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.apimanagement.v2019_01_01.ApiDiagnostics listByService" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/diagnostics") + Observable> listByService(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("apiId") String apiId, @Path("subscriptionId") String subscriptionId, @Query("$filter") String filter, @Query("$top") Integer top, @Query("$skip") Integer skip, @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.apimanagement.v2019_01_01.ApiDiagnostics getEntityTag" }) + @HEAD("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/diagnostics/{diagnosticId}") + Observable> getEntityTag(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("apiId") String apiId, @Path("diagnosticId") String diagnosticId, @Path("subscriptionId") String subscriptionId, @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.apimanagement.v2019_01_01.ApiDiagnostics get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/diagnostics/{diagnosticId}") + Observable> get(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("apiId") String apiId, @Path("diagnosticId") String diagnosticId, @Path("subscriptionId") String subscriptionId, @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.apimanagement.v2019_01_01.ApiDiagnostics createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/diagnostics/{diagnosticId}") + Observable> createOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("apiId") String apiId, @Path("diagnosticId") String diagnosticId, @Path("subscriptionId") String subscriptionId, @Body DiagnosticContractInner parameters, @Header("If-Match") String ifMatch, @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.apimanagement.v2019_01_01.ApiDiagnostics update" }) + @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/diagnostics/{diagnosticId}") + Observable> update(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("apiId") String apiId, @Path("diagnosticId") String diagnosticId, @Path("subscriptionId") String subscriptionId, @Body DiagnosticContractInner parameters, @Header("If-Match") String ifMatch, @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.apimanagement.v2019_01_01.ApiDiagnostics delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/diagnostics/{diagnosticId}", method = "DELETE", hasBody = true) + Observable> delete(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("apiId") String apiId, @Path("diagnosticId") String diagnosticId, @Path("subscriptionId") String subscriptionId, @Header("If-Match") String ifMatch, @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.apimanagement.v2019_01_01.ApiDiagnostics listByServiceNext" }) + @GET + Observable> listByServiceNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Lists all diagnostics of an API. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API identifier. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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<DiagnosticContractInner> object if successful. + */ + public PagedList listByService(final String resourceGroupName, final String serviceName, final String apiId) { + ServiceResponse> response = listByServiceSinglePageAsync(resourceGroupName, serviceName, apiId).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByServiceNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists all diagnostics of an API. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API identifier. Must be unique in the current API Management service instance. + * @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> listByServiceAsync(final String resourceGroupName, final String serviceName, final String apiId, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByServiceSinglePageAsync(resourceGroupName, serviceName, apiId), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByServiceNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists all diagnostics of an API. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API identifier. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<DiagnosticContractInner> object + */ + public Observable> listByServiceAsync(final String resourceGroupName, final String serviceName, final String apiId) { + return listByServiceWithServiceResponseAsync(resourceGroupName, serviceName, apiId) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all diagnostics of an API. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API identifier. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<DiagnosticContractInner> object + */ + public Observable>> listByServiceWithServiceResponseAsync(final String resourceGroupName, final String serviceName, final String apiId) { + return listByServiceSinglePageAsync(resourceGroupName, serviceName, apiId) + .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(listByServiceNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists all diagnostics of an API. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API identifier. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<DiagnosticContractInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByServiceSinglePageAsync(final String resourceGroupName, final String serviceName, final String apiId) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (apiId == null) { + throw new IllegalArgumentException("Parameter apiId is required and cannot be null."); + } + 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 filter = null; + final Integer top = null; + final Integer skip = null; + return service.listByService(resourceGroupName, serviceName, apiId, this.client.subscriptionId(), filter, top, skip, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByServiceDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Lists all diagnostics of an API. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API identifier. Must be unique in the current API Management service instance. + * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br> + * @param top Number of records to return. + * @param skip Number of records to skip. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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<DiagnosticContractInner> object if successful. + */ + public PagedList listByService(final String resourceGroupName, final String serviceName, final String apiId, final String filter, final Integer top, final Integer skip) { + ServiceResponse> response = listByServiceSinglePageAsync(resourceGroupName, serviceName, apiId, filter, top, skip).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByServiceNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists all diagnostics of an API. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API identifier. Must be unique in the current API Management service instance. + * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br> + * @param top Number of records to return. + * @param skip Number of records to skip. + * @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> listByServiceAsync(final String resourceGroupName, final String serviceName, final String apiId, final String filter, final Integer top, final Integer skip, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByServiceSinglePageAsync(resourceGroupName, serviceName, apiId, filter, top, skip), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByServiceNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists all diagnostics of an API. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API identifier. Must be unique in the current API Management service instance. + * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br> + * @param top Number of records to return. + * @param skip Number of records to skip. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<DiagnosticContractInner> object + */ + public Observable> listByServiceAsync(final String resourceGroupName, final String serviceName, final String apiId, final String filter, final Integer top, final Integer skip) { + return listByServiceWithServiceResponseAsync(resourceGroupName, serviceName, apiId, filter, top, skip) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all diagnostics of an API. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API identifier. Must be unique in the current API Management service instance. + * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br> + * @param top Number of records to return. + * @param skip Number of records to skip. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<DiagnosticContractInner> object + */ + public Observable>> listByServiceWithServiceResponseAsync(final String resourceGroupName, final String serviceName, final String apiId, final String filter, final Integer top, final Integer skip) { + return listByServiceSinglePageAsync(resourceGroupName, serviceName, apiId, filter, top, skip) + .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(listByServiceNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists all diagnostics of an API. + * + ServiceResponse> * @param resourceGroupName The name of the resource group. + ServiceResponse> * @param serviceName The name of the API Management service. + ServiceResponse> * @param apiId API identifier. Must be unique in the current API Management service instance. + ServiceResponse> * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br> + ServiceResponse> * @param top Number of records to return. + ServiceResponse> * @param skip Number of records to skip. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<DiagnosticContractInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByServiceSinglePageAsync(final String resourceGroupName, final String serviceName, final String apiId, final String filter, final Integer top, final Integer skip) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (apiId == null) { + throw new IllegalArgumentException("Parameter apiId is required and cannot be null."); + } + 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.listByService(resourceGroupName, serviceName, apiId, this.client.subscriptionId(), filter, top, skip, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByServiceDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByServiceDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Gets the entity state (Etag) version of the Diagnostic for an API specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API identifier. Must be unique in the current API Management service instance. + * @param diagnosticId Diagnostic identifier. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void getEntityTag(String resourceGroupName, String serviceName, String apiId, String diagnosticId) { + getEntityTagWithServiceResponseAsync(resourceGroupName, serviceName, apiId, diagnosticId).toBlocking().single().body(); + } + + /** + * Gets the entity state (Etag) version of the Diagnostic for an API specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API identifier. Must be unique in the current API Management service instance. + * @param diagnosticId Diagnostic identifier. Must be unique in the current API Management service instance. + * @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 getEntityTagAsync(String resourceGroupName, String serviceName, String apiId, String diagnosticId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(getEntityTagWithServiceResponseAsync(resourceGroupName, serviceName, apiId, diagnosticId), serviceCallback); + } + + /** + * Gets the entity state (Etag) version of the Diagnostic for an API specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API identifier. Must be unique in the current API Management service instance. + * @param diagnosticId Diagnostic identifier. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public Observable getEntityTagAsync(String resourceGroupName, String serviceName, String apiId, String diagnosticId) { + return getEntityTagWithServiceResponseAsync(resourceGroupName, serviceName, apiId, diagnosticId).map(new Func1, Void>() { + @Override + public Void call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Gets the entity state (Etag) version of the Diagnostic for an API specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API identifier. Must be unique in the current API Management service instance. + * @param diagnosticId Diagnostic identifier. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public Observable> getEntityTagWithServiceResponseAsync(String resourceGroupName, String serviceName, String apiId, String diagnosticId) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (apiId == null) { + throw new IllegalArgumentException("Parameter apiId is required and cannot be null."); + } + if (diagnosticId == null) { + throw new IllegalArgumentException("Parameter diagnosticId is required and cannot be null."); + } + 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.getEntityTag(resourceGroupName, serviceName, apiId, diagnosticId, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = getEntityTagDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponseWithHeaders getEntityTagDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .buildEmptyWithHeaders(response, ApiDiagnosticGetEntityTagHeaders.class); + } + + /** + * Gets the details of the Diagnostic for an API specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API identifier. Must be unique in the current API Management service instance. + * @param diagnosticId Diagnostic identifier. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the DiagnosticContractInner object if successful. + */ + public DiagnosticContractInner get(String resourceGroupName, String serviceName, String apiId, String diagnosticId) { + return getWithServiceResponseAsync(resourceGroupName, serviceName, apiId, diagnosticId).toBlocking().single().body(); + } + + /** + * Gets the details of the Diagnostic for an API specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API identifier. Must be unique in the current API Management service instance. + * @param diagnosticId Diagnostic identifier. Must be unique in the current API Management service instance. + * @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 getAsync(String resourceGroupName, String serviceName, String apiId, String diagnosticId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(getWithServiceResponseAsync(resourceGroupName, serviceName, apiId, diagnosticId), serviceCallback); + } + + /** + * Gets the details of the Diagnostic for an API specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API identifier. Must be unique in the current API Management service instance. + * @param diagnosticId Diagnostic identifier. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DiagnosticContractInner object + */ + public Observable getAsync(String resourceGroupName, String serviceName, String apiId, String diagnosticId) { + return getWithServiceResponseAsync(resourceGroupName, serviceName, apiId, diagnosticId).map(new Func1, DiagnosticContractInner>() { + @Override + public DiagnosticContractInner call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Gets the details of the Diagnostic for an API specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API identifier. Must be unique in the current API Management service instance. + * @param diagnosticId Diagnostic identifier. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DiagnosticContractInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String serviceName, String apiId, String diagnosticId) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (apiId == null) { + throw new IllegalArgumentException("Parameter apiId is required and cannot be null."); + } + if (diagnosticId == null) { + throw new IllegalArgumentException("Parameter diagnosticId is required and cannot be null."); + } + 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.get(resourceGroupName, serviceName, apiId, diagnosticId, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = getDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponseWithHeaders getDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .buildWithHeaders(response, ApiDiagnosticGetHeaders.class); + } + + /** + * Creates a new Diagnostic for an API or updates an existing one. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API identifier. Must be unique in the current API Management service instance. + * @param diagnosticId Diagnostic identifier. Must be unique in the current API Management service instance. + * @param parameters Create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the DiagnosticContractInner object if successful. + */ + public DiagnosticContractInner createOrUpdate(String resourceGroupName, String serviceName, String apiId, String diagnosticId, DiagnosticContractInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serviceName, apiId, diagnosticId, parameters).toBlocking().single().body(); + } + + /** + * Creates a new Diagnostic for an API or updates an existing one. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API identifier. Must be unique in the current API Management service instance. + * @param diagnosticId Diagnostic identifier. Must be unique in the current API Management service instance. + * @param parameters Create parameters. + * @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 createOrUpdateAsync(String resourceGroupName, String serviceName, String apiId, String diagnosticId, DiagnosticContractInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, serviceName, apiId, diagnosticId, parameters), serviceCallback); + } + + /** + * Creates a new Diagnostic for an API or updates an existing one. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API identifier. Must be unique in the current API Management service instance. + * @param diagnosticId Diagnostic identifier. Must be unique in the current API Management service instance. + * @param parameters Create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DiagnosticContractInner object + */ + public Observable createOrUpdateAsync(String resourceGroupName, String serviceName, String apiId, String diagnosticId, DiagnosticContractInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serviceName, apiId, diagnosticId, parameters).map(new Func1, DiagnosticContractInner>() { + @Override + public DiagnosticContractInner call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Creates a new Diagnostic for an API or updates an existing one. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API identifier. Must be unique in the current API Management service instance. + * @param diagnosticId Diagnostic identifier. Must be unique in the current API Management service instance. + * @param parameters Create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DiagnosticContractInner object + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String serviceName, String apiId, String diagnosticId, DiagnosticContractInner parameters) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (apiId == null) { + throw new IllegalArgumentException("Parameter apiId is required and cannot be null."); + } + if (diagnosticId == null) { + throw new IllegalArgumentException("Parameter diagnosticId is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(parameters); + final String ifMatch = null; + return service.createOrUpdate(resourceGroupName, serviceName, apiId, diagnosticId, this.client.subscriptionId(), parameters, ifMatch, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = createOrUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Creates a new Diagnostic for an API or updates an existing one. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API identifier. Must be unique in the current API Management service instance. + * @param diagnosticId Diagnostic identifier. Must be unique in the current API Management service instance. + * @param parameters Create parameters. + * @param ifMatch ETag of the Entity. Not required when creating an entity, but required when updating an entity. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the DiagnosticContractInner object if successful. + */ + public DiagnosticContractInner createOrUpdate(String resourceGroupName, String serviceName, String apiId, String diagnosticId, DiagnosticContractInner parameters, String ifMatch) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serviceName, apiId, diagnosticId, parameters, ifMatch).toBlocking().single().body(); + } + + /** + * Creates a new Diagnostic for an API or updates an existing one. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API identifier. Must be unique in the current API Management service instance. + * @param diagnosticId Diagnostic identifier. Must be unique in the current API Management service instance. + * @param parameters Create parameters. + * @param ifMatch ETag of the Entity. Not required when creating an entity, but required when updating an entity. + * @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 createOrUpdateAsync(String resourceGroupName, String serviceName, String apiId, String diagnosticId, DiagnosticContractInner parameters, String ifMatch, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, serviceName, apiId, diagnosticId, parameters, ifMatch), serviceCallback); + } + + /** + * Creates a new Diagnostic for an API or updates an existing one. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API identifier. Must be unique in the current API Management service instance. + * @param diagnosticId Diagnostic identifier. Must be unique in the current API Management service instance. + * @param parameters Create parameters. + * @param ifMatch ETag of the Entity. Not required when creating an entity, but required when updating an entity. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DiagnosticContractInner object + */ + public Observable createOrUpdateAsync(String resourceGroupName, String serviceName, String apiId, String diagnosticId, DiagnosticContractInner parameters, String ifMatch) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serviceName, apiId, diagnosticId, parameters, ifMatch).map(new Func1, DiagnosticContractInner>() { + @Override + public DiagnosticContractInner call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Creates a new Diagnostic for an API or updates an existing one. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API identifier. Must be unique in the current API Management service instance. + * @param diagnosticId Diagnostic identifier. Must be unique in the current API Management service instance. + * @param parameters Create parameters. + * @param ifMatch ETag of the Entity. Not required when creating an entity, but required when updating an entity. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DiagnosticContractInner object + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String serviceName, String apiId, String diagnosticId, DiagnosticContractInner parameters, String ifMatch) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (apiId == null) { + throw new IllegalArgumentException("Parameter apiId is required and cannot be null."); + } + if (diagnosticId == null) { + throw new IllegalArgumentException("Parameter diagnosticId is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(parameters); + return service.createOrUpdate(resourceGroupName, serviceName, apiId, diagnosticId, this.client.subscriptionId(), parameters, ifMatch, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = createOrUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponseWithHeaders createOrUpdateDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(201, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .buildWithHeaders(response, ApiDiagnosticCreateOrUpdateHeaders.class); + } + + /** + * Updates the details of the Diagnostic for an API specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API identifier. Must be unique in the current API Management service instance. + * @param diagnosticId Diagnostic identifier. Must be unique in the current API Management service instance. + * @param parameters Diagnostic Update parameters. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void update(String resourceGroupName, String serviceName, String apiId, String diagnosticId, DiagnosticContractInner parameters, String ifMatch) { + updateWithServiceResponseAsync(resourceGroupName, serviceName, apiId, diagnosticId, parameters, ifMatch).toBlocking().single().body(); + } + + /** + * Updates the details of the Diagnostic for an API specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API identifier. Must be unique in the current API Management service instance. + * @param diagnosticId Diagnostic identifier. Must be unique in the current API Management service instance. + * @param parameters Diagnostic Update parameters. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @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 serviceName, String apiId, String diagnosticId, DiagnosticContractInner parameters, String ifMatch, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateWithServiceResponseAsync(resourceGroupName, serviceName, apiId, diagnosticId, parameters, ifMatch), serviceCallback); + } + + /** + * Updates the details of the Diagnostic for an API specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API identifier. Must be unique in the current API Management service instance. + * @param diagnosticId Diagnostic identifier. Must be unique in the current API Management service instance. + * @param parameters Diagnostic Update parameters. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable updateAsync(String resourceGroupName, String serviceName, String apiId, String diagnosticId, DiagnosticContractInner parameters, String ifMatch) { + return updateWithServiceResponseAsync(resourceGroupName, serviceName, apiId, diagnosticId, parameters, ifMatch).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates the details of the Diagnostic for an API specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API identifier. Must be unique in the current API Management service instance. + * @param diagnosticId Diagnostic identifier. Must be unique in the current API Management service instance. + * @param parameters Diagnostic Update parameters. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> updateWithServiceResponseAsync(String resourceGroupName, String serviceName, String apiId, String diagnosticId, DiagnosticContractInner parameters, String ifMatch) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (apiId == null) { + throw new IllegalArgumentException("Parameter apiId is required and cannot be null."); + } + if (diagnosticId == null) { + throw new IllegalArgumentException("Parameter diagnosticId is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + if (ifMatch == null) { + throw new IllegalArgumentException("Parameter ifMatch is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(parameters); + return service.update(resourceGroupName, serviceName, apiId, diagnosticId, this.client.subscriptionId(), parameters, ifMatch, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = updateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse updateDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(204, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Deletes the specified Diagnostic from an API. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API identifier. Must be unique in the current API Management service instance. + * @param diagnosticId Diagnostic identifier. Must be unique in the current API Management service instance. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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 serviceName, String apiId, String diagnosticId, String ifMatch) { + deleteWithServiceResponseAsync(resourceGroupName, serviceName, apiId, diagnosticId, ifMatch).toBlocking().single().body(); + } + + /** + * Deletes the specified Diagnostic from an API. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API identifier. Must be unique in the current API Management service instance. + * @param diagnosticId Diagnostic identifier. Must be unique in the current API Management service instance. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @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 serviceName, String apiId, String diagnosticId, String ifMatch, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, serviceName, apiId, diagnosticId, ifMatch), serviceCallback); + } + + /** + * Deletes the specified Diagnostic from an API. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API identifier. Must be unique in the current API Management service instance. + * @param diagnosticId Diagnostic identifier. Must be unique in the current API Management service instance. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable deleteAsync(String resourceGroupName, String serviceName, String apiId, String diagnosticId, String ifMatch) { + return deleteWithServiceResponseAsync(resourceGroupName, serviceName, apiId, diagnosticId, ifMatch).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes the specified Diagnostic from an API. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API identifier. Must be unique in the current API Management service instance. + * @param diagnosticId Diagnostic identifier. Must be unique in the current API Management service instance. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> deleteWithServiceResponseAsync(String resourceGroupName, String serviceName, String apiId, String diagnosticId, String ifMatch) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (apiId == null) { + throw new IllegalArgumentException("Parameter apiId is required and cannot be null."); + } + if (diagnosticId == null) { + throw new IllegalArgumentException("Parameter diagnosticId is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (ifMatch == null) { + throw new IllegalArgumentException("Parameter ifMatch 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.delete(resourceGroupName, serviceName, apiId, diagnosticId, this.client.subscriptionId(), ifMatch, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = deleteDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse deleteDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(204, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists all diagnostics of an API. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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<DiagnosticContractInner> object if successful. + */ + public PagedList listByServiceNext(final String nextPageLink) { + ServiceResponse> response = listByServiceNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByServiceNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists all diagnostics of an API. + * + * @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> listByServiceNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByServiceNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByServiceNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists all diagnostics of an API. + * + * @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<DiagnosticContractInner> object + */ + public Observable> listByServiceNextAsync(final String nextPageLink) { + return listByServiceNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all diagnostics of an API. + * + * @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<DiagnosticContractInner> object + */ + public Observable>> listByServiceNextWithServiceResponseAsync(final String nextPageLink) { + return listByServiceNextSinglePageAsync(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(listByServiceNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists all diagnostics of an API. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<DiagnosticContractInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByServiceNextSinglePageAsync(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.listByServiceNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByServiceNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByServiceNextDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ApiExportResultImpl.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ApiExportResultImpl.java new file mode 100644 index 0000000000000..bae656da312eb --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ApiExportResultImpl.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.apimanagement.v2019_01_01.implementation; + +import com.microsoft.azure.management.apimanagement.v2019_01_01.ApiExportResult; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.apimanagement.v2019_01_01.ExportResultFormat; +import com.microsoft.azure.management.apimanagement.v2019_01_01.ApiExportResultValue; + +class ApiExportResultImpl extends WrapperImpl implements ApiExportResult { + private final ApiManagementManager manager; + ApiExportResultImpl(ApiExportResultInner inner, ApiManagementManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public ApiManagementManager manager() { + return this.manager; + } + + @Override + public ExportResultFormat exportResultFormat() { + return this.inner().exportResultFormat(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public ApiExportResultValue value() { + return this.inner().value(); + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ApiExportResultInner.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ApiExportResultInner.java new file mode 100644 index 0000000000000..9ce74c07ea231 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ApiExportResultInner.java @@ -0,0 +1,99 @@ +/** + * 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.apimanagement.v2019_01_01.implementation; + +import com.microsoft.azure.management.apimanagement.v2019_01_01.ExportResultFormat; +import com.microsoft.azure.management.apimanagement.v2019_01_01.ApiExportResultValue; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * API Export result. + */ +public class ApiExportResultInner { + /** + * ResourceId of the API which was exported. + */ + @JsonProperty(value = "id") + private String id; + + /** + * Format in which the Api Details are exported to the Storage Blob with + * Sas Key valid for 5 minutes. Possible values include: 'Swagger', 'Wsdl', + * 'Wadl', 'OpenApi'. + */ + @JsonProperty(value = "format") + private ExportResultFormat exportResultFormat; + + /** + * The object defining the schema of the exported Api Detail. + */ + @JsonProperty(value = "value") + private ApiExportResultValue value; + + /** + * Get resourceId of the API which was exported. + * + * @return the id value + */ + public String id() { + return this.id; + } + + /** + * Set resourceId of the API which was exported. + * + * @param id the id value to set + * @return the ApiExportResultInner object itself. + */ + public ApiExportResultInner withId(String id) { + this.id = id; + return this; + } + + /** + * Get format in which the Api Details are exported to the Storage Blob with Sas Key valid for 5 minutes. Possible values include: 'Swagger', 'Wsdl', 'Wadl', 'OpenApi'. + * + * @return the exportResultFormat value + */ + public ExportResultFormat exportResultFormat() { + return this.exportResultFormat; + } + + /** + * Set format in which the Api Details are exported to the Storage Blob with Sas Key valid for 5 minutes. Possible values include: 'Swagger', 'Wsdl', 'Wadl', 'OpenApi'. + * + * @param exportResultFormat the exportResultFormat value to set + * @return the ApiExportResultInner object itself. + */ + public ApiExportResultInner withExportResultFormat(ExportResultFormat exportResultFormat) { + this.exportResultFormat = exportResultFormat; + return this; + } + + /** + * Get the object defining the schema of the exported Api Detail. + * + * @return the value value + */ + public ApiExportResultValue value() { + return this.value; + } + + /** + * Set the object defining the schema of the exported Api Detail. + * + * @param value the value value to set + * @return the ApiExportResultInner object itself. + */ + public ApiExportResultInner withValue(ApiExportResultValue value) { + this.value = value; + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ApiExportsImpl.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ApiExportsImpl.java new file mode 100644 index 0000000000000..866a59d4534da --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ApiExportsImpl.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. + * abc + */ + +package com.microsoft.azure.management.apimanagement.v2019_01_01.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.apimanagement.v2019_01_01.ApiExports; +import rx.functions.Func1; +import rx.Observable; +import com.microsoft.azure.management.apimanagement.v2019_01_01.ApiExportResult; +import com.microsoft.azure.management.apimanagement.v2019_01_01.ExportFormat; + +class ApiExportsImpl extends WrapperImpl implements ApiExports { + private final ApiManagementManager manager; + + ApiExportsImpl(ApiManagementManager manager) { + super(manager.inner().apiExports()); + this.manager = manager; + } + + public ApiManagementManager manager() { + return this.manager; + } + + @Override + public Observable getAsync(String resourceGroupName, String serviceName, String apiId, ExportFormat format) { + ApiExportsInner client = this.inner(); + return client.getAsync(resourceGroupName, serviceName, apiId, format) + .map(new Func1() { + @Override + public ApiExportResult call(ApiExportResultInner inner) { + return new ApiExportResultImpl(inner, manager()); + } + }); + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ApiExportsInner.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ApiExportsInner.java new file mode 100644 index 0000000000000..8833cb3e0a793 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ApiExportsInner.java @@ -0,0 +1,162 @@ +/** + * 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.apimanagement.v2019_01_01.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.management.apimanagement.v2019_01_01.ErrorResponseException; +import com.microsoft.azure.management.apimanagement.v2019_01_01.ExportFormat; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import java.io.IOException; +import okhttp3.ResponseBody; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Path; +import retrofit2.http.Query; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in ApiExports. + */ +public class ApiExportsInner { + /** The Retrofit service to perform REST calls. */ + private ApiExportsService service; + /** The service client containing this operation class. */ + private ApiManagementClientImpl client; + + /** + * Initializes an instance of ApiExportsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public ApiExportsInner(Retrofit retrofit, ApiManagementClientImpl client) { + this.service = retrofit.create(ApiExportsService.class); + this.client = client; + } + + /** + * The interface defining all the services for ApiExports to be + * used by Retrofit to perform actually REST calls. + */ + interface ApiExportsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.apimanagement.v2019_01_01.ApiExports get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}") + Observable> get(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("apiId") String apiId, @Path("subscriptionId") String subscriptionId, @Query("format") ExportFormat format, @Query("export") String export, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Gets the details of the API specified by its identifier in the format specified to the Storage Blob with SAS Key valid for 5 minutes. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @param format Format in which to export the Api Details to the Storage Blob with Sas Key valid for 5 minutes. Possible values include: 'Swagger', 'Wsdl', 'Wadl', 'Openapi' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ApiExportResultInner object if successful. + */ + public ApiExportResultInner get(String resourceGroupName, String serviceName, String apiId, ExportFormat format) { + return getWithServiceResponseAsync(resourceGroupName, serviceName, apiId, format).toBlocking().single().body(); + } + + /** + * Gets the details of the API specified by its identifier in the format specified to the Storage Blob with SAS Key valid for 5 minutes. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @param format Format in which to export the Api Details to the Storage Blob with Sas Key valid for 5 minutes. Possible values include: 'Swagger', 'Wsdl', 'Wadl', 'Openapi' + * @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 getAsync(String resourceGroupName, String serviceName, String apiId, ExportFormat format, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroupName, serviceName, apiId, format), serviceCallback); + } + + /** + * Gets the details of the API specified by its identifier in the format specified to the Storage Blob with SAS Key valid for 5 minutes. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @param format Format in which to export the Api Details to the Storage Blob with Sas Key valid for 5 minutes. Possible values include: 'Swagger', 'Wsdl', 'Wadl', 'Openapi' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ApiExportResultInner object + */ + public Observable getAsync(String resourceGroupName, String serviceName, String apiId, ExportFormat format) { + return getWithServiceResponseAsync(resourceGroupName, serviceName, apiId, format).map(new Func1, ApiExportResultInner>() { + @Override + public ApiExportResultInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets the details of the API specified by its identifier in the format specified to the Storage Blob with SAS Key valid for 5 minutes. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @param format Format in which to export the Api Details to the Storage Blob with Sas Key valid for 5 minutes. Possible values include: 'Swagger', 'Wsdl', 'Wadl', 'Openapi' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ApiExportResultInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String serviceName, String apiId, ExportFormat format) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (apiId == null) { + throw new IllegalArgumentException("Parameter apiId is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (format == null) { + throw new IllegalArgumentException("Parameter format 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 export = "true"; + return service.get(resourceGroupName, serviceName, apiId, this.client.subscriptionId(), format, export, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ApiIssueAttachmentsImpl.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ApiIssueAttachmentsImpl.java new file mode 100644 index 0000000000000..18da8471469c3 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ApiIssueAttachmentsImpl.java @@ -0,0 +1,87 @@ +/** + * 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.apimanagement.v2019_01_01.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.apimanagement.v2019_01_01.ApiIssueAttachments; +import rx.Completable; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.apimanagement.v2019_01_01.IssueAttachmentContract; + +class ApiIssueAttachmentsImpl extends WrapperImpl implements ApiIssueAttachments { + private final ApiManagementManager manager; + + ApiIssueAttachmentsImpl(ApiManagementManager manager) { + super(manager.inner().apiIssueAttachments()); + this.manager = manager; + } + + public ApiManagementManager manager() { + return this.manager; + } + + @Override + public IssueAttachmentContractImpl define(String name) { + return wrapModel(name); + } + + private IssueAttachmentContractImpl wrapModel(IssueAttachmentContractInner inner) { + return new IssueAttachmentContractImpl(inner, manager()); + } + + private IssueAttachmentContractImpl wrapModel(String name) { + return new IssueAttachmentContractImpl(name, this.manager()); + } + + @Override + public Completable getEntityTagAsync(String resourceGroupName, String serviceName, String apiId, String issueId, String attachmentId) { + ApiIssueAttachmentsInner client = this.inner(); + return client.getEntityTagAsync(resourceGroupName, serviceName, apiId, issueId, attachmentId).toCompletable(); + } + + @Override + public Observable listByServiceAsync(final String resourceGroupName, final String serviceName, final String apiId, final String issueId) { + ApiIssueAttachmentsInner client = this.inner(); + return client.listByServiceAsync(resourceGroupName, serviceName, apiId, issueId) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public IssueAttachmentContract call(IssueAttachmentContractInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Observable getAsync(String resourceGroupName, String serviceName, String apiId, String issueId, String attachmentId) { + ApiIssueAttachmentsInner client = this.inner(); + return client.getAsync(resourceGroupName, serviceName, apiId, issueId, attachmentId) + .map(new Func1() { + @Override + public IssueAttachmentContract call(IssueAttachmentContractInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Completable deleteAsync(String resourceGroupName, String serviceName, String apiId, String issueId, String attachmentId, String ifMatch) { + ApiIssueAttachmentsInner client = this.inner(); + return client.deleteAsync(resourceGroupName, serviceName, apiId, issueId, attachmentId, ifMatch).toCompletable(); + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ApiIssueAttachmentsInner.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ApiIssueAttachmentsInner.java new file mode 100644 index 0000000000000..fa96ca192fd1b --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ApiIssueAttachmentsInner.java @@ -0,0 +1,1051 @@ +/** + * 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.apimanagement.v2019_01_01.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.apimanagement.v2019_01_01.ApiIssueAttachmentCreateOrUpdateHeaders; +import com.microsoft.azure.management.apimanagement.v2019_01_01.ApiIssueAttachmentGetEntityTagHeaders; +import com.microsoft.azure.management.apimanagement.v2019_01_01.ApiIssueAttachmentGetHeaders; +import com.microsoft.azure.management.apimanagement.v2019_01_01.ErrorResponseException; +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.ServiceResponseWithHeaders; +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.HEAD; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.HTTP; +import retrofit2.http.Path; +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 ApiIssueAttachments. + */ +public class ApiIssueAttachmentsInner { + /** The Retrofit service to perform REST calls. */ + private ApiIssueAttachmentsService service; + /** The service client containing this operation class. */ + private ApiManagementClientImpl client; + + /** + * Initializes an instance of ApiIssueAttachmentsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public ApiIssueAttachmentsInner(Retrofit retrofit, ApiManagementClientImpl client) { + this.service = retrofit.create(ApiIssueAttachmentsService.class); + this.client = client; + } + + /** + * The interface defining all the services for ApiIssueAttachments to be + * used by Retrofit to perform actually REST calls. + */ + interface ApiIssueAttachmentsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.apimanagement.v2019_01_01.ApiIssueAttachments listByService" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/issues/{issueId}/attachments") + Observable> listByService(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("apiId") String apiId, @Path("issueId") String issueId, @Path("subscriptionId") String subscriptionId, @Query("$filter") String filter, @Query("$top") Integer top, @Query("$skip") Integer skip, @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.apimanagement.v2019_01_01.ApiIssueAttachments getEntityTag" }) + @HEAD("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/issues/{issueId}/attachments/{attachmentId}") + Observable> getEntityTag(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("apiId") String apiId, @Path("issueId") String issueId, @Path("attachmentId") String attachmentId, @Path("subscriptionId") String subscriptionId, @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.apimanagement.v2019_01_01.ApiIssueAttachments get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/issues/{issueId}/attachments/{attachmentId}") + Observable> get(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("apiId") String apiId, @Path("issueId") String issueId, @Path("attachmentId") String attachmentId, @Path("subscriptionId") String subscriptionId, @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.apimanagement.v2019_01_01.ApiIssueAttachments createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/issues/{issueId}/attachments/{attachmentId}") + Observable> createOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("apiId") String apiId, @Path("issueId") String issueId, @Path("attachmentId") String attachmentId, @Path("subscriptionId") String subscriptionId, @Body IssueAttachmentContractInner parameters, @Header("If-Match") String ifMatch, @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.apimanagement.v2019_01_01.ApiIssueAttachments delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/issues/{issueId}/attachments/{attachmentId}", method = "DELETE", hasBody = true) + Observable> delete(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("apiId") String apiId, @Path("issueId") String issueId, @Path("attachmentId") String attachmentId, @Path("subscriptionId") String subscriptionId, @Header("If-Match") String ifMatch, @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.apimanagement.v2019_01_01.ApiIssueAttachments listByServiceNext" }) + @GET + Observable> listByServiceNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Lists all attachments for the Issue associated with the specified API. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API identifier. Must be unique in the current API Management service instance. + * @param issueId Issue identifier. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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<IssueAttachmentContractInner> object if successful. + */ + public PagedList listByService(final String resourceGroupName, final String serviceName, final String apiId, final String issueId) { + ServiceResponse> response = listByServiceSinglePageAsync(resourceGroupName, serviceName, apiId, issueId).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByServiceNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists all attachments for the Issue associated with the specified API. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API identifier. Must be unique in the current API Management service instance. + * @param issueId Issue identifier. Must be unique in the current API Management service instance. + * @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> listByServiceAsync(final String resourceGroupName, final String serviceName, final String apiId, final String issueId, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByServiceSinglePageAsync(resourceGroupName, serviceName, apiId, issueId), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByServiceNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists all attachments for the Issue associated with the specified API. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API identifier. Must be unique in the current API Management service instance. + * @param issueId Issue identifier. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<IssueAttachmentContractInner> object + */ + public Observable> listByServiceAsync(final String resourceGroupName, final String serviceName, final String apiId, final String issueId) { + return listByServiceWithServiceResponseAsync(resourceGroupName, serviceName, apiId, issueId) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all attachments for the Issue associated with the specified API. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API identifier. Must be unique in the current API Management service instance. + * @param issueId Issue identifier. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<IssueAttachmentContractInner> object + */ + public Observable>> listByServiceWithServiceResponseAsync(final String resourceGroupName, final String serviceName, final String apiId, final String issueId) { + return listByServiceSinglePageAsync(resourceGroupName, serviceName, apiId, issueId) + .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(listByServiceNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists all attachments for the Issue associated with the specified API. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API identifier. Must be unique in the current API Management service instance. + * @param issueId Issue identifier. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<IssueAttachmentContractInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByServiceSinglePageAsync(final String resourceGroupName, final String serviceName, final String apiId, final String issueId) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (apiId == null) { + throw new IllegalArgumentException("Parameter apiId is required and cannot be null."); + } + if (issueId == null) { + throw new IllegalArgumentException("Parameter issueId is required and cannot be null."); + } + 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 filter = null; + final Integer top = null; + final Integer skip = null; + return service.listByService(resourceGroupName, serviceName, apiId, issueId, this.client.subscriptionId(), filter, top, skip, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByServiceDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Lists all attachments for the Issue associated with the specified API. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API identifier. Must be unique in the current API Management service instance. + * @param issueId Issue identifier. Must be unique in the current API Management service instance. + * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| userId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br> + * @param top Number of records to return. + * @param skip Number of records to skip. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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<IssueAttachmentContractInner> object if successful. + */ + public PagedList listByService(final String resourceGroupName, final String serviceName, final String apiId, final String issueId, final String filter, final Integer top, final Integer skip) { + ServiceResponse> response = listByServiceSinglePageAsync(resourceGroupName, serviceName, apiId, issueId, filter, top, skip).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByServiceNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists all attachments for the Issue associated with the specified API. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API identifier. Must be unique in the current API Management service instance. + * @param issueId Issue identifier. Must be unique in the current API Management service instance. + * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| userId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br> + * @param top Number of records to return. + * @param skip Number of records to skip. + * @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> listByServiceAsync(final String resourceGroupName, final String serviceName, final String apiId, final String issueId, final String filter, final Integer top, final Integer skip, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByServiceSinglePageAsync(resourceGroupName, serviceName, apiId, issueId, filter, top, skip), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByServiceNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists all attachments for the Issue associated with the specified API. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API identifier. Must be unique in the current API Management service instance. + * @param issueId Issue identifier. Must be unique in the current API Management service instance. + * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| userId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br> + * @param top Number of records to return. + * @param skip Number of records to skip. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<IssueAttachmentContractInner> object + */ + public Observable> listByServiceAsync(final String resourceGroupName, final String serviceName, final String apiId, final String issueId, final String filter, final Integer top, final Integer skip) { + return listByServiceWithServiceResponseAsync(resourceGroupName, serviceName, apiId, issueId, filter, top, skip) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all attachments for the Issue associated with the specified API. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API identifier. Must be unique in the current API Management service instance. + * @param issueId Issue identifier. Must be unique in the current API Management service instance. + * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| userId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br> + * @param top Number of records to return. + * @param skip Number of records to skip. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<IssueAttachmentContractInner> object + */ + public Observable>> listByServiceWithServiceResponseAsync(final String resourceGroupName, final String serviceName, final String apiId, final String issueId, final String filter, final Integer top, final Integer skip) { + return listByServiceSinglePageAsync(resourceGroupName, serviceName, apiId, issueId, filter, top, skip) + .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(listByServiceNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists all attachments for the Issue associated with the specified API. + * + ServiceResponse> * @param resourceGroupName The name of the resource group. + ServiceResponse> * @param serviceName The name of the API Management service. + ServiceResponse> * @param apiId API identifier. Must be unique in the current API Management service instance. + ServiceResponse> * @param issueId Issue identifier. Must be unique in the current API Management service instance. + ServiceResponse> * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| userId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br> + ServiceResponse> * @param top Number of records to return. + ServiceResponse> * @param skip Number of records to skip. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<IssueAttachmentContractInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByServiceSinglePageAsync(final String resourceGroupName, final String serviceName, final String apiId, final String issueId, final String filter, final Integer top, final Integer skip) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (apiId == null) { + throw new IllegalArgumentException("Parameter apiId is required and cannot be null."); + } + if (issueId == null) { + throw new IllegalArgumentException("Parameter issueId is required and cannot be null."); + } + 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.listByService(resourceGroupName, serviceName, apiId, issueId, this.client.subscriptionId(), filter, top, skip, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByServiceDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByServiceDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Gets the entity state (Etag) version of the issue Attachment for an API specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API identifier. Must be unique in the current API Management service instance. + * @param issueId Issue identifier. Must be unique in the current API Management service instance. + * @param attachmentId Attachment identifier within an Issue. Must be unique in the current Issue. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void getEntityTag(String resourceGroupName, String serviceName, String apiId, String issueId, String attachmentId) { + getEntityTagWithServiceResponseAsync(resourceGroupName, serviceName, apiId, issueId, attachmentId).toBlocking().single().body(); + } + + /** + * Gets the entity state (Etag) version of the issue Attachment for an API specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API identifier. Must be unique in the current API Management service instance. + * @param issueId Issue identifier. Must be unique in the current API Management service instance. + * @param attachmentId Attachment identifier within an Issue. Must be unique in the current Issue. + * @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 getEntityTagAsync(String resourceGroupName, String serviceName, String apiId, String issueId, String attachmentId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(getEntityTagWithServiceResponseAsync(resourceGroupName, serviceName, apiId, issueId, attachmentId), serviceCallback); + } + + /** + * Gets the entity state (Etag) version of the issue Attachment for an API specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API identifier. Must be unique in the current API Management service instance. + * @param issueId Issue identifier. Must be unique in the current API Management service instance. + * @param attachmentId Attachment identifier within an Issue. Must be unique in the current Issue. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public Observable getEntityTagAsync(String resourceGroupName, String serviceName, String apiId, String issueId, String attachmentId) { + return getEntityTagWithServiceResponseAsync(resourceGroupName, serviceName, apiId, issueId, attachmentId).map(new Func1, Void>() { + @Override + public Void call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Gets the entity state (Etag) version of the issue Attachment for an API specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API identifier. Must be unique in the current API Management service instance. + * @param issueId Issue identifier. Must be unique in the current API Management service instance. + * @param attachmentId Attachment identifier within an Issue. Must be unique in the current Issue. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public Observable> getEntityTagWithServiceResponseAsync(String resourceGroupName, String serviceName, String apiId, String issueId, String attachmentId) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (apiId == null) { + throw new IllegalArgumentException("Parameter apiId is required and cannot be null."); + } + if (issueId == null) { + throw new IllegalArgumentException("Parameter issueId is required and cannot be null."); + } + if (attachmentId == null) { + throw new IllegalArgumentException("Parameter attachmentId is required and cannot be null."); + } + 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.getEntityTag(resourceGroupName, serviceName, apiId, issueId, attachmentId, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = getEntityTagDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponseWithHeaders getEntityTagDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .buildEmptyWithHeaders(response, ApiIssueAttachmentGetEntityTagHeaders.class); + } + + /** + * Gets the details of the issue Attachment for an API specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API identifier. Must be unique in the current API Management service instance. + * @param issueId Issue identifier. Must be unique in the current API Management service instance. + * @param attachmentId Attachment identifier within an Issue. Must be unique in the current Issue. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the IssueAttachmentContractInner object if successful. + */ + public IssueAttachmentContractInner get(String resourceGroupName, String serviceName, String apiId, String issueId, String attachmentId) { + return getWithServiceResponseAsync(resourceGroupName, serviceName, apiId, issueId, attachmentId).toBlocking().single().body(); + } + + /** + * Gets the details of the issue Attachment for an API specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API identifier. Must be unique in the current API Management service instance. + * @param issueId Issue identifier. Must be unique in the current API Management service instance. + * @param attachmentId Attachment identifier within an Issue. Must be unique in the current Issue. + * @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 getAsync(String resourceGroupName, String serviceName, String apiId, String issueId, String attachmentId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(getWithServiceResponseAsync(resourceGroupName, serviceName, apiId, issueId, attachmentId), serviceCallback); + } + + /** + * Gets the details of the issue Attachment for an API specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API identifier. Must be unique in the current API Management service instance. + * @param issueId Issue identifier. Must be unique in the current API Management service instance. + * @param attachmentId Attachment identifier within an Issue. Must be unique in the current Issue. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the IssueAttachmentContractInner object + */ + public Observable getAsync(String resourceGroupName, String serviceName, String apiId, String issueId, String attachmentId) { + return getWithServiceResponseAsync(resourceGroupName, serviceName, apiId, issueId, attachmentId).map(new Func1, IssueAttachmentContractInner>() { + @Override + public IssueAttachmentContractInner call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Gets the details of the issue Attachment for an API specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API identifier. Must be unique in the current API Management service instance. + * @param issueId Issue identifier. Must be unique in the current API Management service instance. + * @param attachmentId Attachment identifier within an Issue. Must be unique in the current Issue. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the IssueAttachmentContractInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String serviceName, String apiId, String issueId, String attachmentId) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (apiId == null) { + throw new IllegalArgumentException("Parameter apiId is required and cannot be null."); + } + if (issueId == null) { + throw new IllegalArgumentException("Parameter issueId is required and cannot be null."); + } + if (attachmentId == null) { + throw new IllegalArgumentException("Parameter attachmentId is required and cannot be null."); + } + 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.get(resourceGroupName, serviceName, apiId, issueId, attachmentId, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = getDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponseWithHeaders getDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .buildWithHeaders(response, ApiIssueAttachmentGetHeaders.class); + } + + /** + * Creates a new Attachment for the Issue in an API or updates an existing one. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API identifier. Must be unique in the current API Management service instance. + * @param issueId Issue identifier. Must be unique in the current API Management service instance. + * @param attachmentId Attachment identifier within an Issue. Must be unique in the current Issue. + * @param parameters Create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the IssueAttachmentContractInner object if successful. + */ + public IssueAttachmentContractInner createOrUpdate(String resourceGroupName, String serviceName, String apiId, String issueId, String attachmentId, IssueAttachmentContractInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serviceName, apiId, issueId, attachmentId, parameters).toBlocking().single().body(); + } + + /** + * Creates a new Attachment for the Issue in an API or updates an existing one. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API identifier. Must be unique in the current API Management service instance. + * @param issueId Issue identifier. Must be unique in the current API Management service instance. + * @param attachmentId Attachment identifier within an Issue. Must be unique in the current Issue. + * @param parameters Create parameters. + * @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 createOrUpdateAsync(String resourceGroupName, String serviceName, String apiId, String issueId, String attachmentId, IssueAttachmentContractInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, serviceName, apiId, issueId, attachmentId, parameters), serviceCallback); + } + + /** + * Creates a new Attachment for the Issue in an API or updates an existing one. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API identifier. Must be unique in the current API Management service instance. + * @param issueId Issue identifier. Must be unique in the current API Management service instance. + * @param attachmentId Attachment identifier within an Issue. Must be unique in the current Issue. + * @param parameters Create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the IssueAttachmentContractInner object + */ + public Observable createOrUpdateAsync(String resourceGroupName, String serviceName, String apiId, String issueId, String attachmentId, IssueAttachmentContractInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serviceName, apiId, issueId, attachmentId, parameters).map(new Func1, IssueAttachmentContractInner>() { + @Override + public IssueAttachmentContractInner call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Creates a new Attachment for the Issue in an API or updates an existing one. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API identifier. Must be unique in the current API Management service instance. + * @param issueId Issue identifier. Must be unique in the current API Management service instance. + * @param attachmentId Attachment identifier within an Issue. Must be unique in the current Issue. + * @param parameters Create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the IssueAttachmentContractInner object + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String serviceName, String apiId, String issueId, String attachmentId, IssueAttachmentContractInner parameters) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (apiId == null) { + throw new IllegalArgumentException("Parameter apiId is required and cannot be null."); + } + if (issueId == null) { + throw new IllegalArgumentException("Parameter issueId is required and cannot be null."); + } + if (attachmentId == null) { + throw new IllegalArgumentException("Parameter attachmentId is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(parameters); + final String ifMatch = null; + return service.createOrUpdate(resourceGroupName, serviceName, apiId, issueId, attachmentId, this.client.subscriptionId(), parameters, ifMatch, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = createOrUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Creates a new Attachment for the Issue in an API or updates an existing one. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API identifier. Must be unique in the current API Management service instance. + * @param issueId Issue identifier. Must be unique in the current API Management service instance. + * @param attachmentId Attachment identifier within an Issue. Must be unique in the current Issue. + * @param parameters Create parameters. + * @param ifMatch ETag of the Entity. Not required when creating an entity, but required when updating an entity. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the IssueAttachmentContractInner object if successful. + */ + public IssueAttachmentContractInner createOrUpdate(String resourceGroupName, String serviceName, String apiId, String issueId, String attachmentId, IssueAttachmentContractInner parameters, String ifMatch) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serviceName, apiId, issueId, attachmentId, parameters, ifMatch).toBlocking().single().body(); + } + + /** + * Creates a new Attachment for the Issue in an API or updates an existing one. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API identifier. Must be unique in the current API Management service instance. + * @param issueId Issue identifier. Must be unique in the current API Management service instance. + * @param attachmentId Attachment identifier within an Issue. Must be unique in the current Issue. + * @param parameters Create parameters. + * @param ifMatch ETag of the Entity. Not required when creating an entity, but required when updating an entity. + * @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 createOrUpdateAsync(String resourceGroupName, String serviceName, String apiId, String issueId, String attachmentId, IssueAttachmentContractInner parameters, String ifMatch, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, serviceName, apiId, issueId, attachmentId, parameters, ifMatch), serviceCallback); + } + + /** + * Creates a new Attachment for the Issue in an API or updates an existing one. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API identifier. Must be unique in the current API Management service instance. + * @param issueId Issue identifier. Must be unique in the current API Management service instance. + * @param attachmentId Attachment identifier within an Issue. Must be unique in the current Issue. + * @param parameters Create parameters. + * @param ifMatch ETag of the Entity. Not required when creating an entity, but required when updating an entity. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the IssueAttachmentContractInner object + */ + public Observable createOrUpdateAsync(String resourceGroupName, String serviceName, String apiId, String issueId, String attachmentId, IssueAttachmentContractInner parameters, String ifMatch) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serviceName, apiId, issueId, attachmentId, parameters, ifMatch).map(new Func1, IssueAttachmentContractInner>() { + @Override + public IssueAttachmentContractInner call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Creates a new Attachment for the Issue in an API or updates an existing one. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API identifier. Must be unique in the current API Management service instance. + * @param issueId Issue identifier. Must be unique in the current API Management service instance. + * @param attachmentId Attachment identifier within an Issue. Must be unique in the current Issue. + * @param parameters Create parameters. + * @param ifMatch ETag of the Entity. Not required when creating an entity, but required when updating an entity. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the IssueAttachmentContractInner object + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String serviceName, String apiId, String issueId, String attachmentId, IssueAttachmentContractInner parameters, String ifMatch) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (apiId == null) { + throw new IllegalArgumentException("Parameter apiId is required and cannot be null."); + } + if (issueId == null) { + throw new IllegalArgumentException("Parameter issueId is required and cannot be null."); + } + if (attachmentId == null) { + throw new IllegalArgumentException("Parameter attachmentId is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(parameters); + return service.createOrUpdate(resourceGroupName, serviceName, apiId, issueId, attachmentId, this.client.subscriptionId(), parameters, ifMatch, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = createOrUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponseWithHeaders createOrUpdateDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(201, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .buildWithHeaders(response, ApiIssueAttachmentCreateOrUpdateHeaders.class); + } + + /** + * Deletes the specified comment from an Issue. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API identifier. Must be unique in the current API Management service instance. + * @param issueId Issue identifier. Must be unique in the current API Management service instance. + * @param attachmentId Attachment identifier within an Issue. Must be unique in the current Issue. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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 serviceName, String apiId, String issueId, String attachmentId, String ifMatch) { + deleteWithServiceResponseAsync(resourceGroupName, serviceName, apiId, issueId, attachmentId, ifMatch).toBlocking().single().body(); + } + + /** + * Deletes the specified comment from an Issue. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API identifier. Must be unique in the current API Management service instance. + * @param issueId Issue identifier. Must be unique in the current API Management service instance. + * @param attachmentId Attachment identifier within an Issue. Must be unique in the current Issue. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @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 serviceName, String apiId, String issueId, String attachmentId, String ifMatch, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, serviceName, apiId, issueId, attachmentId, ifMatch), serviceCallback); + } + + /** + * Deletes the specified comment from an Issue. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API identifier. Must be unique in the current API Management service instance. + * @param issueId Issue identifier. Must be unique in the current API Management service instance. + * @param attachmentId Attachment identifier within an Issue. Must be unique in the current Issue. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable deleteAsync(String resourceGroupName, String serviceName, String apiId, String issueId, String attachmentId, String ifMatch) { + return deleteWithServiceResponseAsync(resourceGroupName, serviceName, apiId, issueId, attachmentId, ifMatch).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes the specified comment from an Issue. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API identifier. Must be unique in the current API Management service instance. + * @param issueId Issue identifier. Must be unique in the current API Management service instance. + * @param attachmentId Attachment identifier within an Issue. Must be unique in the current Issue. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> deleteWithServiceResponseAsync(String resourceGroupName, String serviceName, String apiId, String issueId, String attachmentId, String ifMatch) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (apiId == null) { + throw new IllegalArgumentException("Parameter apiId is required and cannot be null."); + } + if (issueId == null) { + throw new IllegalArgumentException("Parameter issueId is required and cannot be null."); + } + if (attachmentId == null) { + throw new IllegalArgumentException("Parameter attachmentId is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (ifMatch == null) { + throw new IllegalArgumentException("Parameter ifMatch 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.delete(resourceGroupName, serviceName, apiId, issueId, attachmentId, this.client.subscriptionId(), ifMatch, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = deleteDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse deleteDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(204, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists all attachments for the Issue associated with the specified API. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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<IssueAttachmentContractInner> object if successful. + */ + public PagedList listByServiceNext(final String nextPageLink) { + ServiceResponse> response = listByServiceNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByServiceNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists all attachments for the Issue associated with the specified API. + * + * @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> listByServiceNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByServiceNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByServiceNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists all attachments for the Issue associated with the specified API. + * + * @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<IssueAttachmentContractInner> object + */ + public Observable> listByServiceNextAsync(final String nextPageLink) { + return listByServiceNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all attachments for the Issue associated with the specified API. + * + * @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<IssueAttachmentContractInner> object + */ + public Observable>> listByServiceNextWithServiceResponseAsync(final String nextPageLink) { + return listByServiceNextSinglePageAsync(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(listByServiceNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists all attachments for the Issue associated with the specified API. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<IssueAttachmentContractInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByServiceNextSinglePageAsync(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.listByServiceNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByServiceNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByServiceNextDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ApiIssueCommentsImpl.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ApiIssueCommentsImpl.java new file mode 100644 index 0000000000000..cdb74dd319731 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ApiIssueCommentsImpl.java @@ -0,0 +1,87 @@ +/** + * 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.apimanagement.v2019_01_01.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.apimanagement.v2019_01_01.ApiIssueComments; +import rx.Completable; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.apimanagement.v2019_01_01.IssueCommentContract; + +class ApiIssueCommentsImpl extends WrapperImpl implements ApiIssueComments { + private final ApiManagementManager manager; + + ApiIssueCommentsImpl(ApiManagementManager manager) { + super(manager.inner().apiIssueComments()); + this.manager = manager; + } + + public ApiManagementManager manager() { + return this.manager; + } + + @Override + public IssueCommentContractImpl define(String name) { + return wrapModel(name); + } + + private IssueCommentContractImpl wrapModel(IssueCommentContractInner inner) { + return new IssueCommentContractImpl(inner, manager()); + } + + private IssueCommentContractImpl wrapModel(String name) { + return new IssueCommentContractImpl(name, this.manager()); + } + + @Override + public Completable getEntityTagAsync(String resourceGroupName, String serviceName, String apiId, String issueId, String commentId) { + ApiIssueCommentsInner client = this.inner(); + return client.getEntityTagAsync(resourceGroupName, serviceName, apiId, issueId, commentId).toCompletable(); + } + + @Override + public Observable listByServiceAsync(final String resourceGroupName, final String serviceName, final String apiId, final String issueId) { + ApiIssueCommentsInner client = this.inner(); + return client.listByServiceAsync(resourceGroupName, serviceName, apiId, issueId) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public IssueCommentContract call(IssueCommentContractInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Observable getAsync(String resourceGroupName, String serviceName, String apiId, String issueId, String commentId) { + ApiIssueCommentsInner client = this.inner(); + return client.getAsync(resourceGroupName, serviceName, apiId, issueId, commentId) + .map(new Func1() { + @Override + public IssueCommentContract call(IssueCommentContractInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Completable deleteAsync(String resourceGroupName, String serviceName, String apiId, String issueId, String commentId, String ifMatch) { + ApiIssueCommentsInner client = this.inner(); + return client.deleteAsync(resourceGroupName, serviceName, apiId, issueId, commentId, ifMatch).toCompletable(); + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ApiIssueCommentsInner.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ApiIssueCommentsInner.java new file mode 100644 index 0000000000000..c09e70795c7c7 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ApiIssueCommentsInner.java @@ -0,0 +1,1051 @@ +/** + * 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.apimanagement.v2019_01_01.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.apimanagement.v2019_01_01.ApiIssueCommentCreateOrUpdateHeaders; +import com.microsoft.azure.management.apimanagement.v2019_01_01.ApiIssueCommentGetEntityTagHeaders; +import com.microsoft.azure.management.apimanagement.v2019_01_01.ApiIssueCommentGetHeaders; +import com.microsoft.azure.management.apimanagement.v2019_01_01.ErrorResponseException; +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.ServiceResponseWithHeaders; +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.HEAD; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.HTTP; +import retrofit2.http.Path; +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 ApiIssueComments. + */ +public class ApiIssueCommentsInner { + /** The Retrofit service to perform REST calls. */ + private ApiIssueCommentsService service; + /** The service client containing this operation class. */ + private ApiManagementClientImpl client; + + /** + * Initializes an instance of ApiIssueCommentsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public ApiIssueCommentsInner(Retrofit retrofit, ApiManagementClientImpl client) { + this.service = retrofit.create(ApiIssueCommentsService.class); + this.client = client; + } + + /** + * The interface defining all the services for ApiIssueComments to be + * used by Retrofit to perform actually REST calls. + */ + interface ApiIssueCommentsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.apimanagement.v2019_01_01.ApiIssueComments listByService" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/issues/{issueId}/comments") + Observable> listByService(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("apiId") String apiId, @Path("issueId") String issueId, @Path("subscriptionId") String subscriptionId, @Query("$filter") String filter, @Query("$top") Integer top, @Query("$skip") Integer skip, @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.apimanagement.v2019_01_01.ApiIssueComments getEntityTag" }) + @HEAD("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/issues/{issueId}/comments/{commentId}") + Observable> getEntityTag(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("apiId") String apiId, @Path("issueId") String issueId, @Path("commentId") String commentId, @Path("subscriptionId") String subscriptionId, @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.apimanagement.v2019_01_01.ApiIssueComments get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/issues/{issueId}/comments/{commentId}") + Observable> get(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("apiId") String apiId, @Path("issueId") String issueId, @Path("commentId") String commentId, @Path("subscriptionId") String subscriptionId, @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.apimanagement.v2019_01_01.ApiIssueComments createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/issues/{issueId}/comments/{commentId}") + Observable> createOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("apiId") String apiId, @Path("issueId") String issueId, @Path("commentId") String commentId, @Path("subscriptionId") String subscriptionId, @Body IssueCommentContractInner parameters, @Header("If-Match") String ifMatch, @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.apimanagement.v2019_01_01.ApiIssueComments delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/issues/{issueId}/comments/{commentId}", method = "DELETE", hasBody = true) + Observable> delete(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("apiId") String apiId, @Path("issueId") String issueId, @Path("commentId") String commentId, @Path("subscriptionId") String subscriptionId, @Header("If-Match") String ifMatch, @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.apimanagement.v2019_01_01.ApiIssueComments listByServiceNext" }) + @GET + Observable> listByServiceNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Lists all comments for the Issue associated with the specified API. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API identifier. Must be unique in the current API Management service instance. + * @param issueId Issue identifier. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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<IssueCommentContractInner> object if successful. + */ + public PagedList listByService(final String resourceGroupName, final String serviceName, final String apiId, final String issueId) { + ServiceResponse> response = listByServiceSinglePageAsync(resourceGroupName, serviceName, apiId, issueId).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByServiceNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists all comments for the Issue associated with the specified API. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API identifier. Must be unique in the current API Management service instance. + * @param issueId Issue identifier. Must be unique in the current API Management service instance. + * @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> listByServiceAsync(final String resourceGroupName, final String serviceName, final String apiId, final String issueId, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByServiceSinglePageAsync(resourceGroupName, serviceName, apiId, issueId), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByServiceNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists all comments for the Issue associated with the specified API. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API identifier. Must be unique in the current API Management service instance. + * @param issueId Issue identifier. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<IssueCommentContractInner> object + */ + public Observable> listByServiceAsync(final String resourceGroupName, final String serviceName, final String apiId, final String issueId) { + return listByServiceWithServiceResponseAsync(resourceGroupName, serviceName, apiId, issueId) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all comments for the Issue associated with the specified API. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API identifier. Must be unique in the current API Management service instance. + * @param issueId Issue identifier. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<IssueCommentContractInner> object + */ + public Observable>> listByServiceWithServiceResponseAsync(final String resourceGroupName, final String serviceName, final String apiId, final String issueId) { + return listByServiceSinglePageAsync(resourceGroupName, serviceName, apiId, issueId) + .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(listByServiceNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists all comments for the Issue associated with the specified API. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API identifier. Must be unique in the current API Management service instance. + * @param issueId Issue identifier. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<IssueCommentContractInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByServiceSinglePageAsync(final String resourceGroupName, final String serviceName, final String apiId, final String issueId) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (apiId == null) { + throw new IllegalArgumentException("Parameter apiId is required and cannot be null."); + } + if (issueId == null) { + throw new IllegalArgumentException("Parameter issueId is required and cannot be null."); + } + 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 filter = null; + final Integer top = null; + final Integer skip = null; + return service.listByService(resourceGroupName, serviceName, apiId, issueId, this.client.subscriptionId(), filter, top, skip, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByServiceDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Lists all comments for the Issue associated with the specified API. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API identifier. Must be unique in the current API Management service instance. + * @param issueId Issue identifier. Must be unique in the current API Management service instance. + * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| userId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br> + * @param top Number of records to return. + * @param skip Number of records to skip. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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<IssueCommentContractInner> object if successful. + */ + public PagedList listByService(final String resourceGroupName, final String serviceName, final String apiId, final String issueId, final String filter, final Integer top, final Integer skip) { + ServiceResponse> response = listByServiceSinglePageAsync(resourceGroupName, serviceName, apiId, issueId, filter, top, skip).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByServiceNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists all comments for the Issue associated with the specified API. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API identifier. Must be unique in the current API Management service instance. + * @param issueId Issue identifier. Must be unique in the current API Management service instance. + * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| userId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br> + * @param top Number of records to return. + * @param skip Number of records to skip. + * @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> listByServiceAsync(final String resourceGroupName, final String serviceName, final String apiId, final String issueId, final String filter, final Integer top, final Integer skip, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByServiceSinglePageAsync(resourceGroupName, serviceName, apiId, issueId, filter, top, skip), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByServiceNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists all comments for the Issue associated with the specified API. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API identifier. Must be unique in the current API Management service instance. + * @param issueId Issue identifier. Must be unique in the current API Management service instance. + * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| userId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br> + * @param top Number of records to return. + * @param skip Number of records to skip. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<IssueCommentContractInner> object + */ + public Observable> listByServiceAsync(final String resourceGroupName, final String serviceName, final String apiId, final String issueId, final String filter, final Integer top, final Integer skip) { + return listByServiceWithServiceResponseAsync(resourceGroupName, serviceName, apiId, issueId, filter, top, skip) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all comments for the Issue associated with the specified API. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API identifier. Must be unique in the current API Management service instance. + * @param issueId Issue identifier. Must be unique in the current API Management service instance. + * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| userId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br> + * @param top Number of records to return. + * @param skip Number of records to skip. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<IssueCommentContractInner> object + */ + public Observable>> listByServiceWithServiceResponseAsync(final String resourceGroupName, final String serviceName, final String apiId, final String issueId, final String filter, final Integer top, final Integer skip) { + return listByServiceSinglePageAsync(resourceGroupName, serviceName, apiId, issueId, filter, top, skip) + .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(listByServiceNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists all comments for the Issue associated with the specified API. + * + ServiceResponse> * @param resourceGroupName The name of the resource group. + ServiceResponse> * @param serviceName The name of the API Management service. + ServiceResponse> * @param apiId API identifier. Must be unique in the current API Management service instance. + ServiceResponse> * @param issueId Issue identifier. Must be unique in the current API Management service instance. + ServiceResponse> * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| userId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br> + ServiceResponse> * @param top Number of records to return. + ServiceResponse> * @param skip Number of records to skip. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<IssueCommentContractInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByServiceSinglePageAsync(final String resourceGroupName, final String serviceName, final String apiId, final String issueId, final String filter, final Integer top, final Integer skip) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (apiId == null) { + throw new IllegalArgumentException("Parameter apiId is required and cannot be null."); + } + if (issueId == null) { + throw new IllegalArgumentException("Parameter issueId is required and cannot be null."); + } + 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.listByService(resourceGroupName, serviceName, apiId, issueId, this.client.subscriptionId(), filter, top, skip, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByServiceDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByServiceDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Gets the entity state (Etag) version of the issue Comment for an API specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API identifier. Must be unique in the current API Management service instance. + * @param issueId Issue identifier. Must be unique in the current API Management service instance. + * @param commentId Comment identifier within an Issue. Must be unique in the current Issue. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void getEntityTag(String resourceGroupName, String serviceName, String apiId, String issueId, String commentId) { + getEntityTagWithServiceResponseAsync(resourceGroupName, serviceName, apiId, issueId, commentId).toBlocking().single().body(); + } + + /** + * Gets the entity state (Etag) version of the issue Comment for an API specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API identifier. Must be unique in the current API Management service instance. + * @param issueId Issue identifier. Must be unique in the current API Management service instance. + * @param commentId Comment identifier within an Issue. Must be unique in the current Issue. + * @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 getEntityTagAsync(String resourceGroupName, String serviceName, String apiId, String issueId, String commentId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(getEntityTagWithServiceResponseAsync(resourceGroupName, serviceName, apiId, issueId, commentId), serviceCallback); + } + + /** + * Gets the entity state (Etag) version of the issue Comment for an API specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API identifier. Must be unique in the current API Management service instance. + * @param issueId Issue identifier. Must be unique in the current API Management service instance. + * @param commentId Comment identifier within an Issue. Must be unique in the current Issue. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public Observable getEntityTagAsync(String resourceGroupName, String serviceName, String apiId, String issueId, String commentId) { + return getEntityTagWithServiceResponseAsync(resourceGroupName, serviceName, apiId, issueId, commentId).map(new Func1, Void>() { + @Override + public Void call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Gets the entity state (Etag) version of the issue Comment for an API specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API identifier. Must be unique in the current API Management service instance. + * @param issueId Issue identifier. Must be unique in the current API Management service instance. + * @param commentId Comment identifier within an Issue. Must be unique in the current Issue. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public Observable> getEntityTagWithServiceResponseAsync(String resourceGroupName, String serviceName, String apiId, String issueId, String commentId) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (apiId == null) { + throw new IllegalArgumentException("Parameter apiId is required and cannot be null."); + } + if (issueId == null) { + throw new IllegalArgumentException("Parameter issueId is required and cannot be null."); + } + if (commentId == null) { + throw new IllegalArgumentException("Parameter commentId is required and cannot be null."); + } + 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.getEntityTag(resourceGroupName, serviceName, apiId, issueId, commentId, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = getEntityTagDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponseWithHeaders getEntityTagDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .buildEmptyWithHeaders(response, ApiIssueCommentGetEntityTagHeaders.class); + } + + /** + * Gets the details of the issue Comment for an API specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API identifier. Must be unique in the current API Management service instance. + * @param issueId Issue identifier. Must be unique in the current API Management service instance. + * @param commentId Comment identifier within an Issue. Must be unique in the current Issue. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the IssueCommentContractInner object if successful. + */ + public IssueCommentContractInner get(String resourceGroupName, String serviceName, String apiId, String issueId, String commentId) { + return getWithServiceResponseAsync(resourceGroupName, serviceName, apiId, issueId, commentId).toBlocking().single().body(); + } + + /** + * Gets the details of the issue Comment for an API specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API identifier. Must be unique in the current API Management service instance. + * @param issueId Issue identifier. Must be unique in the current API Management service instance. + * @param commentId Comment identifier within an Issue. Must be unique in the current Issue. + * @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 getAsync(String resourceGroupName, String serviceName, String apiId, String issueId, String commentId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(getWithServiceResponseAsync(resourceGroupName, serviceName, apiId, issueId, commentId), serviceCallback); + } + + /** + * Gets the details of the issue Comment for an API specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API identifier. Must be unique in the current API Management service instance. + * @param issueId Issue identifier. Must be unique in the current API Management service instance. + * @param commentId Comment identifier within an Issue. Must be unique in the current Issue. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the IssueCommentContractInner object + */ + public Observable getAsync(String resourceGroupName, String serviceName, String apiId, String issueId, String commentId) { + return getWithServiceResponseAsync(resourceGroupName, serviceName, apiId, issueId, commentId).map(new Func1, IssueCommentContractInner>() { + @Override + public IssueCommentContractInner call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Gets the details of the issue Comment for an API specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API identifier. Must be unique in the current API Management service instance. + * @param issueId Issue identifier. Must be unique in the current API Management service instance. + * @param commentId Comment identifier within an Issue. Must be unique in the current Issue. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the IssueCommentContractInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String serviceName, String apiId, String issueId, String commentId) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (apiId == null) { + throw new IllegalArgumentException("Parameter apiId is required and cannot be null."); + } + if (issueId == null) { + throw new IllegalArgumentException("Parameter issueId is required and cannot be null."); + } + if (commentId == null) { + throw new IllegalArgumentException("Parameter commentId is required and cannot be null."); + } + 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.get(resourceGroupName, serviceName, apiId, issueId, commentId, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = getDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponseWithHeaders getDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .buildWithHeaders(response, ApiIssueCommentGetHeaders.class); + } + + /** + * Creates a new Comment for the Issue in an API or updates an existing one. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API identifier. Must be unique in the current API Management service instance. + * @param issueId Issue identifier. Must be unique in the current API Management service instance. + * @param commentId Comment identifier within an Issue. Must be unique in the current Issue. + * @param parameters Create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the IssueCommentContractInner object if successful. + */ + public IssueCommentContractInner createOrUpdate(String resourceGroupName, String serviceName, String apiId, String issueId, String commentId, IssueCommentContractInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serviceName, apiId, issueId, commentId, parameters).toBlocking().single().body(); + } + + /** + * Creates a new Comment for the Issue in an API or updates an existing one. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API identifier. Must be unique in the current API Management service instance. + * @param issueId Issue identifier. Must be unique in the current API Management service instance. + * @param commentId Comment identifier within an Issue. Must be unique in the current Issue. + * @param parameters Create parameters. + * @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 createOrUpdateAsync(String resourceGroupName, String serviceName, String apiId, String issueId, String commentId, IssueCommentContractInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, serviceName, apiId, issueId, commentId, parameters), serviceCallback); + } + + /** + * Creates a new Comment for the Issue in an API or updates an existing one. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API identifier. Must be unique in the current API Management service instance. + * @param issueId Issue identifier. Must be unique in the current API Management service instance. + * @param commentId Comment identifier within an Issue. Must be unique in the current Issue. + * @param parameters Create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the IssueCommentContractInner object + */ + public Observable createOrUpdateAsync(String resourceGroupName, String serviceName, String apiId, String issueId, String commentId, IssueCommentContractInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serviceName, apiId, issueId, commentId, parameters).map(new Func1, IssueCommentContractInner>() { + @Override + public IssueCommentContractInner call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Creates a new Comment for the Issue in an API or updates an existing one. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API identifier. Must be unique in the current API Management service instance. + * @param issueId Issue identifier. Must be unique in the current API Management service instance. + * @param commentId Comment identifier within an Issue. Must be unique in the current Issue. + * @param parameters Create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the IssueCommentContractInner object + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String serviceName, String apiId, String issueId, String commentId, IssueCommentContractInner parameters) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (apiId == null) { + throw new IllegalArgumentException("Parameter apiId is required and cannot be null."); + } + if (issueId == null) { + throw new IllegalArgumentException("Parameter issueId is required and cannot be null."); + } + if (commentId == null) { + throw new IllegalArgumentException("Parameter commentId is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(parameters); + final String ifMatch = null; + return service.createOrUpdate(resourceGroupName, serviceName, apiId, issueId, commentId, this.client.subscriptionId(), parameters, ifMatch, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = createOrUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Creates a new Comment for the Issue in an API or updates an existing one. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API identifier. Must be unique in the current API Management service instance. + * @param issueId Issue identifier. Must be unique in the current API Management service instance. + * @param commentId Comment identifier within an Issue. Must be unique in the current Issue. + * @param parameters Create parameters. + * @param ifMatch ETag of the Entity. Not required when creating an entity, but required when updating an entity. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the IssueCommentContractInner object if successful. + */ + public IssueCommentContractInner createOrUpdate(String resourceGroupName, String serviceName, String apiId, String issueId, String commentId, IssueCommentContractInner parameters, String ifMatch) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serviceName, apiId, issueId, commentId, parameters, ifMatch).toBlocking().single().body(); + } + + /** + * Creates a new Comment for the Issue in an API or updates an existing one. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API identifier. Must be unique in the current API Management service instance. + * @param issueId Issue identifier. Must be unique in the current API Management service instance. + * @param commentId Comment identifier within an Issue. Must be unique in the current Issue. + * @param parameters Create parameters. + * @param ifMatch ETag of the Entity. Not required when creating an entity, but required when updating an entity. + * @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 createOrUpdateAsync(String resourceGroupName, String serviceName, String apiId, String issueId, String commentId, IssueCommentContractInner parameters, String ifMatch, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, serviceName, apiId, issueId, commentId, parameters, ifMatch), serviceCallback); + } + + /** + * Creates a new Comment for the Issue in an API or updates an existing one. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API identifier. Must be unique in the current API Management service instance. + * @param issueId Issue identifier. Must be unique in the current API Management service instance. + * @param commentId Comment identifier within an Issue. Must be unique in the current Issue. + * @param parameters Create parameters. + * @param ifMatch ETag of the Entity. Not required when creating an entity, but required when updating an entity. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the IssueCommentContractInner object + */ + public Observable createOrUpdateAsync(String resourceGroupName, String serviceName, String apiId, String issueId, String commentId, IssueCommentContractInner parameters, String ifMatch) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serviceName, apiId, issueId, commentId, parameters, ifMatch).map(new Func1, IssueCommentContractInner>() { + @Override + public IssueCommentContractInner call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Creates a new Comment for the Issue in an API or updates an existing one. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API identifier. Must be unique in the current API Management service instance. + * @param issueId Issue identifier. Must be unique in the current API Management service instance. + * @param commentId Comment identifier within an Issue. Must be unique in the current Issue. + * @param parameters Create parameters. + * @param ifMatch ETag of the Entity. Not required when creating an entity, but required when updating an entity. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the IssueCommentContractInner object + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String serviceName, String apiId, String issueId, String commentId, IssueCommentContractInner parameters, String ifMatch) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (apiId == null) { + throw new IllegalArgumentException("Parameter apiId is required and cannot be null."); + } + if (issueId == null) { + throw new IllegalArgumentException("Parameter issueId is required and cannot be null."); + } + if (commentId == null) { + throw new IllegalArgumentException("Parameter commentId is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(parameters); + return service.createOrUpdate(resourceGroupName, serviceName, apiId, issueId, commentId, this.client.subscriptionId(), parameters, ifMatch, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = createOrUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponseWithHeaders createOrUpdateDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(201, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .buildWithHeaders(response, ApiIssueCommentCreateOrUpdateHeaders.class); + } + + /** + * Deletes the specified comment from an Issue. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API identifier. Must be unique in the current API Management service instance. + * @param issueId Issue identifier. Must be unique in the current API Management service instance. + * @param commentId Comment identifier within an Issue. Must be unique in the current Issue. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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 serviceName, String apiId, String issueId, String commentId, String ifMatch) { + deleteWithServiceResponseAsync(resourceGroupName, serviceName, apiId, issueId, commentId, ifMatch).toBlocking().single().body(); + } + + /** + * Deletes the specified comment from an Issue. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API identifier. Must be unique in the current API Management service instance. + * @param issueId Issue identifier. Must be unique in the current API Management service instance. + * @param commentId Comment identifier within an Issue. Must be unique in the current Issue. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @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 serviceName, String apiId, String issueId, String commentId, String ifMatch, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, serviceName, apiId, issueId, commentId, ifMatch), serviceCallback); + } + + /** + * Deletes the specified comment from an Issue. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API identifier. Must be unique in the current API Management service instance. + * @param issueId Issue identifier. Must be unique in the current API Management service instance. + * @param commentId Comment identifier within an Issue. Must be unique in the current Issue. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable deleteAsync(String resourceGroupName, String serviceName, String apiId, String issueId, String commentId, String ifMatch) { + return deleteWithServiceResponseAsync(resourceGroupName, serviceName, apiId, issueId, commentId, ifMatch).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes the specified comment from an Issue. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API identifier. Must be unique in the current API Management service instance. + * @param issueId Issue identifier. Must be unique in the current API Management service instance. + * @param commentId Comment identifier within an Issue. Must be unique in the current Issue. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> deleteWithServiceResponseAsync(String resourceGroupName, String serviceName, String apiId, String issueId, String commentId, String ifMatch) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (apiId == null) { + throw new IllegalArgumentException("Parameter apiId is required and cannot be null."); + } + if (issueId == null) { + throw new IllegalArgumentException("Parameter issueId is required and cannot be null."); + } + if (commentId == null) { + throw new IllegalArgumentException("Parameter commentId is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (ifMatch == null) { + throw new IllegalArgumentException("Parameter ifMatch 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.delete(resourceGroupName, serviceName, apiId, issueId, commentId, this.client.subscriptionId(), ifMatch, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = deleteDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse deleteDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(204, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists all comments for the Issue associated with the specified API. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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<IssueCommentContractInner> object if successful. + */ + public PagedList listByServiceNext(final String nextPageLink) { + ServiceResponse> response = listByServiceNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByServiceNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists all comments for the Issue associated with the specified API. + * + * @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> listByServiceNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByServiceNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByServiceNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists all comments for the Issue associated with the specified API. + * + * @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<IssueCommentContractInner> object + */ + public Observable> listByServiceNextAsync(final String nextPageLink) { + return listByServiceNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all comments for the Issue associated with the specified API. + * + * @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<IssueCommentContractInner> object + */ + public Observable>> listByServiceNextWithServiceResponseAsync(final String nextPageLink) { + return listByServiceNextSinglePageAsync(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(listByServiceNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists all comments for the Issue associated with the specified API. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<IssueCommentContractInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByServiceNextSinglePageAsync(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.listByServiceNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByServiceNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByServiceNextDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ApiIssuesImpl.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ApiIssuesImpl.java new file mode 100644 index 0000000000000..4fe12eb800da8 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ApiIssuesImpl.java @@ -0,0 +1,87 @@ +/** + * 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.apimanagement.v2019_01_01.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.apimanagement.v2019_01_01.ApiIssues; +import rx.Completable; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.apimanagement.v2019_01_01.IssueContract; + +class ApiIssuesImpl extends WrapperImpl implements ApiIssues { + private final ApiManagementManager manager; + + ApiIssuesImpl(ApiManagementManager manager) { + super(manager.inner().apiIssues()); + this.manager = manager; + } + + public ApiManagementManager manager() { + return this.manager; + } + + @Override + public IssueContractImpl define(String name) { + return wrapModel(name); + } + + private IssueContractImpl wrapModel(IssueContractInner inner) { + return new IssueContractImpl(inner, manager()); + } + + private IssueContractImpl wrapModel(String name) { + return new IssueContractImpl(name, this.manager()); + } + + @Override + public Completable getEntityTagAsync(String resourceGroupName, String serviceName, String apiId, String issueId) { + ApiIssuesInner client = this.inner(); + return client.getEntityTagAsync(resourceGroupName, serviceName, apiId, issueId).toCompletable(); + } + + @Override + public Observable listByServiceAsync(final String resourceGroupName, final String serviceName, final String apiId) { + ApiIssuesInner client = this.inner(); + return client.listByServiceAsync(resourceGroupName, serviceName, apiId) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public IssueContract call(IssueContractInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Observable getAsync(String resourceGroupName, String serviceName, String apiId, String issueId) { + ApiIssuesInner client = this.inner(); + return client.getAsync(resourceGroupName, serviceName, apiId, issueId) + .map(new Func1() { + @Override + public IssueContract call(IssueContractInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Completable deleteAsync(String resourceGroupName, String serviceName, String apiId, String issueId, String ifMatch) { + ApiIssuesInner client = this.inner(); + return client.deleteAsync(resourceGroupName, serviceName, apiId, issueId, ifMatch).toCompletable(); + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ApiIssuesInner.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ApiIssuesInner.java new file mode 100644 index 0000000000000..d27a281bf7789 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ApiIssuesInner.java @@ -0,0 +1,1224 @@ +/** + * 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.apimanagement.v2019_01_01.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.apimanagement.v2019_01_01.ApiIssueCreateOrUpdateHeaders; +import com.microsoft.azure.management.apimanagement.v2019_01_01.ApiIssueGetEntityTagHeaders; +import com.microsoft.azure.management.apimanagement.v2019_01_01.ApiIssueGetHeaders; +import com.microsoft.azure.management.apimanagement.v2019_01_01.ErrorResponseException; +import com.microsoft.azure.management.apimanagement.v2019_01_01.IssueUpdateContract; +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.ServiceResponseWithHeaders; +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.HEAD; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.HTTP; +import retrofit2.http.PATCH; +import retrofit2.http.Path; +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 ApiIssues. + */ +public class ApiIssuesInner { + /** The Retrofit service to perform REST calls. */ + private ApiIssuesService service; + /** The service client containing this operation class. */ + private ApiManagementClientImpl client; + + /** + * Initializes an instance of ApiIssuesInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public ApiIssuesInner(Retrofit retrofit, ApiManagementClientImpl client) { + this.service = retrofit.create(ApiIssuesService.class); + this.client = client; + } + + /** + * The interface defining all the services for ApiIssues to be + * used by Retrofit to perform actually REST calls. + */ + interface ApiIssuesService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.apimanagement.v2019_01_01.ApiIssues listByService" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/issues") + Observable> listByService(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("apiId") String apiId, @Path("subscriptionId") String subscriptionId, @Query("$filter") String filter, @Query("expandCommentsAttachments") Boolean expandCommentsAttachments, @Query("$top") Integer top, @Query("$skip") Integer skip, @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.apimanagement.v2019_01_01.ApiIssues getEntityTag" }) + @HEAD("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/issues/{issueId}") + Observable> getEntityTag(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("apiId") String apiId, @Path("issueId") String issueId, @Path("subscriptionId") String subscriptionId, @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.apimanagement.v2019_01_01.ApiIssues get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/issues/{issueId}") + Observable> get(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("apiId") String apiId, @Path("issueId") String issueId, @Path("subscriptionId") String subscriptionId, @Query("expandCommentsAttachments") Boolean expandCommentsAttachments, @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.apimanagement.v2019_01_01.ApiIssues createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/issues/{issueId}") + Observable> createOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("apiId") String apiId, @Path("issueId") String issueId, @Path("subscriptionId") String subscriptionId, @Body IssueContractInner parameters, @Header("If-Match") String ifMatch, @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.apimanagement.v2019_01_01.ApiIssues update" }) + @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/issues/{issueId}") + Observable> update(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("apiId") String apiId, @Path("issueId") String issueId, @Path("subscriptionId") String subscriptionId, @Body IssueUpdateContract parameters, @Header("If-Match") String ifMatch, @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.apimanagement.v2019_01_01.ApiIssues delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/issues/{issueId}", method = "DELETE", hasBody = true) + Observable> delete(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("apiId") String apiId, @Path("issueId") String issueId, @Path("subscriptionId") String subscriptionId, @Header("If-Match") String ifMatch, @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.apimanagement.v2019_01_01.ApiIssues listByServiceNext" }) + @GET + Observable> listByServiceNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Lists all issues associated with the specified API. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API identifier. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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<IssueContractInner> object if successful. + */ + public PagedList listByService(final String resourceGroupName, final String serviceName, final String apiId) { + ServiceResponse> response = listByServiceSinglePageAsync(resourceGroupName, serviceName, apiId).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByServiceNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists all issues associated with the specified API. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API identifier. Must be unique in the current API Management service instance. + * @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> listByServiceAsync(final String resourceGroupName, final String serviceName, final String apiId, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByServiceSinglePageAsync(resourceGroupName, serviceName, apiId), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByServiceNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists all issues associated with the specified API. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API identifier. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<IssueContractInner> object + */ + public Observable> listByServiceAsync(final String resourceGroupName, final String serviceName, final String apiId) { + return listByServiceWithServiceResponseAsync(resourceGroupName, serviceName, apiId) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all issues associated with the specified API. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API identifier. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<IssueContractInner> object + */ + public Observable>> listByServiceWithServiceResponseAsync(final String resourceGroupName, final String serviceName, final String apiId) { + return listByServiceSinglePageAsync(resourceGroupName, serviceName, apiId) + .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(listByServiceNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists all issues associated with the specified API. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API identifier. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<IssueContractInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByServiceSinglePageAsync(final String resourceGroupName, final String serviceName, final String apiId) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (apiId == null) { + throw new IllegalArgumentException("Parameter apiId is required and cannot be null."); + } + 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 filter = null; + final Boolean expandCommentsAttachments = null; + final Integer top = null; + final Integer skip = null; + return service.listByService(resourceGroupName, serviceName, apiId, this.client.subscriptionId(), filter, expandCommentsAttachments, top, skip, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByServiceDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Lists all issues associated with the specified API. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API identifier. Must be unique in the current API Management service instance. + * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| userId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| state | filter | eq | | </br> + * @param expandCommentsAttachments Expand the comment attachments. + * @param top Number of records to return. + * @param skip Number of records to skip. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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<IssueContractInner> object if successful. + */ + public PagedList listByService(final String resourceGroupName, final String serviceName, final String apiId, final String filter, final Boolean expandCommentsAttachments, final Integer top, final Integer skip) { + ServiceResponse> response = listByServiceSinglePageAsync(resourceGroupName, serviceName, apiId, filter, expandCommentsAttachments, top, skip).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByServiceNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists all issues associated with the specified API. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API identifier. Must be unique in the current API Management service instance. + * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| userId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| state | filter | eq | | </br> + * @param expandCommentsAttachments Expand the comment attachments. + * @param top Number of records to return. + * @param skip Number of records to skip. + * @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> listByServiceAsync(final String resourceGroupName, final String serviceName, final String apiId, final String filter, final Boolean expandCommentsAttachments, final Integer top, final Integer skip, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByServiceSinglePageAsync(resourceGroupName, serviceName, apiId, filter, expandCommentsAttachments, top, skip), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByServiceNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists all issues associated with the specified API. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API identifier. Must be unique in the current API Management service instance. + * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| userId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| state | filter | eq | | </br> + * @param expandCommentsAttachments Expand the comment attachments. + * @param top Number of records to return. + * @param skip Number of records to skip. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<IssueContractInner> object + */ + public Observable> listByServiceAsync(final String resourceGroupName, final String serviceName, final String apiId, final String filter, final Boolean expandCommentsAttachments, final Integer top, final Integer skip) { + return listByServiceWithServiceResponseAsync(resourceGroupName, serviceName, apiId, filter, expandCommentsAttachments, top, skip) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all issues associated with the specified API. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API identifier. Must be unique in the current API Management service instance. + * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| userId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| state | filter | eq | | </br> + * @param expandCommentsAttachments Expand the comment attachments. + * @param top Number of records to return. + * @param skip Number of records to skip. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<IssueContractInner> object + */ + public Observable>> listByServiceWithServiceResponseAsync(final String resourceGroupName, final String serviceName, final String apiId, final String filter, final Boolean expandCommentsAttachments, final Integer top, final Integer skip) { + return listByServiceSinglePageAsync(resourceGroupName, serviceName, apiId, filter, expandCommentsAttachments, top, skip) + .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(listByServiceNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists all issues associated with the specified API. + * + ServiceResponse> * @param resourceGroupName The name of the resource group. + ServiceResponse> * @param serviceName The name of the API Management service. + ServiceResponse> * @param apiId API identifier. Must be unique in the current API Management service instance. + ServiceResponse> * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| userId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| state | filter | eq | | </br> + ServiceResponse> * @param expandCommentsAttachments Expand the comment attachments. + ServiceResponse> * @param top Number of records to return. + ServiceResponse> * @param skip Number of records to skip. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<IssueContractInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByServiceSinglePageAsync(final String resourceGroupName, final String serviceName, final String apiId, final String filter, final Boolean expandCommentsAttachments, final Integer top, final Integer skip) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (apiId == null) { + throw new IllegalArgumentException("Parameter apiId is required and cannot be null."); + } + 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.listByService(resourceGroupName, serviceName, apiId, this.client.subscriptionId(), filter, expandCommentsAttachments, top, skip, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByServiceDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByServiceDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Gets the entity state (Etag) version of the Issue for an API specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API identifier. Must be unique in the current API Management service instance. + * @param issueId Issue identifier. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void getEntityTag(String resourceGroupName, String serviceName, String apiId, String issueId) { + getEntityTagWithServiceResponseAsync(resourceGroupName, serviceName, apiId, issueId).toBlocking().single().body(); + } + + /** + * Gets the entity state (Etag) version of the Issue for an API specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API identifier. Must be unique in the current API Management service instance. + * @param issueId Issue identifier. Must be unique in the current API Management service instance. + * @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 getEntityTagAsync(String resourceGroupName, String serviceName, String apiId, String issueId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(getEntityTagWithServiceResponseAsync(resourceGroupName, serviceName, apiId, issueId), serviceCallback); + } + + /** + * Gets the entity state (Etag) version of the Issue for an API specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API identifier. Must be unique in the current API Management service instance. + * @param issueId Issue identifier. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public Observable getEntityTagAsync(String resourceGroupName, String serviceName, String apiId, String issueId) { + return getEntityTagWithServiceResponseAsync(resourceGroupName, serviceName, apiId, issueId).map(new Func1, Void>() { + @Override + public Void call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Gets the entity state (Etag) version of the Issue for an API specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API identifier. Must be unique in the current API Management service instance. + * @param issueId Issue identifier. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public Observable> getEntityTagWithServiceResponseAsync(String resourceGroupName, String serviceName, String apiId, String issueId) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (apiId == null) { + throw new IllegalArgumentException("Parameter apiId is required and cannot be null."); + } + if (issueId == null) { + throw new IllegalArgumentException("Parameter issueId is required and cannot be null."); + } + 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.getEntityTag(resourceGroupName, serviceName, apiId, issueId, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = getEntityTagDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponseWithHeaders getEntityTagDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .buildEmptyWithHeaders(response, ApiIssueGetEntityTagHeaders.class); + } + + /** + * Gets the details of the Issue for an API specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API identifier. Must be unique in the current API Management service instance. + * @param issueId Issue identifier. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the IssueContractInner object if successful. + */ + public IssueContractInner get(String resourceGroupName, String serviceName, String apiId, String issueId) { + return getWithServiceResponseAsync(resourceGroupName, serviceName, apiId, issueId).toBlocking().single().body(); + } + + /** + * Gets the details of the Issue for an API specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API identifier. Must be unique in the current API Management service instance. + * @param issueId Issue identifier. Must be unique in the current API Management service instance. + * @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 getAsync(String resourceGroupName, String serviceName, String apiId, String issueId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(getWithServiceResponseAsync(resourceGroupName, serviceName, apiId, issueId), serviceCallback); + } + + /** + * Gets the details of the Issue for an API specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API identifier. Must be unique in the current API Management service instance. + * @param issueId Issue identifier. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the IssueContractInner object + */ + public Observable getAsync(String resourceGroupName, String serviceName, String apiId, String issueId) { + return getWithServiceResponseAsync(resourceGroupName, serviceName, apiId, issueId).map(new Func1, IssueContractInner>() { + @Override + public IssueContractInner call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Gets the details of the Issue for an API specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API identifier. Must be unique in the current API Management service instance. + * @param issueId Issue identifier. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the IssueContractInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String serviceName, String apiId, String issueId) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (apiId == null) { + throw new IllegalArgumentException("Parameter apiId is required and cannot be null."); + } + if (issueId == null) { + throw new IllegalArgumentException("Parameter issueId is required and cannot be null."); + } + 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 Boolean expandCommentsAttachments = null; + return service.get(resourceGroupName, serviceName, apiId, issueId, this.client.subscriptionId(), expandCommentsAttachments, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = getDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Gets the details of the Issue for an API specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API identifier. Must be unique in the current API Management service instance. + * @param issueId Issue identifier. Must be unique in the current API Management service instance. + * @param expandCommentsAttachments Expand the comment attachments. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the IssueContractInner object if successful. + */ + public IssueContractInner get(String resourceGroupName, String serviceName, String apiId, String issueId, Boolean expandCommentsAttachments) { + return getWithServiceResponseAsync(resourceGroupName, serviceName, apiId, issueId, expandCommentsAttachments).toBlocking().single().body(); + } + + /** + * Gets the details of the Issue for an API specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API identifier. Must be unique in the current API Management service instance. + * @param issueId Issue identifier. Must be unique in the current API Management service instance. + * @param expandCommentsAttachments Expand the comment attachments. + * @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 getAsync(String resourceGroupName, String serviceName, String apiId, String issueId, Boolean expandCommentsAttachments, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(getWithServiceResponseAsync(resourceGroupName, serviceName, apiId, issueId, expandCommentsAttachments), serviceCallback); + } + + /** + * Gets the details of the Issue for an API specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API identifier. Must be unique in the current API Management service instance. + * @param issueId Issue identifier. Must be unique in the current API Management service instance. + * @param expandCommentsAttachments Expand the comment attachments. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the IssueContractInner object + */ + public Observable getAsync(String resourceGroupName, String serviceName, String apiId, String issueId, Boolean expandCommentsAttachments) { + return getWithServiceResponseAsync(resourceGroupName, serviceName, apiId, issueId, expandCommentsAttachments).map(new Func1, IssueContractInner>() { + @Override + public IssueContractInner call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Gets the details of the Issue for an API specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API identifier. Must be unique in the current API Management service instance. + * @param issueId Issue identifier. Must be unique in the current API Management service instance. + * @param expandCommentsAttachments Expand the comment attachments. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the IssueContractInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String serviceName, String apiId, String issueId, Boolean expandCommentsAttachments) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (apiId == null) { + throw new IllegalArgumentException("Parameter apiId is required and cannot be null."); + } + if (issueId == null) { + throw new IllegalArgumentException("Parameter issueId is required and cannot be null."); + } + 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.get(resourceGroupName, serviceName, apiId, issueId, this.client.subscriptionId(), expandCommentsAttachments, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = getDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponseWithHeaders getDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .buildWithHeaders(response, ApiIssueGetHeaders.class); + } + + /** + * Creates a new Issue for an API or updates an existing one. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API identifier. Must be unique in the current API Management service instance. + * @param issueId Issue identifier. Must be unique in the current API Management service instance. + * @param parameters Create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the IssueContractInner object if successful. + */ + public IssueContractInner createOrUpdate(String resourceGroupName, String serviceName, String apiId, String issueId, IssueContractInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serviceName, apiId, issueId, parameters).toBlocking().single().body(); + } + + /** + * Creates a new Issue for an API or updates an existing one. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API identifier. Must be unique in the current API Management service instance. + * @param issueId Issue identifier. Must be unique in the current API Management service instance. + * @param parameters Create parameters. + * @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 createOrUpdateAsync(String resourceGroupName, String serviceName, String apiId, String issueId, IssueContractInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, serviceName, apiId, issueId, parameters), serviceCallback); + } + + /** + * Creates a new Issue for an API or updates an existing one. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API identifier. Must be unique in the current API Management service instance. + * @param issueId Issue identifier. Must be unique in the current API Management service instance. + * @param parameters Create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the IssueContractInner object + */ + public Observable createOrUpdateAsync(String resourceGroupName, String serviceName, String apiId, String issueId, IssueContractInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serviceName, apiId, issueId, parameters).map(new Func1, IssueContractInner>() { + @Override + public IssueContractInner call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Creates a new Issue for an API or updates an existing one. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API identifier. Must be unique in the current API Management service instance. + * @param issueId Issue identifier. Must be unique in the current API Management service instance. + * @param parameters Create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the IssueContractInner object + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String serviceName, String apiId, String issueId, IssueContractInner parameters) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (apiId == null) { + throw new IllegalArgumentException("Parameter apiId is required and cannot be null."); + } + if (issueId == null) { + throw new IllegalArgumentException("Parameter issueId is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(parameters); + final String ifMatch = null; + return service.createOrUpdate(resourceGroupName, serviceName, apiId, issueId, this.client.subscriptionId(), parameters, ifMatch, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = createOrUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Creates a new Issue for an API or updates an existing one. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API identifier. Must be unique in the current API Management service instance. + * @param issueId Issue identifier. Must be unique in the current API Management service instance. + * @param parameters Create parameters. + * @param ifMatch ETag of the Entity. Not required when creating an entity, but required when updating an entity. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the IssueContractInner object if successful. + */ + public IssueContractInner createOrUpdate(String resourceGroupName, String serviceName, String apiId, String issueId, IssueContractInner parameters, String ifMatch) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serviceName, apiId, issueId, parameters, ifMatch).toBlocking().single().body(); + } + + /** + * Creates a new Issue for an API or updates an existing one. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API identifier. Must be unique in the current API Management service instance. + * @param issueId Issue identifier. Must be unique in the current API Management service instance. + * @param parameters Create parameters. + * @param ifMatch ETag of the Entity. Not required when creating an entity, but required when updating an entity. + * @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 createOrUpdateAsync(String resourceGroupName, String serviceName, String apiId, String issueId, IssueContractInner parameters, String ifMatch, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, serviceName, apiId, issueId, parameters, ifMatch), serviceCallback); + } + + /** + * Creates a new Issue for an API or updates an existing one. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API identifier. Must be unique in the current API Management service instance. + * @param issueId Issue identifier. Must be unique in the current API Management service instance. + * @param parameters Create parameters. + * @param ifMatch ETag of the Entity. Not required when creating an entity, but required when updating an entity. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the IssueContractInner object + */ + public Observable createOrUpdateAsync(String resourceGroupName, String serviceName, String apiId, String issueId, IssueContractInner parameters, String ifMatch) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serviceName, apiId, issueId, parameters, ifMatch).map(new Func1, IssueContractInner>() { + @Override + public IssueContractInner call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Creates a new Issue for an API or updates an existing one. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API identifier. Must be unique in the current API Management service instance. + * @param issueId Issue identifier. Must be unique in the current API Management service instance. + * @param parameters Create parameters. + * @param ifMatch ETag of the Entity. Not required when creating an entity, but required when updating an entity. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the IssueContractInner object + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String serviceName, String apiId, String issueId, IssueContractInner parameters, String ifMatch) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (apiId == null) { + throw new IllegalArgumentException("Parameter apiId is required and cannot be null."); + } + if (issueId == null) { + throw new IllegalArgumentException("Parameter issueId is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(parameters); + return service.createOrUpdate(resourceGroupName, serviceName, apiId, issueId, this.client.subscriptionId(), parameters, ifMatch, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = createOrUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponseWithHeaders createOrUpdateDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(201, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .buildWithHeaders(response, ApiIssueCreateOrUpdateHeaders.class); + } + + /** + * Updates an existing issue for an API. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API identifier. Must be unique in the current API Management service instance. + * @param issueId Issue identifier. Must be unique in the current API Management service instance. + * @param parameters Update parameters. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void update(String resourceGroupName, String serviceName, String apiId, String issueId, IssueUpdateContract parameters, String ifMatch) { + updateWithServiceResponseAsync(resourceGroupName, serviceName, apiId, issueId, parameters, ifMatch).toBlocking().single().body(); + } + + /** + * Updates an existing issue for an API. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API identifier. Must be unique in the current API Management service instance. + * @param issueId Issue identifier. Must be unique in the current API Management service instance. + * @param parameters Update parameters. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @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 serviceName, String apiId, String issueId, IssueUpdateContract parameters, String ifMatch, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateWithServiceResponseAsync(resourceGroupName, serviceName, apiId, issueId, parameters, ifMatch), serviceCallback); + } + + /** + * Updates an existing issue for an API. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API identifier. Must be unique in the current API Management service instance. + * @param issueId Issue identifier. Must be unique in the current API Management service instance. + * @param parameters Update parameters. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable updateAsync(String resourceGroupName, String serviceName, String apiId, String issueId, IssueUpdateContract parameters, String ifMatch) { + return updateWithServiceResponseAsync(resourceGroupName, serviceName, apiId, issueId, parameters, ifMatch).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates an existing issue for an API. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API identifier. Must be unique in the current API Management service instance. + * @param issueId Issue identifier. Must be unique in the current API Management service instance. + * @param parameters Update parameters. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> updateWithServiceResponseAsync(String resourceGroupName, String serviceName, String apiId, String issueId, IssueUpdateContract parameters, String ifMatch) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (apiId == null) { + throw new IllegalArgumentException("Parameter apiId is required and cannot be null."); + } + if (issueId == null) { + throw new IllegalArgumentException("Parameter issueId is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + if (ifMatch == null) { + throw new IllegalArgumentException("Parameter ifMatch is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(parameters); + return service.update(resourceGroupName, serviceName, apiId, issueId, this.client.subscriptionId(), parameters, ifMatch, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = updateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse updateDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(204, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Deletes the specified Issue from an API. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API identifier. Must be unique in the current API Management service instance. + * @param issueId Issue identifier. Must be unique in the current API Management service instance. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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 serviceName, String apiId, String issueId, String ifMatch) { + deleteWithServiceResponseAsync(resourceGroupName, serviceName, apiId, issueId, ifMatch).toBlocking().single().body(); + } + + /** + * Deletes the specified Issue from an API. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API identifier. Must be unique in the current API Management service instance. + * @param issueId Issue identifier. Must be unique in the current API Management service instance. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @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 serviceName, String apiId, String issueId, String ifMatch, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, serviceName, apiId, issueId, ifMatch), serviceCallback); + } + + /** + * Deletes the specified Issue from an API. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API identifier. Must be unique in the current API Management service instance. + * @param issueId Issue identifier. Must be unique in the current API Management service instance. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable deleteAsync(String resourceGroupName, String serviceName, String apiId, String issueId, String ifMatch) { + return deleteWithServiceResponseAsync(resourceGroupName, serviceName, apiId, issueId, ifMatch).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes the specified Issue from an API. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API identifier. Must be unique in the current API Management service instance. + * @param issueId Issue identifier. Must be unique in the current API Management service instance. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> deleteWithServiceResponseAsync(String resourceGroupName, String serviceName, String apiId, String issueId, String ifMatch) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (apiId == null) { + throw new IllegalArgumentException("Parameter apiId is required and cannot be null."); + } + if (issueId == null) { + throw new IllegalArgumentException("Parameter issueId is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (ifMatch == null) { + throw new IllegalArgumentException("Parameter ifMatch 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.delete(resourceGroupName, serviceName, apiId, issueId, this.client.subscriptionId(), ifMatch, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = deleteDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse deleteDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(204, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists all issues associated with the specified API. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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<IssueContractInner> object if successful. + */ + public PagedList listByServiceNext(final String nextPageLink) { + ServiceResponse> response = listByServiceNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByServiceNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists all issues associated with the specified API. + * + * @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> listByServiceNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByServiceNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByServiceNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists all issues associated with the specified API. + * + * @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<IssueContractInner> object + */ + public Observable> listByServiceNextAsync(final String nextPageLink) { + return listByServiceNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all issues associated with the specified API. + * + * @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<IssueContractInner> object + */ + public Observable>> listByServiceNextWithServiceResponseAsync(final String nextPageLink) { + return listByServiceNextSinglePageAsync(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(listByServiceNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists all issues associated with the specified API. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<IssueContractInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByServiceNextSinglePageAsync(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.listByServiceNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByServiceNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByServiceNextDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ApiManagementClientImpl.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ApiManagementClientImpl.java new file mode 100644 index 0000000000000..bb60255cbbb40 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ApiManagementClientImpl.java @@ -0,0 +1,1036 @@ +/** + * 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.apimanagement.v2019_01_01.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 ApiManagementClientImpl class. + */ +public class ApiManagementClientImpl 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; + } + + /** Version of the API to be used with the client request. */ + private String apiVersion; + + /** + * Gets Version of the API to be used with the client request. + * + * @return the apiVersion value. + */ + public String apiVersion() { + return this.apiVersion; + } + + /** Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. */ + private String subscriptionId; + + /** + * Gets Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + * + * @return the subscriptionId value. + */ + public String subscriptionId() { + return this.subscriptionId; + } + + /** + * Sets Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + * + * @param subscriptionId the subscriptionId value. + * @return the service client itself + */ + public ApiManagementClientImpl withSubscriptionId(String subscriptionId) { + this.subscriptionId = subscriptionId; + return this; + } + + /** 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 ApiManagementClientImpl 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 ApiManagementClientImpl 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 ApiManagementClientImpl withGenerateClientRequestId(boolean generateClientRequestId) { + this.generateClientRequestId = generateClientRequestId; + return this; + } + + /** + * The ApisInner object to access its operations. + */ + private ApisInner apis; + + /** + * Gets the ApisInner object to access its operations. + * @return the ApisInner object. + */ + public ApisInner apis() { + return this.apis; + } + + /** + * The ApiRevisionsInner object to access its operations. + */ + private ApiRevisionsInner apiRevisions; + + /** + * Gets the ApiRevisionsInner object to access its operations. + * @return the ApiRevisionsInner object. + */ + public ApiRevisionsInner apiRevisions() { + return this.apiRevisions; + } + + /** + * The ApiReleasesInner object to access its operations. + */ + private ApiReleasesInner apiReleases; + + /** + * Gets the ApiReleasesInner object to access its operations. + * @return the ApiReleasesInner object. + */ + public ApiReleasesInner apiReleases() { + return this.apiReleases; + } + + /** + * The ApiOperationsInner object to access its operations. + */ + private ApiOperationsInner apiOperations; + + /** + * Gets the ApiOperationsInner object to access its operations. + * @return the ApiOperationsInner object. + */ + public ApiOperationsInner apiOperations() { + return this.apiOperations; + } + + /** + * The ApiOperationPolicysInner object to access its operations. + */ + private ApiOperationPolicysInner apiOperationPolicys; + + /** + * Gets the ApiOperationPolicysInner object to access its operations. + * @return the ApiOperationPolicysInner object. + */ + public ApiOperationPolicysInner apiOperationPolicys() { + return this.apiOperationPolicys; + } + + /** + * The TagsInner object to access its operations. + */ + private TagsInner tags; + + /** + * Gets the TagsInner object to access its operations. + * @return the TagsInner object. + */ + public TagsInner tags() { + return this.tags; + } + + /** + * The ApiProductsInner object to access its operations. + */ + private ApiProductsInner apiProducts; + + /** + * Gets the ApiProductsInner object to access its operations. + * @return the ApiProductsInner object. + */ + public ApiProductsInner apiProducts() { + return this.apiProducts; + } + + /** + * The ApiPolicysInner object to access its operations. + */ + private ApiPolicysInner apiPolicys; + + /** + * Gets the ApiPolicysInner object to access its operations. + * @return the ApiPolicysInner object. + */ + public ApiPolicysInner apiPolicys() { + return this.apiPolicys; + } + + /** + * The ApiSchemasInner object to access its operations. + */ + private ApiSchemasInner apiSchemas; + + /** + * Gets the ApiSchemasInner object to access its operations. + * @return the ApiSchemasInner object. + */ + public ApiSchemasInner apiSchemas() { + return this.apiSchemas; + } + + /** + * The ApiDiagnosticsInner object to access its operations. + */ + private ApiDiagnosticsInner apiDiagnostics; + + /** + * Gets the ApiDiagnosticsInner object to access its operations. + * @return the ApiDiagnosticsInner object. + */ + public ApiDiagnosticsInner apiDiagnostics() { + return this.apiDiagnostics; + } + + /** + * The ApiIssuesInner object to access its operations. + */ + private ApiIssuesInner apiIssues; + + /** + * Gets the ApiIssuesInner object to access its operations. + * @return the ApiIssuesInner object. + */ + public ApiIssuesInner apiIssues() { + return this.apiIssues; + } + + /** + * The ApiIssueCommentsInner object to access its operations. + */ + private ApiIssueCommentsInner apiIssueComments; + + /** + * Gets the ApiIssueCommentsInner object to access its operations. + * @return the ApiIssueCommentsInner object. + */ + public ApiIssueCommentsInner apiIssueComments() { + return this.apiIssueComments; + } + + /** + * The ApiIssueAttachmentsInner object to access its operations. + */ + private ApiIssueAttachmentsInner apiIssueAttachments; + + /** + * Gets the ApiIssueAttachmentsInner object to access its operations. + * @return the ApiIssueAttachmentsInner object. + */ + public ApiIssueAttachmentsInner apiIssueAttachments() { + return this.apiIssueAttachments; + } + + /** + * The ApiTagDescriptionsInner object to access its operations. + */ + private ApiTagDescriptionsInner apiTagDescriptions; + + /** + * Gets the ApiTagDescriptionsInner object to access its operations. + * @return the ApiTagDescriptionsInner object. + */ + public ApiTagDescriptionsInner apiTagDescriptions() { + return this.apiTagDescriptions; + } + + /** + * 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; + } + + /** + * The ApiVersionSetsInner object to access its operations. + */ + private ApiVersionSetsInner apiVersionSets; + + /** + * Gets the ApiVersionSetsInner object to access its operations. + * @return the ApiVersionSetsInner object. + */ + public ApiVersionSetsInner apiVersionSets() { + return this.apiVersionSets; + } + + /** + * The AuthorizationServersInner object to access its operations. + */ + private AuthorizationServersInner authorizationServers; + + /** + * Gets the AuthorizationServersInner object to access its operations. + * @return the AuthorizationServersInner object. + */ + public AuthorizationServersInner authorizationServers() { + return this.authorizationServers; + } + + /** + * The BackendsInner object to access its operations. + */ + private BackendsInner backends; + + /** + * Gets the BackendsInner object to access its operations. + * @return the BackendsInner object. + */ + public BackendsInner backends() { + return this.backends; + } + + /** + * The CachesInner object to access its operations. + */ + private CachesInner caches; + + /** + * Gets the CachesInner object to access its operations. + * @return the CachesInner object. + */ + public CachesInner caches() { + return this.caches; + } + + /** + * The CertificatesInner object to access its operations. + */ + private CertificatesInner certificates; + + /** + * Gets the CertificatesInner object to access its operations. + * @return the CertificatesInner object. + */ + public CertificatesInner certificates() { + return this.certificates; + } + + /** + * The ApiManagementOperationsInner object to access its operations. + */ + private ApiManagementOperationsInner apiManagementOperations; + + /** + * Gets the ApiManagementOperationsInner object to access its operations. + * @return the ApiManagementOperationsInner object. + */ + public ApiManagementOperationsInner apiManagementOperations() { + return this.apiManagementOperations; + } + + /** + * The ApiManagementServiceSkusInner object to access its operations. + */ + private ApiManagementServiceSkusInner apiManagementServiceSkus; + + /** + * Gets the ApiManagementServiceSkusInner object to access its operations. + * @return the ApiManagementServiceSkusInner object. + */ + public ApiManagementServiceSkusInner apiManagementServiceSkus() { + return this.apiManagementServiceSkus; + } + + /** + * The ApiManagementServicesInner object to access its operations. + */ + private ApiManagementServicesInner apiManagementServices; + + /** + * Gets the ApiManagementServicesInner object to access its operations. + * @return the ApiManagementServicesInner object. + */ + public ApiManagementServicesInner apiManagementServices() { + return this.apiManagementServices; + } + + /** + * The DiagnosticsInner object to access its operations. + */ + private DiagnosticsInner diagnostics; + + /** + * Gets the DiagnosticsInner object to access its operations. + * @return the DiagnosticsInner object. + */ + public DiagnosticsInner diagnostics() { + return this.diagnostics; + } + + /** + * The EmailTemplatesInner object to access its operations. + */ + private EmailTemplatesInner emailTemplates; + + /** + * Gets the EmailTemplatesInner object to access its operations. + * @return the EmailTemplatesInner object. + */ + public EmailTemplatesInner emailTemplates() { + return this.emailTemplates; + } + + /** + * The GroupsInner object to access its operations. + */ + private GroupsInner groups; + + /** + * Gets the GroupsInner object to access its operations. + * @return the GroupsInner object. + */ + public GroupsInner groups() { + return this.groups; + } + + /** + * The GroupUsersInner object to access its operations. + */ + private GroupUsersInner groupUsers; + + /** + * Gets the GroupUsersInner object to access its operations. + * @return the GroupUsersInner object. + */ + public GroupUsersInner groupUsers() { + return this.groupUsers; + } + + /** + * The IdentityProvidersInner object to access its operations. + */ + private IdentityProvidersInner identityProviders; + + /** + * Gets the IdentityProvidersInner object to access its operations. + * @return the IdentityProvidersInner object. + */ + public IdentityProvidersInner identityProviders() { + return this.identityProviders; + } + + /** + * The IssuesInner object to access its operations. + */ + private IssuesInner issues; + + /** + * Gets the IssuesInner object to access its operations. + * @return the IssuesInner object. + */ + public IssuesInner issues() { + return this.issues; + } + + /** + * The LoggersInner object to access its operations. + */ + private LoggersInner loggers; + + /** + * Gets the LoggersInner object to access its operations. + * @return the LoggersInner object. + */ + public LoggersInner loggers() { + return this.loggers; + } + + /** + * The NetworkStatusInner object to access its operations. + */ + private NetworkStatusInner networkStatus; + + /** + * Gets the NetworkStatusInner object to access its operations. + * @return the NetworkStatusInner object. + */ + public NetworkStatusInner networkStatus() { + return this.networkStatus; + } + + /** + * The NotificationsInner object to access its operations. + */ + private NotificationsInner notifications; + + /** + * Gets the NotificationsInner object to access its operations. + * @return the NotificationsInner object. + */ + public NotificationsInner notifications() { + return this.notifications; + } + + /** + * The NotificationRecipientUsersInner object to access its operations. + */ + private NotificationRecipientUsersInner notificationRecipientUsers; + + /** + * Gets the NotificationRecipientUsersInner object to access its operations. + * @return the NotificationRecipientUsersInner object. + */ + public NotificationRecipientUsersInner notificationRecipientUsers() { + return this.notificationRecipientUsers; + } + + /** + * The NotificationRecipientEmailsInner object to access its operations. + */ + private NotificationRecipientEmailsInner notificationRecipientEmails; + + /** + * Gets the NotificationRecipientEmailsInner object to access its operations. + * @return the NotificationRecipientEmailsInner object. + */ + public NotificationRecipientEmailsInner notificationRecipientEmails() { + return this.notificationRecipientEmails; + } + + /** + * The OpenIdConnectProvidersInner object to access its operations. + */ + private OpenIdConnectProvidersInner openIdConnectProviders; + + /** + * Gets the OpenIdConnectProvidersInner object to access its operations. + * @return the OpenIdConnectProvidersInner object. + */ + public OpenIdConnectProvidersInner openIdConnectProviders() { + return this.openIdConnectProviders; + } + + /** + * The PolicysInner object to access its operations. + */ + private PolicysInner policys; + + /** + * Gets the PolicysInner object to access its operations. + * @return the PolicysInner object. + */ + public PolicysInner policys() { + return this.policys; + } + + /** + * The PolicySnippetsInner object to access its operations. + */ + private PolicySnippetsInner policySnippets; + + /** + * Gets the PolicySnippetsInner object to access its operations. + * @return the PolicySnippetsInner object. + */ + public PolicySnippetsInner policySnippets() { + return this.policySnippets; + } + + /** + * The SignInSettingsInner object to access its operations. + */ + private SignInSettingsInner signInSettings; + + /** + * Gets the SignInSettingsInner object to access its operations. + * @return the SignInSettingsInner object. + */ + public SignInSettingsInner signInSettings() { + return this.signInSettings; + } + + /** + * The SignUpSettingsInner object to access its operations. + */ + private SignUpSettingsInner signUpSettings; + + /** + * Gets the SignUpSettingsInner object to access its operations. + * @return the SignUpSettingsInner object. + */ + public SignUpSettingsInner signUpSettings() { + return this.signUpSettings; + } + + /** + * The DelegationSettingsInner object to access its operations. + */ + private DelegationSettingsInner delegationSettings; + + /** + * Gets the DelegationSettingsInner object to access its operations. + * @return the DelegationSettingsInner object. + */ + public DelegationSettingsInner delegationSettings() { + return this.delegationSettings; + } + + /** + * The ProductsInner object to access its operations. + */ + private ProductsInner products; + + /** + * Gets the ProductsInner object to access its operations. + * @return the ProductsInner object. + */ + public ProductsInner products() { + return this.products; + } + + /** + * The ProductApisInner object to access its operations. + */ + private ProductApisInner productApis; + + /** + * Gets the ProductApisInner object to access its operations. + * @return the ProductApisInner object. + */ + public ProductApisInner productApis() { + return this.productApis; + } + + /** + * The ProductGroupsInner object to access its operations. + */ + private ProductGroupsInner productGroups; + + /** + * Gets the ProductGroupsInner object to access its operations. + * @return the ProductGroupsInner object. + */ + public ProductGroupsInner productGroups() { + return this.productGroups; + } + + /** + * The ProductSubscriptionsInner object to access its operations. + */ + private ProductSubscriptionsInner productSubscriptions; + + /** + * Gets the ProductSubscriptionsInner object to access its operations. + * @return the ProductSubscriptionsInner object. + */ + public ProductSubscriptionsInner productSubscriptions() { + return this.productSubscriptions; + } + + /** + * The ProductPolicysInner object to access its operations. + */ + private ProductPolicysInner productPolicys; + + /** + * Gets the ProductPolicysInner object to access its operations. + * @return the ProductPolicysInner object. + */ + public ProductPolicysInner productPolicys() { + return this.productPolicys; + } + + /** + * The PropertysInner object to access its operations. + */ + private PropertysInner propertys; + + /** + * Gets the PropertysInner object to access its operations. + * @return the PropertysInner object. + */ + public PropertysInner propertys() { + return this.propertys; + } + + /** + * The QuotaByCounterKeysInner object to access its operations. + */ + private QuotaByCounterKeysInner quotaByCounterKeys; + + /** + * Gets the QuotaByCounterKeysInner object to access its operations. + * @return the QuotaByCounterKeysInner object. + */ + public QuotaByCounterKeysInner quotaByCounterKeys() { + return this.quotaByCounterKeys; + } + + /** + * The QuotaByPeriodKeysInner object to access its operations. + */ + private QuotaByPeriodKeysInner quotaByPeriodKeys; + + /** + * Gets the QuotaByPeriodKeysInner object to access its operations. + * @return the QuotaByPeriodKeysInner object. + */ + public QuotaByPeriodKeysInner quotaByPeriodKeys() { + return this.quotaByPeriodKeys; + } + + /** + * The RegionsInner object to access its operations. + */ + private RegionsInner regions; + + /** + * Gets the RegionsInner object to access its operations. + * @return the RegionsInner object. + */ + public RegionsInner regions() { + return this.regions; + } + + /** + * The ReportsInner object to access its operations. + */ + private ReportsInner reports; + + /** + * Gets the ReportsInner object to access its operations. + * @return the ReportsInner object. + */ + public ReportsInner reports() { + return this.reports; + } + + /** + * The SubscriptionsInner object to access its operations. + */ + private SubscriptionsInner subscriptions; + + /** + * Gets the SubscriptionsInner object to access its operations. + * @return the SubscriptionsInner object. + */ + public SubscriptionsInner subscriptions() { + return this.subscriptions; + } + + /** + * The TagResourcesInner object to access its operations. + */ + private TagResourcesInner tagResources; + + /** + * Gets the TagResourcesInner object to access its operations. + * @return the TagResourcesInner object. + */ + public TagResourcesInner tagResources() { + return this.tagResources; + } + + /** + * The TenantAccessInner object to access its operations. + */ + private TenantAccessInner tenantAccess; + + /** + * Gets the TenantAccessInner object to access its operations. + * @return the TenantAccessInner object. + */ + public TenantAccessInner tenantAccess() { + return this.tenantAccess; + } + + /** + * The TenantAccessGitsInner object to access its operations. + */ + private TenantAccessGitsInner tenantAccessGits; + + /** + * Gets the TenantAccessGitsInner object to access its operations. + * @return the TenantAccessGitsInner object. + */ + public TenantAccessGitsInner tenantAccessGits() { + return this.tenantAccessGits; + } + + /** + * The TenantConfigurationsInner object to access its operations. + */ + private TenantConfigurationsInner tenantConfigurations; + + /** + * Gets the TenantConfigurationsInner object to access its operations. + * @return the TenantConfigurationsInner object. + */ + public TenantConfigurationsInner tenantConfigurations() { + return this.tenantConfigurations; + } + + /** + * The UsersInner object to access its operations. + */ + private UsersInner users; + + /** + * Gets the UsersInner object to access its operations. + * @return the UsersInner object. + */ + public UsersInner users() { + return this.users; + } + + /** + * The UserGroupsInner object to access its operations. + */ + private UserGroupsInner userGroups; + + /** + * Gets the UserGroupsInner object to access its operations. + * @return the UserGroupsInner object. + */ + public UserGroupsInner userGroups() { + return this.userGroups; + } + + /** + * The UserSubscriptionsInner object to access its operations. + */ + private UserSubscriptionsInner userSubscriptions; + + /** + * Gets the UserSubscriptionsInner object to access its operations. + * @return the UserSubscriptionsInner object. + */ + public UserSubscriptionsInner userSubscriptions() { + return this.userSubscriptions; + } + + /** + * The UserIdentitiesInner object to access its operations. + */ + private UserIdentitiesInner userIdentities; + + /** + * Gets the UserIdentitiesInner object to access its operations. + * @return the UserIdentitiesInner object. + */ + public UserIdentitiesInner userIdentities() { + return this.userIdentities; + } + + /** + * The UserConfirmationPasswordsInner object to access its operations. + */ + private UserConfirmationPasswordsInner userConfirmationPasswords; + + /** + * Gets the UserConfirmationPasswordsInner object to access its operations. + * @return the UserConfirmationPasswordsInner object. + */ + public UserConfirmationPasswordsInner userConfirmationPasswords() { + return this.userConfirmationPasswords; + } + + /** + * The ApiExportsInner object to access its operations. + */ + private ApiExportsInner apiExports; + + /** + * Gets the ApiExportsInner object to access its operations. + * @return the ApiExportsInner object. + */ + public ApiExportsInner apiExports() { + return this.apiExports; + } + + /** + * Initializes an instance of ApiManagementClient client. + * + * @param credentials the management credentials for Azure + */ + public ApiManagementClientImpl(ServiceClientCredentials credentials) { + this("https://management.azure.com", credentials); + } + + /** + * Initializes an instance of ApiManagementClient client. + * + * @param baseUrl the base URL of the host + * @param credentials the management credentials for Azure + */ + public ApiManagementClientImpl(String baseUrl, ServiceClientCredentials credentials) { + super(baseUrl, credentials); + initialize(); + } + + /** + * Initializes an instance of ApiManagementClient client. + * + * @param restClient the REST client to connect to Azure. + */ + public ApiManagementClientImpl(RestClient restClient) { + super(restClient); + initialize(); + } + + protected void initialize() { + this.apiVersion = "2019-01-01"; + this.acceptLanguage = "en-US"; + this.longRunningOperationRetryTimeout = 30; + this.generateClientRequestId = true; + this.apis = new ApisInner(restClient().retrofit(), this); + this.apiRevisions = new ApiRevisionsInner(restClient().retrofit(), this); + this.apiReleases = new ApiReleasesInner(restClient().retrofit(), this); + this.apiOperations = new ApiOperationsInner(restClient().retrofit(), this); + this.apiOperationPolicys = new ApiOperationPolicysInner(restClient().retrofit(), this); + this.tags = new TagsInner(restClient().retrofit(), this); + this.apiProducts = new ApiProductsInner(restClient().retrofit(), this); + this.apiPolicys = new ApiPolicysInner(restClient().retrofit(), this); + this.apiSchemas = new ApiSchemasInner(restClient().retrofit(), this); + this.apiDiagnostics = new ApiDiagnosticsInner(restClient().retrofit(), this); + this.apiIssues = new ApiIssuesInner(restClient().retrofit(), this); + this.apiIssueComments = new ApiIssueCommentsInner(restClient().retrofit(), this); + this.apiIssueAttachments = new ApiIssueAttachmentsInner(restClient().retrofit(), this); + this.apiTagDescriptions = new ApiTagDescriptionsInner(restClient().retrofit(), this); + this.operations = new OperationsInner(restClient().retrofit(), this); + this.apiVersionSets = new ApiVersionSetsInner(restClient().retrofit(), this); + this.authorizationServers = new AuthorizationServersInner(restClient().retrofit(), this); + this.backends = new BackendsInner(restClient().retrofit(), this); + this.caches = new CachesInner(restClient().retrofit(), this); + this.certificates = new CertificatesInner(restClient().retrofit(), this); + this.apiManagementOperations = new ApiManagementOperationsInner(restClient().retrofit(), this); + this.apiManagementServiceSkus = new ApiManagementServiceSkusInner(restClient().retrofit(), this); + this.apiManagementServices = new ApiManagementServicesInner(restClient().retrofit(), this); + this.diagnostics = new DiagnosticsInner(restClient().retrofit(), this); + this.emailTemplates = new EmailTemplatesInner(restClient().retrofit(), this); + this.groups = new GroupsInner(restClient().retrofit(), this); + this.groupUsers = new GroupUsersInner(restClient().retrofit(), this); + this.identityProviders = new IdentityProvidersInner(restClient().retrofit(), this); + this.issues = new IssuesInner(restClient().retrofit(), this); + this.loggers = new LoggersInner(restClient().retrofit(), this); + this.networkStatus = new NetworkStatusInner(restClient().retrofit(), this); + this.notifications = new NotificationsInner(restClient().retrofit(), this); + this.notificationRecipientUsers = new NotificationRecipientUsersInner(restClient().retrofit(), this); + this.notificationRecipientEmails = new NotificationRecipientEmailsInner(restClient().retrofit(), this); + this.openIdConnectProviders = new OpenIdConnectProvidersInner(restClient().retrofit(), this); + this.policys = new PolicysInner(restClient().retrofit(), this); + this.policySnippets = new PolicySnippetsInner(restClient().retrofit(), this); + this.signInSettings = new SignInSettingsInner(restClient().retrofit(), this); + this.signUpSettings = new SignUpSettingsInner(restClient().retrofit(), this); + this.delegationSettings = new DelegationSettingsInner(restClient().retrofit(), this); + this.products = new ProductsInner(restClient().retrofit(), this); + this.productApis = new ProductApisInner(restClient().retrofit(), this); + this.productGroups = new ProductGroupsInner(restClient().retrofit(), this); + this.productSubscriptions = new ProductSubscriptionsInner(restClient().retrofit(), this); + this.productPolicys = new ProductPolicysInner(restClient().retrofit(), this); + this.propertys = new PropertysInner(restClient().retrofit(), this); + this.quotaByCounterKeys = new QuotaByCounterKeysInner(restClient().retrofit(), this); + this.quotaByPeriodKeys = new QuotaByPeriodKeysInner(restClient().retrofit(), this); + this.regions = new RegionsInner(restClient().retrofit(), this); + this.reports = new ReportsInner(restClient().retrofit(), this); + this.subscriptions = new SubscriptionsInner(restClient().retrofit(), this); + this.tagResources = new TagResourcesInner(restClient().retrofit(), this); + this.tenantAccess = new TenantAccessInner(restClient().retrofit(), this); + this.tenantAccessGits = new TenantAccessGitsInner(restClient().retrofit(), this); + this.tenantConfigurations = new TenantConfigurationsInner(restClient().retrofit(), this); + this.users = new UsersInner(restClient().retrofit(), this); + this.userGroups = new UserGroupsInner(restClient().retrofit(), this); + this.userSubscriptions = new UserSubscriptionsInner(restClient().retrofit(), this); + this.userIdentities = new UserIdentitiesInner(restClient().retrofit(), this); + this.userConfirmationPasswords = new UserConfirmationPasswordsInner(restClient().retrofit(), this); + this.apiExports = new ApiExportsInner(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(), "ApiManagementClient", "2019-01-01"); + } +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ApiManagementManager.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ApiManagementManager.java new file mode 100644 index 0000000000000..d281f6bba1d2f --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ApiManagementManager.java @@ -0,0 +1,819 @@ +/** + * 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.apimanagement.v2019_01_01.implementation; + +import com.microsoft.azure.AzureEnvironment; +import com.microsoft.azure.AzureResponseBuilder; +import com.microsoft.azure.credentials.AzureTokenCredentials; +import com.microsoft.azure.management.apigeneration.Beta; +import com.microsoft.azure.management.apigeneration.Beta.SinceVersion; +import com.microsoft.azure.arm.resources.AzureConfigurable; +import com.microsoft.azure.serializer.AzureJacksonAdapter; +import com.microsoft.rest.RestClient; +import com.microsoft.azure.management.apimanagement.v2019_01_01.Apis; +import com.microsoft.azure.management.apimanagement.v2019_01_01.ApiRevisions; +import com.microsoft.azure.management.apimanagement.v2019_01_01.ApiReleases; +import com.microsoft.azure.management.apimanagement.v2019_01_01.ApiOperations; +import com.microsoft.azure.management.apimanagement.v2019_01_01.ApiOperationPolicys; +import com.microsoft.azure.management.apimanagement.v2019_01_01.Tags; +import com.microsoft.azure.management.apimanagement.v2019_01_01.ApiProducts; +import com.microsoft.azure.management.apimanagement.v2019_01_01.ApiPolicys; +import com.microsoft.azure.management.apimanagement.v2019_01_01.ApiSchemas; +import com.microsoft.azure.management.apimanagement.v2019_01_01.ApiDiagnostics; +import com.microsoft.azure.management.apimanagement.v2019_01_01.ApiIssues; +import com.microsoft.azure.management.apimanagement.v2019_01_01.ApiIssueComments; +import com.microsoft.azure.management.apimanagement.v2019_01_01.ApiIssueAttachments; +import com.microsoft.azure.management.apimanagement.v2019_01_01.ApiTagDescriptions; +import com.microsoft.azure.management.apimanagement.v2019_01_01.Operations; +import com.microsoft.azure.management.apimanagement.v2019_01_01.ApiVersionSets; +import com.microsoft.azure.management.apimanagement.v2019_01_01.AuthorizationServers; +import com.microsoft.azure.management.apimanagement.v2019_01_01.Backends; +import com.microsoft.azure.management.apimanagement.v2019_01_01.Caches; +import com.microsoft.azure.management.apimanagement.v2019_01_01.Certificates; +import com.microsoft.azure.management.apimanagement.v2019_01_01.ApiManagementOperations; +import com.microsoft.azure.management.apimanagement.v2019_01_01.ApiManagementServiceSkus; +import com.microsoft.azure.management.apimanagement.v2019_01_01.ApiManagementServices; +import com.microsoft.azure.management.apimanagement.v2019_01_01.Diagnostics; +import com.microsoft.azure.management.apimanagement.v2019_01_01.EmailTemplates; +import com.microsoft.azure.management.apimanagement.v2019_01_01.Groups; +import com.microsoft.azure.management.apimanagement.v2019_01_01.GroupUsers; +import com.microsoft.azure.management.apimanagement.v2019_01_01.IdentityProviders; +import com.microsoft.azure.management.apimanagement.v2019_01_01.Issues; +import com.microsoft.azure.management.apimanagement.v2019_01_01.Loggers; +import com.microsoft.azure.management.apimanagement.v2019_01_01.NetworkStatus; +import com.microsoft.azure.management.apimanagement.v2019_01_01.Notifications; +import com.microsoft.azure.management.apimanagement.v2019_01_01.NotificationRecipientUsers; +import com.microsoft.azure.management.apimanagement.v2019_01_01.NotificationRecipientEmails; +import com.microsoft.azure.management.apimanagement.v2019_01_01.OpenIdConnectProviders; +import com.microsoft.azure.management.apimanagement.v2019_01_01.Policys; +import com.microsoft.azure.management.apimanagement.v2019_01_01.PolicySnippets; +import com.microsoft.azure.management.apimanagement.v2019_01_01.SignInSettings; +import com.microsoft.azure.management.apimanagement.v2019_01_01.SignUpSettings; +import com.microsoft.azure.management.apimanagement.v2019_01_01.DelegationSettings; +import com.microsoft.azure.management.apimanagement.v2019_01_01.Products; +import com.microsoft.azure.management.apimanagement.v2019_01_01.ProductApis; +import com.microsoft.azure.management.apimanagement.v2019_01_01.ProductGroups; +import com.microsoft.azure.management.apimanagement.v2019_01_01.ProductSubscriptions; +import com.microsoft.azure.management.apimanagement.v2019_01_01.ProductPolicys; +import com.microsoft.azure.management.apimanagement.v2019_01_01.Propertys; +import com.microsoft.azure.management.apimanagement.v2019_01_01.QuotaByCounterKeys; +import com.microsoft.azure.management.apimanagement.v2019_01_01.QuotaByPeriodKeys; +import com.microsoft.azure.management.apimanagement.v2019_01_01.Regions; +import com.microsoft.azure.management.apimanagement.v2019_01_01.Reports; +import com.microsoft.azure.management.apimanagement.v2019_01_01.Subscriptions; +import com.microsoft.azure.management.apimanagement.v2019_01_01.TagResources; +import com.microsoft.azure.management.apimanagement.v2019_01_01.TenantAccess; +import com.microsoft.azure.management.apimanagement.v2019_01_01.TenantAccessGits; +import com.microsoft.azure.management.apimanagement.v2019_01_01.TenantConfigurations; +import com.microsoft.azure.management.apimanagement.v2019_01_01.Users; +import com.microsoft.azure.management.apimanagement.v2019_01_01.UserGroups; +import com.microsoft.azure.management.apimanagement.v2019_01_01.UserSubscriptions; +import com.microsoft.azure.management.apimanagement.v2019_01_01.UserIdentities; +import com.microsoft.azure.management.apimanagement.v2019_01_01.UserConfirmationPasswords; +import com.microsoft.azure.management.apimanagement.v2019_01_01.ApiExports; +import com.microsoft.azure.arm.resources.implementation.AzureConfigurableCoreImpl; +import com.microsoft.azure.arm.resources.implementation.ManagerCore; + +/** + * Entry point to Azure ApiManagement resource management. + */ +public final class ApiManagementManager extends ManagerCore { + private Apis apis; + private ApiRevisions apiRevisions; + private ApiReleases apiReleases; + private ApiOperations apiOperations; + private ApiOperationPolicys apiOperationPolicys; + private Tags tags; + private ApiProducts apiProducts; + private ApiPolicys apiPolicys; + private ApiSchemas apiSchemas; + private ApiDiagnostics apiDiagnostics; + private ApiIssues apiIssues; + private ApiIssueComments apiIssueComments; + private ApiIssueAttachments apiIssueAttachments; + private ApiTagDescriptions apiTagDescriptions; + private Operations operations; + private ApiVersionSets apiVersionSets; + private AuthorizationServers authorizationServers; + private Backends backends; + private Caches caches; + private Certificates certificates; + private ApiManagementOperations apiManagementOperations; + private ApiManagementServiceSkus apiManagementServiceSkus; + private ApiManagementServices apiManagementServices; + private Diagnostics diagnostics; + private EmailTemplates emailTemplates; + private Groups groups; + private GroupUsers groupUsers; + private IdentityProviders identityProviders; + private Issues issues; + private Loggers loggers; + private NetworkStatus networkStatus; + private Notifications notifications; + private NotificationRecipientUsers notificationRecipientUsers; + private NotificationRecipientEmails notificationRecipientEmails; + private OpenIdConnectProviders openIdConnectProviders; + private Policys policys; + private PolicySnippets policySnippets; + private SignInSettings signInSettings; + private SignUpSettings signUpSettings; + private DelegationSettings delegationSettings; + private Products products; + private ProductApis productApis; + private ProductGroups productGroups; + private ProductSubscriptions productSubscriptions; + private ProductPolicys productPolicys; + private Propertys propertys; + private QuotaByCounterKeys quotaByCounterKeys; + private QuotaByPeriodKeys quotaByPeriodKeys; + private Regions regions; + private Reports reports; + private Subscriptions subscriptions; + private TagResources tagResources; + private TenantAccess tenantAccess; + private TenantAccessGits tenantAccessGits; + private TenantConfigurations tenantConfigurations; + private Users users; + private UserGroups userGroups; + private UserSubscriptions userSubscriptions; + private UserIdentities userIdentities; + private UserConfirmationPasswords userConfirmationPasswords; + private ApiExports apiExports; + /** + * Get a Configurable instance that can be used to create ApiManagementManager with optional configuration. + * + * @return the instance allowing configurations + */ + public static Configurable configure() { + return new ApiManagementManager.ConfigurableImpl(); + } + /** + * Creates an instance of ApiManagementManager that exposes ApiManagement resource management API entry points. + * + * @param credentials the credentials to use + * @param subscriptionId the subscription UUID + * @return the ApiManagementManager + */ + public static ApiManagementManager authenticate(AzureTokenCredentials credentials, String subscriptionId) { + return new ApiManagementManager(new RestClient.Builder() + .withBaseUrl(credentials.environment(), AzureEnvironment.Endpoint.RESOURCE_MANAGER) + .withCredentials(credentials) + .withSerializerAdapter(new AzureJacksonAdapter()) + .withResponseBuilderFactory(new AzureResponseBuilder.Factory()) + .build(), subscriptionId); + } + /** + * Creates an instance of ApiManagementManager that exposes ApiManagement resource management API entry points. + * + * @param restClient the RestClient to be used for API calls. + * @param subscriptionId the subscription UUID + * @return the ApiManagementManager + */ + public static ApiManagementManager authenticate(RestClient restClient, String subscriptionId) { + return new ApiManagementManager(restClient, subscriptionId); + } + /** + * The interface allowing configurations to be set. + */ + public interface Configurable extends AzureConfigurable { + /** + * Creates an instance of ApiManagementManager that exposes ApiManagement management API entry points. + * + * @param credentials the credentials to use + * @param subscriptionId the subscription UUID + * @return the interface exposing ApiManagement management API entry points that work across subscriptions + */ + ApiManagementManager authenticate(AzureTokenCredentials credentials, String subscriptionId); + } + + /** + * @return Entry point to manage Apis. + */ + public Apis apis() { + if (this.apis == null) { + this.apis = new ApisImpl(this); + } + return this.apis; + } + + /** + * @return Entry point to manage ApiRevisions. + */ + public ApiRevisions apiRevisions() { + if (this.apiRevisions == null) { + this.apiRevisions = new ApiRevisionsImpl(this); + } + return this.apiRevisions; + } + + /** + * @return Entry point to manage ApiReleases. + */ + public ApiReleases apiReleases() { + if (this.apiReleases == null) { + this.apiReleases = new ApiReleasesImpl(this); + } + return this.apiReleases; + } + + /** + * @return Entry point to manage ApiOperations. + */ + public ApiOperations apiOperations() { + if (this.apiOperations == null) { + this.apiOperations = new ApiOperationsImpl(this); + } + return this.apiOperations; + } + + /** + * @return Entry point to manage ApiOperationPolicys. + */ + public ApiOperationPolicys apiOperationPolicys() { + if (this.apiOperationPolicys == null) { + this.apiOperationPolicys = new ApiOperationPolicysImpl(this); + } + return this.apiOperationPolicys; + } + + /** + * @return Entry point to manage Tags. + */ + public Tags tags() { + if (this.tags == null) { + this.tags = new TagsImpl(this); + } + return this.tags; + } + + /** + * @return Entry point to manage ApiProducts. + */ + public ApiProducts apiProducts() { + if (this.apiProducts == null) { + this.apiProducts = new ApiProductsImpl(this); + } + return this.apiProducts; + } + + /** + * @return Entry point to manage ApiPolicys. + */ + public ApiPolicys apiPolicys() { + if (this.apiPolicys == null) { + this.apiPolicys = new ApiPolicysImpl(this); + } + return this.apiPolicys; + } + + /** + * @return Entry point to manage ApiSchemas. + */ + public ApiSchemas apiSchemas() { + if (this.apiSchemas == null) { + this.apiSchemas = new ApiSchemasImpl(this); + } + return this.apiSchemas; + } + + /** + * @return Entry point to manage ApiDiagnostics. + */ + public ApiDiagnostics apiDiagnostics() { + if (this.apiDiagnostics == null) { + this.apiDiagnostics = new ApiDiagnosticsImpl(this); + } + return this.apiDiagnostics; + } + + /** + * @return Entry point to manage ApiIssues. + */ + public ApiIssues apiIssues() { + if (this.apiIssues == null) { + this.apiIssues = new ApiIssuesImpl(this); + } + return this.apiIssues; + } + + /** + * @return Entry point to manage ApiIssueComments. + */ + public ApiIssueComments apiIssueComments() { + if (this.apiIssueComments == null) { + this.apiIssueComments = new ApiIssueCommentsImpl(this); + } + return this.apiIssueComments; + } + + /** + * @return Entry point to manage ApiIssueAttachments. + */ + public ApiIssueAttachments apiIssueAttachments() { + if (this.apiIssueAttachments == null) { + this.apiIssueAttachments = new ApiIssueAttachmentsImpl(this); + } + return this.apiIssueAttachments; + } + + /** + * @return Entry point to manage ApiTagDescriptions. + */ + public ApiTagDescriptions apiTagDescriptions() { + if (this.apiTagDescriptions == null) { + this.apiTagDescriptions = new ApiTagDescriptionsImpl(this); + } + return this.apiTagDescriptions; + } + + /** + * @return Entry point to manage Operations. + */ + public Operations operations() { + if (this.operations == null) { + this.operations = new OperationsImpl(this); + } + return this.operations; + } + + /** + * @return Entry point to manage ApiVersionSets. + */ + public ApiVersionSets apiVersionSets() { + if (this.apiVersionSets == null) { + this.apiVersionSets = new ApiVersionSetsImpl(this); + } + return this.apiVersionSets; + } + + /** + * @return Entry point to manage AuthorizationServers. + */ + public AuthorizationServers authorizationServers() { + if (this.authorizationServers == null) { + this.authorizationServers = new AuthorizationServersImpl(this); + } + return this.authorizationServers; + } + + /** + * @return Entry point to manage Backends. + */ + public Backends backends() { + if (this.backends == null) { + this.backends = new BackendsImpl(this); + } + return this.backends; + } + + /** + * @return Entry point to manage Caches. + */ + public Caches caches() { + if (this.caches == null) { + this.caches = new CachesImpl(this); + } + return this.caches; + } + + /** + * @return Entry point to manage Certificates. + */ + public Certificates certificates() { + if (this.certificates == null) { + this.certificates = new CertificatesImpl(this); + } + return this.certificates; + } + + /** + * @return Entry point to manage ApiManagementOperations. + */ + public ApiManagementOperations apiManagementOperations() { + if (this.apiManagementOperations == null) { + this.apiManagementOperations = new ApiManagementOperationsImpl(this); + } + return this.apiManagementOperations; + } + + /** + * @return Entry point to manage ApiManagementServiceSkus. + */ + public ApiManagementServiceSkus apiManagementServiceSkus() { + if (this.apiManagementServiceSkus == null) { + this.apiManagementServiceSkus = new ApiManagementServiceSkusImpl(this); + } + return this.apiManagementServiceSkus; + } + + /** + * @return Entry point to manage ApiManagementServices. + */ + public ApiManagementServices apiManagementServices() { + if (this.apiManagementServices == null) { + this.apiManagementServices = new ApiManagementServicesImpl(this); + } + return this.apiManagementServices; + } + + /** + * @return Entry point to manage Diagnostics. + */ + public Diagnostics diagnostics() { + if (this.diagnostics == null) { + this.diagnostics = new DiagnosticsImpl(this); + } + return this.diagnostics; + } + + /** + * @return Entry point to manage EmailTemplates. + */ + public EmailTemplates emailTemplates() { + if (this.emailTemplates == null) { + this.emailTemplates = new EmailTemplatesImpl(this); + } + return this.emailTemplates; + } + + /** + * @return Entry point to manage Groups. + */ + public Groups groups() { + if (this.groups == null) { + this.groups = new GroupsImpl(this); + } + return this.groups; + } + + /** + * @return Entry point to manage GroupUsers. + */ + public GroupUsers groupUsers() { + if (this.groupUsers == null) { + this.groupUsers = new GroupUsersImpl(this); + } + return this.groupUsers; + } + + /** + * @return Entry point to manage IdentityProviders. + */ + public IdentityProviders identityProviders() { + if (this.identityProviders == null) { + this.identityProviders = new IdentityProvidersImpl(this); + } + return this.identityProviders; + } + + /** + * @return Entry point to manage Issues. + */ + public Issues issues() { + if (this.issues == null) { + this.issues = new IssuesImpl(this); + } + return this.issues; + } + + /** + * @return Entry point to manage Loggers. + */ + public Loggers loggers() { + if (this.loggers == null) { + this.loggers = new LoggersImpl(this); + } + return this.loggers; + } + + /** + * @return Entry point to manage NetworkStatus. + */ + public NetworkStatus networkStatus() { + if (this.networkStatus == null) { + this.networkStatus = new NetworkStatusImpl(this); + } + return this.networkStatus; + } + + /** + * @return Entry point to manage Notifications. + */ + public Notifications notifications() { + if (this.notifications == null) { + this.notifications = new NotificationsImpl(this); + } + return this.notifications; + } + + /** + * @return Entry point to manage NotificationRecipientUsers. + */ + public NotificationRecipientUsers notificationRecipientUsers() { + if (this.notificationRecipientUsers == null) { + this.notificationRecipientUsers = new NotificationRecipientUsersImpl(this); + } + return this.notificationRecipientUsers; + } + + /** + * @return Entry point to manage NotificationRecipientEmails. + */ + public NotificationRecipientEmails notificationRecipientEmails() { + if (this.notificationRecipientEmails == null) { + this.notificationRecipientEmails = new NotificationRecipientEmailsImpl(this); + } + return this.notificationRecipientEmails; + } + + /** + * @return Entry point to manage OpenIdConnectProviders. + */ + public OpenIdConnectProviders openIdConnectProviders() { + if (this.openIdConnectProviders == null) { + this.openIdConnectProviders = new OpenIdConnectProvidersImpl(this); + } + return this.openIdConnectProviders; + } + + /** + * @return Entry point to manage Policys. + */ + public Policys policys() { + if (this.policys == null) { + this.policys = new PolicysImpl(this); + } + return this.policys; + } + + /** + * @return Entry point to manage PolicySnippets. + */ + public PolicySnippets policySnippets() { + if (this.policySnippets == null) { + this.policySnippets = new PolicySnippetsImpl(this); + } + return this.policySnippets; + } + + /** + * @return Entry point to manage SignInSettings. + */ + public SignInSettings signInSettings() { + if (this.signInSettings == null) { + this.signInSettings = new SignInSettingsImpl(this); + } + return this.signInSettings; + } + + /** + * @return Entry point to manage SignUpSettings. + */ + public SignUpSettings signUpSettings() { + if (this.signUpSettings == null) { + this.signUpSettings = new SignUpSettingsImpl(this); + } + return this.signUpSettings; + } + + /** + * @return Entry point to manage DelegationSettings. + */ + public DelegationSettings delegationSettings() { + if (this.delegationSettings == null) { + this.delegationSettings = new DelegationSettingsImpl(this); + } + return this.delegationSettings; + } + + /** + * @return Entry point to manage Products. + */ + public Products products() { + if (this.products == null) { + this.products = new ProductsImpl(this); + } + return this.products; + } + + /** + * @return Entry point to manage ProductApis. + */ + public ProductApis productApis() { + if (this.productApis == null) { + this.productApis = new ProductApisImpl(this); + } + return this.productApis; + } + + /** + * @return Entry point to manage ProductGroups. + */ + public ProductGroups productGroups() { + if (this.productGroups == null) { + this.productGroups = new ProductGroupsImpl(this); + } + return this.productGroups; + } + + /** + * @return Entry point to manage ProductSubscriptions. + */ + public ProductSubscriptions productSubscriptions() { + if (this.productSubscriptions == null) { + this.productSubscriptions = new ProductSubscriptionsImpl(this); + } + return this.productSubscriptions; + } + + /** + * @return Entry point to manage ProductPolicys. + */ + public ProductPolicys productPolicys() { + if (this.productPolicys == null) { + this.productPolicys = new ProductPolicysImpl(this); + } + return this.productPolicys; + } + + /** + * @return Entry point to manage Propertys. + */ + public Propertys propertys() { + if (this.propertys == null) { + this.propertys = new PropertysImpl(this); + } + return this.propertys; + } + + /** + * @return Entry point to manage QuotaByCounterKeys. + */ + public QuotaByCounterKeys quotaByCounterKeys() { + if (this.quotaByCounterKeys == null) { + this.quotaByCounterKeys = new QuotaByCounterKeysImpl(this); + } + return this.quotaByCounterKeys; + } + + /** + * @return Entry point to manage QuotaByPeriodKeys. + */ + public QuotaByPeriodKeys quotaByPeriodKeys() { + if (this.quotaByPeriodKeys == null) { + this.quotaByPeriodKeys = new QuotaByPeriodKeysImpl(this); + } + return this.quotaByPeriodKeys; + } + + /** + * @return Entry point to manage Regions. + */ + public Regions regions() { + if (this.regions == null) { + this.regions = new RegionsImpl(this); + } + return this.regions; + } + + /** + * @return Entry point to manage Reports. + */ + public Reports reports() { + if (this.reports == null) { + this.reports = new ReportsImpl(this); + } + return this.reports; + } + + /** + * @return Entry point to manage Subscriptions. + */ + public Subscriptions subscriptions() { + if (this.subscriptions == null) { + this.subscriptions = new SubscriptionsImpl(this); + } + return this.subscriptions; + } + + /** + * @return Entry point to manage TagResources. + */ + public TagResources tagResources() { + if (this.tagResources == null) { + this.tagResources = new TagResourcesImpl(this); + } + return this.tagResources; + } + + /** + * @return Entry point to manage TenantAccess. + */ + public TenantAccess tenantAccess() { + if (this.tenantAccess == null) { + this.tenantAccess = new TenantAccessImpl(this); + } + return this.tenantAccess; + } + + /** + * @return Entry point to manage TenantAccessGits. + */ + public TenantAccessGits tenantAccessGits() { + if (this.tenantAccessGits == null) { + this.tenantAccessGits = new TenantAccessGitsImpl(this); + } + return this.tenantAccessGits; + } + + /** + * @return Entry point to manage TenantConfigurations. + */ + public TenantConfigurations tenantConfigurations() { + if (this.tenantConfigurations == null) { + this.tenantConfigurations = new TenantConfigurationsImpl(this); + } + return this.tenantConfigurations; + } + + /** + * @return Entry point to manage Users. + */ + public Users users() { + if (this.users == null) { + this.users = new UsersImpl(this); + } + return this.users; + } + + /** + * @return Entry point to manage UserGroups. + */ + public UserGroups userGroups() { + if (this.userGroups == null) { + this.userGroups = new UserGroupsImpl(this); + } + return this.userGroups; + } + + /** + * @return Entry point to manage UserSubscriptions. + */ + public UserSubscriptions userSubscriptions() { + if (this.userSubscriptions == null) { + this.userSubscriptions = new UserSubscriptionsImpl(this); + } + return this.userSubscriptions; + } + + /** + * @return Entry point to manage UserIdentities. + */ + public UserIdentities userIdentities() { + if (this.userIdentities == null) { + this.userIdentities = new UserIdentitiesImpl(this); + } + return this.userIdentities; + } + + /** + * @return Entry point to manage UserConfirmationPasswords. + */ + public UserConfirmationPasswords userConfirmationPasswords() { + if (this.userConfirmationPasswords == null) { + this.userConfirmationPasswords = new UserConfirmationPasswordsImpl(this); + } + return this.userConfirmationPasswords; + } + + /** + * @return Entry point to manage ApiExports. + */ + public ApiExports apiExports() { + if (this.apiExports == null) { + this.apiExports = new ApiExportsImpl(this); + } + return this.apiExports; + } + + /** + * The implementation for Configurable interface. + */ + private static final class ConfigurableImpl extends AzureConfigurableCoreImpl implements Configurable { + public ApiManagementManager authenticate(AzureTokenCredentials credentials, String subscriptionId) { + return ApiManagementManager.authenticate(buildRestClient(credentials), subscriptionId); + } + } + private ApiManagementManager(RestClient restClient, String subscriptionId) { + super( + restClient, + subscriptionId, + new ApiManagementClientImpl(restClient).withSubscriptionId(subscriptionId)); + } +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ApiManagementOperationsImpl.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ApiManagementOperationsImpl.java new file mode 100644 index 0000000000000..3411ac64b7e85 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ApiManagementOperationsImpl.java @@ -0,0 +1,49 @@ +/** + * 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. + * abc + */ + +package com.microsoft.azure.management.apimanagement.v2019_01_01.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.apimanagement.v2019_01_01.ApiManagementOperations; +import rx.functions.Func1; +import rx.Observable; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.apimanagement.v2019_01_01.Operation; + +class ApiManagementOperationsImpl extends WrapperImpl implements ApiManagementOperations { + private final ApiManagementManager manager; + + ApiManagementOperationsImpl(ApiManagementManager manager) { + super(manager.inner().apiManagementOperations()); + this.manager = manager; + } + + public ApiManagementManager manager() { + return this.manager; + } + + @Override + public Observable listAsync() { + ApiManagementOperationsInner client = this.inner(); + return client.listAsync() + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public Operation call(OperationInner inner) { + return new OperationImpl(inner, manager()); + } + }); + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ApiManagementOperationsInner.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ApiManagementOperationsInner.java new file mode 100644 index 0000000000000..0dd2ffa29bb9e --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ApiManagementOperationsInner.java @@ -0,0 +1,283 @@ +/** + * 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.apimanagement.v2019_01_01.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.CloudException; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +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 ApiManagementOperations. + */ +public class ApiManagementOperationsInner { + /** The Retrofit service to perform REST calls. */ + private ApiManagementOperationsService service; + /** The service client containing this operation class. */ + private ApiManagementClientImpl client; + + /** + * Initializes an instance of ApiManagementOperationsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public ApiManagementOperationsInner(Retrofit retrofit, ApiManagementClientImpl client) { + this.service = retrofit.create(ApiManagementOperationsService.class); + this.client = client; + } + + /** + * The interface defining all the services for ApiManagementOperations to be + * used by Retrofit to perform actually REST calls. + */ + interface ApiManagementOperationsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.apimanagement.v2019_01_01.ApiManagementOperations list" }) + @GET("providers/Microsoft.ApiManagement/operations") + Observable> list(@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.apimanagement.v2019_01_01.ApiManagementOperations listNext" }) + @GET + Observable> listNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Lists all of the available REST API operations of the Microsoft.ApiManagement provider. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException 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<OperationInner> 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 all of the available REST API operations of the Microsoft.ApiManagement 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 all of the available REST API operations of the Microsoft.ApiManagement provider. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<OperationInner> object + */ + public Observable> listAsync() { + return listWithServiceResponseAsync() + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all of the available REST API operations of the Microsoft.ApiManagement provider. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<OperationInner> 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 all of the available REST API operations of the Microsoft.ApiManagement provider. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<OperationInner> 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."); + } + return service.list(this.client.apiVersion(), 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 CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Lists all of the available REST API operations of the Microsoft.ApiManagement provider. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException 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<OperationInner> 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 all of the available REST API operations of the Microsoft.ApiManagement 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 all of the available REST API operations of the Microsoft.ApiManagement 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<OperationInner> object + */ + public Observable> listNextAsync(final String nextPageLink) { + return listNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all of the available REST API operations of the Microsoft.ApiManagement 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<OperationInner> 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 all of the available REST API operations of the Microsoft.ApiManagement 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<OperationInner> 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 CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ApiManagementServiceGetSsoTokenResultImpl.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ApiManagementServiceGetSsoTokenResultImpl.java new file mode 100644 index 0000000000000..28df51bc0ad20 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ApiManagementServiceGetSsoTokenResultImpl.java @@ -0,0 +1,31 @@ +/** + * 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.apimanagement.v2019_01_01.implementation; + +import com.microsoft.azure.management.apimanagement.v2019_01_01.ApiManagementServiceGetSsoTokenResult; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; + +class ApiManagementServiceGetSsoTokenResultImpl extends WrapperImpl implements ApiManagementServiceGetSsoTokenResult { + private final ApiManagementManager manager; + ApiManagementServiceGetSsoTokenResultImpl(ApiManagementServiceGetSsoTokenResultInner inner, ApiManagementManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public ApiManagementManager manager() { + return this.manager; + } + + @Override + public String redirectUri() { + return this.inner().redirectUri(); + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ApiManagementServiceGetSsoTokenResultInner.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ApiManagementServiceGetSsoTokenResultInner.java new file mode 100644 index 0000000000000..3e317c6e71c99 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ApiManagementServiceGetSsoTokenResultInner.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.apimanagement.v2019_01_01.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The response of the GetSsoToken operation. + */ +public class ApiManagementServiceGetSsoTokenResultInner { + /** + * Redirect URL to the Publisher Portal containing the SSO token. + */ + @JsonProperty(value = "redirectUri") + private String redirectUri; + + /** + * Get redirect URL to the Publisher Portal containing the SSO token. + * + * @return the redirectUri value + */ + public String redirectUri() { + return this.redirectUri; + } + + /** + * Set redirect URL to the Publisher Portal containing the SSO token. + * + * @param redirectUri the redirectUri value to set + * @return the ApiManagementServiceGetSsoTokenResultInner object itself. + */ + public ApiManagementServiceGetSsoTokenResultInner withRedirectUri(String redirectUri) { + this.redirectUri = redirectUri; + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ApiManagementServiceNameAvailabilityResultImpl.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ApiManagementServiceNameAvailabilityResultImpl.java new file mode 100644 index 0000000000000..bc86ef23e5e5f --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ApiManagementServiceNameAvailabilityResultImpl.java @@ -0,0 +1,42 @@ +/** + * 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.apimanagement.v2019_01_01.implementation; + +import com.microsoft.azure.management.apimanagement.v2019_01_01.ApiManagementServiceNameAvailabilityResult; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.apimanagement.v2019_01_01.NameAvailabilityReason; + +class ApiManagementServiceNameAvailabilityResultImpl extends WrapperImpl implements ApiManagementServiceNameAvailabilityResult { + private final ApiManagementManager manager; + ApiManagementServiceNameAvailabilityResultImpl(ApiManagementServiceNameAvailabilityResultInner inner, ApiManagementManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public ApiManagementManager manager() { + return this.manager; + } + + @Override + public String message() { + return this.inner().message(); + } + + @Override + public Boolean nameAvailable() { + return this.inner().nameAvailable(); + } + + @Override + public NameAvailabilityReason reason() { + return this.inner().reason(); + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ApiManagementServiceNameAvailabilityResultInner.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ApiManagementServiceNameAvailabilityResultInner.java new file mode 100644 index 0000000000000..0f0cd3d5ae5e7 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ApiManagementServiceNameAvailabilityResultInner.java @@ -0,0 +1,83 @@ +/** + * 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.apimanagement.v2019_01_01.implementation; + +import com.microsoft.azure.management.apimanagement.v2019_01_01.NameAvailabilityReason; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Response of the CheckNameAvailability operation. + */ +public class ApiManagementServiceNameAvailabilityResultInner { + /** + * True if the name is available and can be used to create a new API + * Management service; otherwise false. + */ + @JsonProperty(value = "nameAvailable", access = JsonProperty.Access.WRITE_ONLY) + private Boolean nameAvailable; + + /** + * If reason == invalid, provide the user with the reason why the given + * name is invalid, and provide the resource naming requirements so that + * the user can select a valid name. If reason == AlreadyExists, explain + * that <resourceName> is already in use, and direct them to select a + * different name. + */ + @JsonProperty(value = "message", access = JsonProperty.Access.WRITE_ONLY) + private String message; + + /** + * Invalid indicates the name provided does not match the resource + * provider’s naming requirements (incorrect length, unsupported + * characters, etc.) AlreadyExists indicates that the name is already in + * use and is therefore unavailable. Possible values include: 'Valid', + * 'Invalid', 'AlreadyExists'. + */ + @JsonProperty(value = "reason") + private NameAvailabilityReason reason; + + /** + * Get true if the name is available and can be used to create a new API Management service; otherwise false. + * + * @return the nameAvailable value + */ + public Boolean nameAvailable() { + return this.nameAvailable; + } + + /** + * Get if reason == invalid, provide the user with the reason why the given name is invalid, and provide the resource naming requirements so that the user can select a valid name. If reason == AlreadyExists, explain that <resourceName> is already in use, and direct them to select a different name. + * + * @return the message value + */ + public String message() { + return this.message; + } + + /** + * Get invalid indicates the name provided does not match the resource provider’s naming requirements (incorrect length, unsupported characters, etc.) AlreadyExists indicates that the name is already in use and is therefore unavailable. Possible values include: 'Valid', 'Invalid', 'AlreadyExists'. + * + * @return the reason value + */ + public NameAvailabilityReason reason() { + return this.reason; + } + + /** + * Set invalid indicates the name provided does not match the resource provider’s naming requirements (incorrect length, unsupported characters, etc.) AlreadyExists indicates that the name is already in use and is therefore unavailable. Possible values include: 'Valid', 'Invalid', 'AlreadyExists'. + * + * @param reason the reason value to set + * @return the ApiManagementServiceNameAvailabilityResultInner object itself. + */ + public ApiManagementServiceNameAvailabilityResultInner withReason(NameAvailabilityReason reason) { + this.reason = reason; + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ApiManagementServiceResourceImpl.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ApiManagementServiceResourceImpl.java new file mode 100644 index 0000000000000..5243e4e8b9665 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ApiManagementServiceResourceImpl.java @@ -0,0 +1,176 @@ +/** + * 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.apimanagement.v2019_01_01.implementation; + +import com.microsoft.azure.management.apimanagement.v2019_01_01.ApiManagementServiceResource; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import java.util.List; +import com.microsoft.azure.management.apimanagement.v2019_01_01.AdditionalLocation; +import com.microsoft.azure.management.apimanagement.v2019_01_01.CertificateConfiguration; +import org.joda.time.DateTime; +import java.util.Map; +import com.microsoft.azure.management.apimanagement.v2019_01_01.HostnameConfiguration; +import com.microsoft.azure.management.apimanagement.v2019_01_01.ApiManagementServiceIdentity; +import com.microsoft.azure.management.apimanagement.v2019_01_01.ApiManagementServiceSkuProperties; +import com.microsoft.azure.management.apimanagement.v2019_01_01.VirtualNetworkConfiguration; +import com.microsoft.azure.management.apimanagement.v2019_01_01.VirtualNetworkType; + +class ApiManagementServiceResourceImpl extends WrapperImpl implements ApiManagementServiceResource { + private final ApiManagementManager manager; + ApiManagementServiceResourceImpl(ApiManagementServiceResourceInner inner, ApiManagementManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public ApiManagementManager manager() { + return this.manager; + } + + @Override + public List additionalLocations() { + return this.inner().additionalLocations(); + } + + @Override + public List certificates() { + return this.inner().certificates(); + } + + @Override + public DateTime createdAtUtc() { + return this.inner().createdAtUtc(); + } + + @Override + public Map customProperties() { + return this.inner().customProperties(); + } + + @Override + public Boolean enableClientCertificate() { + return this.inner().enableClientCertificate(); + } + + @Override + public String etag() { + return this.inner().etag(); + } + + @Override + public String gatewayRegionalUrl() { + return this.inner().gatewayRegionalUrl(); + } + + @Override + public String gatewayUrl() { + return this.inner().gatewayUrl(); + } + + @Override + public List hostnameConfigurations() { + return this.inner().hostnameConfigurations(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public ApiManagementServiceIdentity identity() { + return this.inner().identity(); + } + + @Override + public String location() { + return this.inner().location(); + } + + @Override + public String managementApiUrl() { + return this.inner().managementApiUrl(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public String notificationSenderEmail() { + return this.inner().notificationSenderEmail(); + } + + @Override + public String portalUrl() { + return this.inner().portalUrl(); + } + + @Override + public List privateIPAddresses() { + return this.inner().privateIPAddresses(); + } + + @Override + public String provisioningState() { + return this.inner().provisioningState(); + } + + @Override + public List publicIPAddresses() { + return this.inner().publicIPAddresses(); + } + + @Override + public String publisherEmail() { + return this.inner().publisherEmail(); + } + + @Override + public String publisherName() { + return this.inner().publisherName(); + } + + @Override + public String scmUrl() { + return this.inner().scmUrl(); + } + + @Override + public ApiManagementServiceSkuProperties sku() { + return this.inner().sku(); + } + + @Override + public Map tags() { + return this.inner().tags(); + } + + @Override + public String targetProvisioningState() { + return this.inner().targetProvisioningState(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public VirtualNetworkConfiguration virtualNetworkConfiguration() { + return this.inner().virtualNetworkConfiguration(); + } + + @Override + public VirtualNetworkType virtualNetworkType() { + return this.inner().virtualNetworkType(); + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ApiManagementServiceResourceInner.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ApiManagementServiceResourceInner.java new file mode 100644 index 0000000000000..2b3c40fa28607 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ApiManagementServiceResourceInner.java @@ -0,0 +1,558 @@ +/** + * 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.apimanagement.v2019_01_01.implementation; + +import org.joda.time.DateTime; +import java.util.List; +import com.microsoft.azure.management.apimanagement.v2019_01_01.HostnameConfiguration; +import com.microsoft.azure.management.apimanagement.v2019_01_01.VirtualNetworkConfiguration; +import com.microsoft.azure.management.apimanagement.v2019_01_01.AdditionalLocation; +import java.util.Map; +import com.microsoft.azure.management.apimanagement.v2019_01_01.CertificateConfiguration; +import com.microsoft.azure.management.apimanagement.v2019_01_01.VirtualNetworkType; +import com.microsoft.azure.management.apimanagement.v2019_01_01.ApiManagementServiceSkuProperties; +import com.microsoft.azure.management.apimanagement.v2019_01_01.ApiManagementServiceIdentity; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.management.apimanagement.v2019_01_01.ApimResource; + +/** + * A single API Management service resource in List or Get response. + */ +@JsonFlatten +public class ApiManagementServiceResourceInner extends ApimResource { + /** + * Email address from which the notification will be sent. + */ + @JsonProperty(value = "properties.notificationSenderEmail") + private String notificationSenderEmail; + + /** + * The current provisioning state of the API Management service which can + * be one of the following: + * Created/Activating/Succeeded/Updating/Failed/Stopped/Terminating/TerminationFailed/Deleted. + */ + @JsonProperty(value = "properties.provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private String provisioningState; + + /** + * The provisioning state of the API Management service, which is targeted + * by the long running operation started on the service. + */ + @JsonProperty(value = "properties.targetProvisioningState", access = JsonProperty.Access.WRITE_ONLY) + private String targetProvisioningState; + + /** + * Creation UTC date of the API Management service.The date conforms to the + * following format: `yyyy-MM-ddTHH:mm:ssZ` as specified by the ISO 8601 + * standard. + */ + @JsonProperty(value = "properties.createdAtUtc", access = JsonProperty.Access.WRITE_ONLY) + private DateTime createdAtUtc; + + /** + * Gateway URL of the API Management service. + */ + @JsonProperty(value = "properties.gatewayUrl", access = JsonProperty.Access.WRITE_ONLY) + private String gatewayUrl; + + /** + * Gateway URL of the API Management service in the Default Region. + */ + @JsonProperty(value = "properties.gatewayRegionalUrl", access = JsonProperty.Access.WRITE_ONLY) + private String gatewayRegionalUrl; + + /** + * Publisher portal endpoint Url of the API Management service. + */ + @JsonProperty(value = "properties.portalUrl", access = JsonProperty.Access.WRITE_ONLY) + private String portalUrl; + + /** + * Management API endpoint URL of the API Management service. + */ + @JsonProperty(value = "properties.managementApiUrl", access = JsonProperty.Access.WRITE_ONLY) + private String managementApiUrl; + + /** + * SCM endpoint URL of the API Management service. + */ + @JsonProperty(value = "properties.scmUrl", access = JsonProperty.Access.WRITE_ONLY) + private String scmUrl; + + /** + * Custom hostname configuration of the API Management service. + */ + @JsonProperty(value = "properties.hostnameConfigurations") + private List hostnameConfigurations; + + /** + * Public Static Load Balanced IP addresses of the API Management service + * in Primary region. Available only for Basic, Standard and Premium SKU. + */ + @JsonProperty(value = "properties.publicIPAddresses", access = JsonProperty.Access.WRITE_ONLY) + private List publicIPAddresses; + + /** + * Private Static Load Balanced IP addresses of the API Management service + * in Primary region which is deployed in an Internal Virtual Network. + * Available only for Basic, Standard and Premium SKU. + */ + @JsonProperty(value = "properties.privateIPAddresses", access = JsonProperty.Access.WRITE_ONLY) + private List privateIPAddresses; + + /** + * Virtual network configuration of the API Management service. + */ + @JsonProperty(value = "properties.virtualNetworkConfiguration") + private VirtualNetworkConfiguration virtualNetworkConfiguration; + + /** + * Additional datacenter locations of the API Management service. + */ + @JsonProperty(value = "properties.additionalLocations") + private List additionalLocations; + + /** + * Custom properties of the API Management service. Setting + * `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TripleDes168` + * will disable the cipher TLS_RSA_WITH_3DES_EDE_CBC_SHA for all TLS(1.0, + * 1.1 and 1.2). Setting + * `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Tls11` + * can be used to disable just TLS 1.1 and setting + * `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Tls10` + * can be used to disable TLS 1.0 on an API Management service. + */ + @JsonProperty(value = "properties.customProperties") + private Map customProperties; + + /** + * List of Certificates that need to be installed in the API Management + * service. Max supported certificates that can be installed is 10. + */ + @JsonProperty(value = "properties.certificates") + private List certificates; + + /** + * Property only meant to be used for Consumption SKU Service. This + * enforces a client certificate to be presented on each request to the + * gateway. This also enables the ability to authenticate the certificate + * in the policy on the gateway. + */ + @JsonProperty(value = "properties.enableClientCertificate") + private Boolean enableClientCertificate; + + /** + * The type of VPN in which API Management service needs to be configured + * in. None (Default Value) means the API Management service is not part of + * any Virtual Network, External means the API Management deployment is set + * up inside a Virtual Network having an Internet Facing Endpoint, and + * Internal means that API Management deployment is setup inside a Virtual + * Network having an Intranet Facing Endpoint only. Possible values + * include: 'None', 'External', 'Internal'. + */ + @JsonProperty(value = "properties.virtualNetworkType") + private VirtualNetworkType virtualNetworkType; + + /** + * Publisher email. + */ + @JsonProperty(value = "properties.publisherEmail", required = true) + private String publisherEmail; + + /** + * Publisher name. + */ + @JsonProperty(value = "properties.publisherName", required = true) + private String publisherName; + + /** + * SKU properties of the API Management service. + */ + @JsonProperty(value = "sku", required = true) + private ApiManagementServiceSkuProperties sku; + + /** + * Managed service identity of the Api Management service. + */ + @JsonProperty(value = "identity") + private ApiManagementServiceIdentity identity; + + /** + * Resource location. + */ + @JsonProperty(value = "location", required = true) + private String location; + + /** + * ETag of the resource. + */ + @JsonProperty(value = "etag", access = JsonProperty.Access.WRITE_ONLY) + private String etag; + + /** + * Get email address from which the notification will be sent. + * + * @return the notificationSenderEmail value + */ + public String notificationSenderEmail() { + return this.notificationSenderEmail; + } + + /** + * Set email address from which the notification will be sent. + * + * @param notificationSenderEmail the notificationSenderEmail value to set + * @return the ApiManagementServiceResourceInner object itself. + */ + public ApiManagementServiceResourceInner withNotificationSenderEmail(String notificationSenderEmail) { + this.notificationSenderEmail = notificationSenderEmail; + return this; + } + + /** + * Get the current provisioning state of the API Management service which can be one of the following: Created/Activating/Succeeded/Updating/Failed/Stopped/Terminating/TerminationFailed/Deleted. + * + * @return the provisioningState value + */ + public String provisioningState() { + return this.provisioningState; + } + + /** + * Get the provisioning state of the API Management service, which is targeted by the long running operation started on the service. + * + * @return the targetProvisioningState value + */ + public String targetProvisioningState() { + return this.targetProvisioningState; + } + + /** + * Get creation UTC date of the API Management service.The date conforms to the following format: `yyyy-MM-ddTHH:mm:ssZ` as specified by the ISO 8601 standard. + * + * @return the createdAtUtc value + */ + public DateTime createdAtUtc() { + return this.createdAtUtc; + } + + /** + * Get gateway URL of the API Management service. + * + * @return the gatewayUrl value + */ + public String gatewayUrl() { + return this.gatewayUrl; + } + + /** + * Get gateway URL of the API Management service in the Default Region. + * + * @return the gatewayRegionalUrl value + */ + public String gatewayRegionalUrl() { + return this.gatewayRegionalUrl; + } + + /** + * Get publisher portal endpoint Url of the API Management service. + * + * @return the portalUrl value + */ + public String portalUrl() { + return this.portalUrl; + } + + /** + * Get management API endpoint URL of the API Management service. + * + * @return the managementApiUrl value + */ + public String managementApiUrl() { + return this.managementApiUrl; + } + + /** + * Get sCM endpoint URL of the API Management service. + * + * @return the scmUrl value + */ + public String scmUrl() { + return this.scmUrl; + } + + /** + * Get custom hostname configuration of the API Management service. + * + * @return the hostnameConfigurations value + */ + public List hostnameConfigurations() { + return this.hostnameConfigurations; + } + + /** + * Set custom hostname configuration of the API Management service. + * + * @param hostnameConfigurations the hostnameConfigurations value to set + * @return the ApiManagementServiceResourceInner object itself. + */ + public ApiManagementServiceResourceInner withHostnameConfigurations(List hostnameConfigurations) { + this.hostnameConfigurations = hostnameConfigurations; + return this; + } + + /** + * Get public Static Load Balanced IP addresses of the API Management service in Primary region. Available only for Basic, Standard and Premium SKU. + * + * @return the publicIPAddresses value + */ + public List publicIPAddresses() { + return this.publicIPAddresses; + } + + /** + * Get private Static Load Balanced IP addresses of the API Management service in Primary region which is deployed in an Internal Virtual Network. Available only for Basic, Standard and Premium SKU. + * + * @return the privateIPAddresses value + */ + public List privateIPAddresses() { + return this.privateIPAddresses; + } + + /** + * Get virtual network configuration of the API Management service. + * + * @return the virtualNetworkConfiguration value + */ + public VirtualNetworkConfiguration virtualNetworkConfiguration() { + return this.virtualNetworkConfiguration; + } + + /** + * Set virtual network configuration of the API Management service. + * + * @param virtualNetworkConfiguration the virtualNetworkConfiguration value to set + * @return the ApiManagementServiceResourceInner object itself. + */ + public ApiManagementServiceResourceInner withVirtualNetworkConfiguration(VirtualNetworkConfiguration virtualNetworkConfiguration) { + this.virtualNetworkConfiguration = virtualNetworkConfiguration; + return this; + } + + /** + * Get additional datacenter locations of the API Management service. + * + * @return the additionalLocations value + */ + public List additionalLocations() { + return this.additionalLocations; + } + + /** + * Set additional datacenter locations of the API Management service. + * + * @param additionalLocations the additionalLocations value to set + * @return the ApiManagementServiceResourceInner object itself. + */ + public ApiManagementServiceResourceInner withAdditionalLocations(List additionalLocations) { + this.additionalLocations = additionalLocations; + return this; + } + + /** + * Get custom properties of the API Management service. Setting `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TripleDes168` will disable the cipher TLS_RSA_WITH_3DES_EDE_CBC_SHA for all TLS(1.0, 1.1 and 1.2). Setting `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Tls11` can be used to disable just TLS 1.1 and setting `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Tls10` can be used to disable TLS 1.0 on an API Management service. + * + * @return the customProperties value + */ + public Map customProperties() { + return this.customProperties; + } + + /** + * Set custom properties of the API Management service. Setting `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TripleDes168` will disable the cipher TLS_RSA_WITH_3DES_EDE_CBC_SHA for all TLS(1.0, 1.1 and 1.2). Setting `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Tls11` can be used to disable just TLS 1.1 and setting `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Tls10` can be used to disable TLS 1.0 on an API Management service. + * + * @param customProperties the customProperties value to set + * @return the ApiManagementServiceResourceInner object itself. + */ + public ApiManagementServiceResourceInner withCustomProperties(Map customProperties) { + this.customProperties = customProperties; + return this; + } + + /** + * Get list of Certificates that need to be installed in the API Management service. Max supported certificates that can be installed is 10. + * + * @return the certificates value + */ + public List certificates() { + return this.certificates; + } + + /** + * Set list of Certificates that need to be installed in the API Management service. Max supported certificates that can be installed is 10. + * + * @param certificates the certificates value to set + * @return the ApiManagementServiceResourceInner object itself. + */ + public ApiManagementServiceResourceInner withCertificates(List certificates) { + this.certificates = certificates; + return this; + } + + /** + * Get property only meant to be used for Consumption SKU Service. This enforces a client certificate to be presented on each request to the gateway. This also enables the ability to authenticate the certificate in the policy on the gateway. + * + * @return the enableClientCertificate value + */ + public Boolean enableClientCertificate() { + return this.enableClientCertificate; + } + + /** + * Set property only meant to be used for Consumption SKU Service. This enforces a client certificate to be presented on each request to the gateway. This also enables the ability to authenticate the certificate in the policy on the gateway. + * + * @param enableClientCertificate the enableClientCertificate value to set + * @return the ApiManagementServiceResourceInner object itself. + */ + public ApiManagementServiceResourceInner withEnableClientCertificate(Boolean enableClientCertificate) { + this.enableClientCertificate = enableClientCertificate; + return this; + } + + /** + * Get the type of VPN in which API Management service needs to be configured in. None (Default Value) means the API Management service is not part of any Virtual Network, External means the API Management deployment is set up inside a Virtual Network having an Internet Facing Endpoint, and Internal means that API Management deployment is setup inside a Virtual Network having an Intranet Facing Endpoint only. Possible values include: 'None', 'External', 'Internal'. + * + * @return the virtualNetworkType value + */ + public VirtualNetworkType virtualNetworkType() { + return this.virtualNetworkType; + } + + /** + * Set the type of VPN in which API Management service needs to be configured in. None (Default Value) means the API Management service is not part of any Virtual Network, External means the API Management deployment is set up inside a Virtual Network having an Internet Facing Endpoint, and Internal means that API Management deployment is setup inside a Virtual Network having an Intranet Facing Endpoint only. Possible values include: 'None', 'External', 'Internal'. + * + * @param virtualNetworkType the virtualNetworkType value to set + * @return the ApiManagementServiceResourceInner object itself. + */ + public ApiManagementServiceResourceInner withVirtualNetworkType(VirtualNetworkType virtualNetworkType) { + this.virtualNetworkType = virtualNetworkType; + return this; + } + + /** + * Get publisher email. + * + * @return the publisherEmail value + */ + public String publisherEmail() { + return this.publisherEmail; + } + + /** + * Set publisher email. + * + * @param publisherEmail the publisherEmail value to set + * @return the ApiManagementServiceResourceInner object itself. + */ + public ApiManagementServiceResourceInner withPublisherEmail(String publisherEmail) { + this.publisherEmail = publisherEmail; + return this; + } + + /** + * Get publisher name. + * + * @return the publisherName value + */ + public String publisherName() { + return this.publisherName; + } + + /** + * Set publisher name. + * + * @param publisherName the publisherName value to set + * @return the ApiManagementServiceResourceInner object itself. + */ + public ApiManagementServiceResourceInner withPublisherName(String publisherName) { + this.publisherName = publisherName; + return this; + } + + /** + * Get sKU properties of the API Management service. + * + * @return the sku value + */ + public ApiManagementServiceSkuProperties sku() { + return this.sku; + } + + /** + * Set sKU properties of the API Management service. + * + * @param sku the sku value to set + * @return the ApiManagementServiceResourceInner object itself. + */ + public ApiManagementServiceResourceInner withSku(ApiManagementServiceSkuProperties sku) { + this.sku = sku; + return this; + } + + /** + * Get managed service identity of the Api Management service. + * + * @return the identity value + */ + public ApiManagementServiceIdentity identity() { + return this.identity; + } + + /** + * Set managed service identity of the Api Management service. + * + * @param identity the identity value to set + * @return the ApiManagementServiceResourceInner object itself. + */ + public ApiManagementServiceResourceInner withIdentity(ApiManagementServiceIdentity identity) { + this.identity = identity; + return this; + } + + /** + * Get resource location. + * + * @return the location value + */ + public String location() { + return this.location; + } + + /** + * Set resource location. + * + * @param location the location value to set + * @return the ApiManagementServiceResourceInner object itself. + */ + public ApiManagementServiceResourceInner withLocation(String location) { + this.location = location; + return this; + } + + /** + * Get eTag of the resource. + * + * @return the etag value + */ + public String etag() { + return this.etag; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ApiManagementServiceSkusImpl.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ApiManagementServiceSkusImpl.java new file mode 100644 index 0000000000000..cbd42dca5fa3c --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ApiManagementServiceSkusImpl.java @@ -0,0 +1,49 @@ +/** + * 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. + * abc + */ + +package com.microsoft.azure.management.apimanagement.v2019_01_01.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.apimanagement.v2019_01_01.ApiManagementServiceSkus; +import rx.functions.Func1; +import rx.Observable; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.apimanagement.v2019_01_01.ResourceSkuResult; + +class ApiManagementServiceSkusImpl extends WrapperImpl implements ApiManagementServiceSkus { + private final ApiManagementManager manager; + + ApiManagementServiceSkusImpl(ApiManagementManager manager) { + super(manager.inner().apiManagementServiceSkus()); + this.manager = manager; + } + + public ApiManagementManager manager() { + return this.manager; + } + + @Override + public Observable listAvailableServiceSkusAsync(final String resourceGroupName, final String serviceName) { + ApiManagementServiceSkusInner client = this.inner(); + return client.listAvailableServiceSkusAsync(resourceGroupName, serviceName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public ResourceSkuResult call(ResourceSkuResultInner inner) { + return new ResourceSkuResultImpl(inner, manager()); + } + }); + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ApiManagementServiceSkusInner.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ApiManagementServiceSkusInner.java new file mode 100644 index 0000000000000..87fa7b8cfc5e9 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ApiManagementServiceSkusInner.java @@ -0,0 +1,313 @@ +/** + * 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.apimanagement.v2019_01_01.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.CloudException; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Path; +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 ApiManagementServiceSkus. + */ +public class ApiManagementServiceSkusInner { + /** The Retrofit service to perform REST calls. */ + private ApiManagementServiceSkusService service; + /** The service client containing this operation class. */ + private ApiManagementClientImpl client; + + /** + * Initializes an instance of ApiManagementServiceSkusInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public ApiManagementServiceSkusInner(Retrofit retrofit, ApiManagementClientImpl client) { + this.service = retrofit.create(ApiManagementServiceSkusService.class); + this.client = client; + } + + /** + * The interface defining all the services for ApiManagementServiceSkus to be + * used by Retrofit to perform actually REST calls. + */ + interface ApiManagementServiceSkusService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.apimanagement.v2019_01_01.ApiManagementServiceSkus listAvailableServiceSkus" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/skus") + Observable> listAvailableServiceSkus(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("subscriptionId") String subscriptionId, @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.apimanagement.v2019_01_01.ApiManagementServiceSkus listAvailableServiceSkusNext" }) + @GET + Observable> listAvailableServiceSkusNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Gets available SKUs for API Management service. + * Gets all available SKU for a given API Management service. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException 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<ResourceSkuResultInner> object if successful. + */ + public PagedList listAvailableServiceSkus(final String resourceGroupName, final String serviceName) { + ServiceResponse> response = listAvailableServiceSkusSinglePageAsync(resourceGroupName, serviceName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listAvailableServiceSkusNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets available SKUs for API Management service. + * Gets all available SKU for a given API Management service. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @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> listAvailableServiceSkusAsync(final String resourceGroupName, final String serviceName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listAvailableServiceSkusSinglePageAsync(resourceGroupName, serviceName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listAvailableServiceSkusNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets available SKUs for API Management service. + * Gets all available SKU for a given API Management service. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ResourceSkuResultInner> object + */ + public Observable> listAvailableServiceSkusAsync(final String resourceGroupName, final String serviceName) { + return listAvailableServiceSkusWithServiceResponseAsync(resourceGroupName, serviceName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets available SKUs for API Management service. + * Gets all available SKU for a given API Management service. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ResourceSkuResultInner> object + */ + public Observable>> listAvailableServiceSkusWithServiceResponseAsync(final String resourceGroupName, final String serviceName) { + return listAvailableServiceSkusSinglePageAsync(resourceGroupName, serviceName) + .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(listAvailableServiceSkusNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets available SKUs for API Management service. + * Gets all available SKU for a given API Management service. + * + ServiceResponse> * @param resourceGroupName The name of the resource group. + ServiceResponse> * @param serviceName The name of the API Management service. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ResourceSkuResultInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listAvailableServiceSkusSinglePageAsync(final String resourceGroupName, final String serviceName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + 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.listAvailableServiceSkus(resourceGroupName, serviceName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listAvailableServiceSkusDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listAvailableServiceSkusDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Gets available SKUs for API Management service. + * Gets all available SKU for a given API Management service. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException 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<ResourceSkuResultInner> object if successful. + */ + public PagedList listAvailableServiceSkusNext(final String nextPageLink) { + ServiceResponse> response = listAvailableServiceSkusNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listAvailableServiceSkusNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets available SKUs for API Management service. + * Gets all available SKU for a given API Management service. + * + * @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> listAvailableServiceSkusNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listAvailableServiceSkusNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listAvailableServiceSkusNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets available SKUs for API Management service. + * Gets all available SKU for a given API Management service. + * + * @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<ResourceSkuResultInner> object + */ + public Observable> listAvailableServiceSkusNextAsync(final String nextPageLink) { + return listAvailableServiceSkusNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets available SKUs for API Management service. + * Gets all available SKU for a given API Management service. + * + * @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<ResourceSkuResultInner> object + */ + public Observable>> listAvailableServiceSkusNextWithServiceResponseAsync(final String nextPageLink) { + return listAvailableServiceSkusNextSinglePageAsync(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(listAvailableServiceSkusNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets available SKUs for API Management service. + * Gets all available SKU for a given API Management service. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ResourceSkuResultInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listAvailableServiceSkusNextSinglePageAsync(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.listAvailableServiceSkusNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listAvailableServiceSkusNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listAvailableServiceSkusNextDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ApiManagementServicesImpl.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ApiManagementServicesImpl.java new file mode 100644 index 0000000000000..6ea82a8a505ec --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ApiManagementServicesImpl.java @@ -0,0 +1,179 @@ +/** + * 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. + * abc + */ + +package com.microsoft.azure.management.apimanagement.v2019_01_01.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.apimanagement.v2019_01_01.ApiManagementServices; +import rx.functions.Func1; +import rx.Observable; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.apimanagement.v2019_01_01.ApiManagementServiceResource; +import com.microsoft.azure.management.apimanagement.v2019_01_01.ApiManagementServiceGetSsoTokenResult; +import com.microsoft.azure.management.apimanagement.v2019_01_01.ApiManagementServiceNameAvailabilityResult; +import com.microsoft.azure.management.apimanagement.v2019_01_01.ApiManagementServiceBackupRestoreParameters; +import com.microsoft.azure.management.apimanagement.v2019_01_01.ApiManagementServiceUpdateParameters; + +class ApiManagementServicesImpl extends WrapperImpl implements ApiManagementServices { + private final ApiManagementManager manager; + + ApiManagementServicesImpl(ApiManagementManager manager) { + super(manager.inner().apiManagementServices()); + this.manager = manager; + } + + public ApiManagementManager manager() { + return this.manager; + } + + @Override + public Observable restoreAsync(String resourceGroupName, String serviceName, ApiManagementServiceBackupRestoreParameters parameters) { + ApiManagementServicesInner client = this.inner(); + return client.restoreAsync(resourceGroupName, serviceName, parameters) + .map(new Func1() { + @Override + public ApiManagementServiceResource call(ApiManagementServiceResourceInner inner) { + return new ApiManagementServiceResourceImpl(inner, manager()); + } + }); + } + + @Override + public Observable backupAsync(String resourceGroupName, String serviceName, ApiManagementServiceBackupRestoreParameters parameters) { + ApiManagementServicesInner client = this.inner(); + return client.backupAsync(resourceGroupName, serviceName, parameters) + .map(new Func1() { + @Override + public ApiManagementServiceResource call(ApiManagementServiceResourceInner inner) { + return new ApiManagementServiceResourceImpl(inner, manager()); + } + }); + } + + @Override + public Observable createOrUpdateAsync(String resourceGroupName, String serviceName, ApiManagementServiceResourceInner parameters) { + ApiManagementServicesInner client = this.inner(); + return client.createOrUpdateAsync(resourceGroupName, serviceName, parameters) + .map(new Func1() { + @Override + public ApiManagementServiceResource call(ApiManagementServiceResourceInner inner) { + return new ApiManagementServiceResourceImpl(inner, manager()); + } + }); + } + + @Override + public Observable updateAsync(String resourceGroupName, String serviceName, ApiManagementServiceUpdateParameters parameters) { + ApiManagementServicesInner client = this.inner(); + return client.updateAsync(resourceGroupName, serviceName, parameters) + .map(new Func1() { + @Override + public ApiManagementServiceResource call(ApiManagementServiceResourceInner inner) { + return new ApiManagementServiceResourceImpl(inner, manager()); + } + }); + } + + @Override + public Observable getByResourceGroupAsync(String resourceGroupName, String serviceName) { + ApiManagementServicesInner client = this.inner(); + return client.getByResourceGroupAsync(resourceGroupName, serviceName) + .map(new Func1() { + @Override + public ApiManagementServiceResource call(ApiManagementServiceResourceInner inner) { + return new ApiManagementServiceResourceImpl(inner, manager()); + } + }); + } + + @Override + public Observable deleteAsync(String resourceGroupName, String serviceName) { + ApiManagementServicesInner client = this.inner(); + return client.deleteAsync(resourceGroupName, serviceName) + .map(new Func1() { + @Override + public ApiManagementServiceResource call(ApiManagementServiceResourceInner inner) { + return new ApiManagementServiceResourceImpl(inner, manager()); + } + }); + } + + @Override + public Observable getSsoTokenAsync(String resourceGroupName, String serviceName) { + ApiManagementServicesInner client = this.inner(); + return client.getSsoTokenAsync(resourceGroupName, serviceName) + .map(new Func1() { + @Override + public ApiManagementServiceGetSsoTokenResult call(ApiManagementServiceGetSsoTokenResultInner inner) { + return new ApiManagementServiceGetSsoTokenResultImpl(inner, manager()); + } + }); + } + + @Override + public Observable listByResourceGroupAsync(final String resourceGroupName) { + ApiManagementServicesInner client = this.inner(); + return client.listByResourceGroupAsync(resourceGroupName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public ApiManagementServiceResource call(ApiManagementServiceResourceInner inner) { + return new ApiManagementServiceResourceImpl(inner, manager()); + } + }); + } + + @Override + public Observable listAsync() { + ApiManagementServicesInner client = this.inner(); + return client.listAsync() + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public ApiManagementServiceResource call(ApiManagementServiceResourceInner inner) { + return new ApiManagementServiceResourceImpl(inner, manager()); + } + }); + } + + @Override + public Observable checkNameAvailabilityAsync(String name) { + ApiManagementServicesInner client = this.inner(); + return client.checkNameAvailabilityAsync(name) + .map(new Func1() { + @Override + public ApiManagementServiceNameAvailabilityResult call(ApiManagementServiceNameAvailabilityResultInner inner) { + return new ApiManagementServiceNameAvailabilityResultImpl(inner, manager()); + } + }); + } + + @Override + public Observable applyNetworkConfigurationUpdatesAsync(String resourceGroupName, String serviceName) { + ApiManagementServicesInner client = this.inner(); + return client.applyNetworkConfigurationUpdatesAsync(resourceGroupName, serviceName) + .map(new Func1() { + @Override + public ApiManagementServiceResource call(ApiManagementServiceResourceInner inner) { + return new ApiManagementServiceResourceImpl(inner, manager()); + } + }); + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ApiManagementServicesInner.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ApiManagementServicesInner.java new file mode 100644 index 0000000000000..619674316aade --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ApiManagementServicesInner.java @@ -0,0 +1,2025 @@ +/** + * 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.apimanagement.v2019_01_01.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.CloudException; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.management.apimanagement.v2019_01_01.ApiManagementServiceApplyNetworkConfigurationParameters; +import com.microsoft.azure.management.apimanagement.v2019_01_01.ApiManagementServiceBackupRestoreParameters; +import com.microsoft.azure.management.apimanagement.v2019_01_01.ApiManagementServiceCheckNameAvailabilityParameters; +import com.microsoft.azure.management.apimanagement.v2019_01_01.ApiManagementServiceUpdateParameters; +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; +import com.microsoft.azure.LongRunningFinalState; +import com.microsoft.azure.LongRunningOperationOptions; +import com.microsoft.azure.LongRunningFinalState; +import com.microsoft.azure.LongRunningOperationOptions; + +/** + * An instance of this class provides access to all the operations defined + * in ApiManagementServices. + */ +public class ApiManagementServicesInner implements InnerSupportsGet, InnerSupportsDelete, InnerSupportsListing { + /** The Retrofit service to perform REST calls. */ + private ApiManagementServicesService service; + /** The service client containing this operation class. */ + private ApiManagementClientImpl client; + + /** + * Initializes an instance of ApiManagementServicesInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public ApiManagementServicesInner(Retrofit retrofit, ApiManagementClientImpl client) { + this.service = retrofit.create(ApiManagementServicesService.class); + this.client = client; + } + + /** + * The interface defining all the services for ApiManagementServices to be + * used by Retrofit to perform actually REST calls. + */ + interface ApiManagementServicesService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.apimanagement.v2019_01_01.ApiManagementServices restore" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/restore") + Observable> restore(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("subscriptionId") String subscriptionId, @Body ApiManagementServiceBackupRestoreParameters parameters, @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.apimanagement.v2019_01_01.ApiManagementServices beginRestore" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/restore") + Observable> beginRestore(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("subscriptionId") String subscriptionId, @Body ApiManagementServiceBackupRestoreParameters parameters, @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.apimanagement.v2019_01_01.ApiManagementServices backup" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/backup") + Observable> backup(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("subscriptionId") String subscriptionId, @Body ApiManagementServiceBackupRestoreParameters parameters, @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.apimanagement.v2019_01_01.ApiManagementServices beginBackup" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/backup") + Observable> beginBackup(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("subscriptionId") String subscriptionId, @Body ApiManagementServiceBackupRestoreParameters parameters, @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.apimanagement.v2019_01_01.ApiManagementServices createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}") + Observable> createOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("subscriptionId") String subscriptionId, @Body ApiManagementServiceResourceInner parameters, @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.apimanagement.v2019_01_01.ApiManagementServices beginCreateOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}") + Observable> beginCreateOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("subscriptionId") String subscriptionId, @Body ApiManagementServiceResourceInner parameters, @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.apimanagement.v2019_01_01.ApiManagementServices update" }) + @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}") + Observable> update(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("subscriptionId") String subscriptionId, @Body ApiManagementServiceUpdateParameters parameters, @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.apimanagement.v2019_01_01.ApiManagementServices beginUpdate" }) + @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}") + Observable> beginUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("subscriptionId") String subscriptionId, @Body ApiManagementServiceUpdateParameters parameters, @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.apimanagement.v2019_01_01.ApiManagementServices getByResourceGroup" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}") + Observable> getByResourceGroup(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("subscriptionId") String subscriptionId, @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.apimanagement.v2019_01_01.ApiManagementServices delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}", method = "DELETE", hasBody = true) + Observable> delete(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("subscriptionId") String subscriptionId, @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.apimanagement.v2019_01_01.ApiManagementServices beginDelete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}", method = "DELETE", hasBody = true) + Observable> beginDelete(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("subscriptionId") String subscriptionId, @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.apimanagement.v2019_01_01.ApiManagementServices listByResourceGroup" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service") + Observable> listByResourceGroup(@Path("resourceGroupName") String resourceGroupName, @Path("subscriptionId") String subscriptionId, @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.apimanagement.v2019_01_01.ApiManagementServices list" }) + @GET("subscriptions/{subscriptionId}/providers/Microsoft.ApiManagement/service") + Observable> list(@Path("subscriptionId") String subscriptionId, @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.apimanagement.v2019_01_01.ApiManagementServices getSsoToken" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/getssotoken") + Observable> getSsoToken(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("subscriptionId") String subscriptionId, @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.apimanagement.v2019_01_01.ApiManagementServices checkNameAvailability" }) + @POST("subscriptions/{subscriptionId}/providers/Microsoft.ApiManagement/checkNameAvailability") + Observable> checkNameAvailability(@Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body ApiManagementServiceCheckNameAvailabilityParameters parameters, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.apimanagement.v2019_01_01.ApiManagementServices applyNetworkConfigurationUpdates" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/applynetworkconfigurationupdates") + Observable> applyNetworkConfigurationUpdates(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body ApiManagementServiceApplyNetworkConfigurationParameters parameters, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.apimanagement.v2019_01_01.ApiManagementServices beginApplyNetworkConfigurationUpdates" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/applynetworkconfigurationupdates") + Observable> beginApplyNetworkConfigurationUpdates(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body ApiManagementServiceApplyNetworkConfigurationParameters parameters, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.apimanagement.v2019_01_01.ApiManagementServices 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.apimanagement.v2019_01_01.ApiManagementServices listNext" }) + @GET + Observable> listNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Restores a backup of an API Management service created using the ApiManagementService_Backup operation on the current service. This is a long running operation and could take several minutes to complete. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param parameters Parameters supplied to the Restore API Management service from backup operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ApiManagementServiceResourceInner object if successful. + */ + public ApiManagementServiceResourceInner restore(String resourceGroupName, String serviceName, ApiManagementServiceBackupRestoreParameters parameters) { + return restoreWithServiceResponseAsync(resourceGroupName, serviceName, parameters).toBlocking().last().body(); + } + + /** + * Restores a backup of an API Management service created using the ApiManagementService_Backup operation on the current service. This is a long running operation and could take several minutes to complete. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param parameters Parameters supplied to the Restore API Management service from backup operation. + * @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 restoreAsync(String resourceGroupName, String serviceName, ApiManagementServiceBackupRestoreParameters parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(restoreWithServiceResponseAsync(resourceGroupName, serviceName, parameters), serviceCallback); + } + + /** + * Restores a backup of an API Management service created using the ApiManagementService_Backup operation on the current service. This is a long running operation and could take several minutes to complete. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param parameters Parameters supplied to the Restore API Management service from backup operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable restoreAsync(String resourceGroupName, String serviceName, ApiManagementServiceBackupRestoreParameters parameters) { + return restoreWithServiceResponseAsync(resourceGroupName, serviceName, parameters).map(new Func1, ApiManagementServiceResourceInner>() { + @Override + public ApiManagementServiceResourceInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Restores a backup of an API Management service created using the ApiManagementService_Backup operation on the current service. This is a long running operation and could take several minutes to complete. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param parameters Parameters supplied to the Restore API Management service from backup operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> restoreWithServiceResponseAsync(String resourceGroupName, String serviceName, ApiManagementServiceBackupRestoreParameters parameters) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(parameters); + Observable> observable = service.restore(resourceGroupName, serviceName, this.client.subscriptionId(), parameters, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new LongRunningOperationOptions().withFinalStateVia(LongRunningFinalState.LOCATION), new TypeToken() { }.getType()); + } + + /** + * Restores a backup of an API Management service created using the ApiManagementService_Backup operation on the current service. This is a long running operation and could take several minutes to complete. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param parameters Parameters supplied to the Restore API Management service from backup operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ApiManagementServiceResourceInner object if successful. + */ + public ApiManagementServiceResourceInner beginRestore(String resourceGroupName, String serviceName, ApiManagementServiceBackupRestoreParameters parameters) { + return beginRestoreWithServiceResponseAsync(resourceGroupName, serviceName, parameters).toBlocking().single().body(); + } + + /** + * Restores a backup of an API Management service created using the ApiManagementService_Backup operation on the current service. This is a long running operation and could take several minutes to complete. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param parameters Parameters supplied to the Restore API Management service from backup operation. + * @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 beginRestoreAsync(String resourceGroupName, String serviceName, ApiManagementServiceBackupRestoreParameters parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginRestoreWithServiceResponseAsync(resourceGroupName, serviceName, parameters), serviceCallback); + } + + /** + * Restores a backup of an API Management service created using the ApiManagementService_Backup operation on the current service. This is a long running operation and could take several minutes to complete. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param parameters Parameters supplied to the Restore API Management service from backup operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ApiManagementServiceResourceInner object + */ + public Observable beginRestoreAsync(String resourceGroupName, String serviceName, ApiManagementServiceBackupRestoreParameters parameters) { + return beginRestoreWithServiceResponseAsync(resourceGroupName, serviceName, parameters).map(new Func1, ApiManagementServiceResourceInner>() { + @Override + public ApiManagementServiceResourceInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Restores a backup of an API Management service created using the ApiManagementService_Backup operation on the current service. This is a long running operation and could take several minutes to complete. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param parameters Parameters supplied to the Restore API Management service from backup operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ApiManagementServiceResourceInner object + */ + public Observable> beginRestoreWithServiceResponseAsync(String resourceGroupName, String serviceName, ApiManagementServiceBackupRestoreParameters parameters) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(parameters); + return service.beginRestore(resourceGroupName, serviceName, this.client.subscriptionId(), parameters, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginRestoreDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginRestoreDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(202, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Creates a backup of the API Management service to the given Azure Storage Account. This is long running operation and could take several minutes to complete. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param parameters Parameters supplied to the ApiManagementService_Backup operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ApiManagementServiceResourceInner object if successful. + */ + public ApiManagementServiceResourceInner backup(String resourceGroupName, String serviceName, ApiManagementServiceBackupRestoreParameters parameters) { + return backupWithServiceResponseAsync(resourceGroupName, serviceName, parameters).toBlocking().last().body(); + } + + /** + * Creates a backup of the API Management service to the given Azure Storage Account. This is long running operation and could take several minutes to complete. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param parameters Parameters supplied to the ApiManagementService_Backup operation. + * @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 backupAsync(String resourceGroupName, String serviceName, ApiManagementServiceBackupRestoreParameters parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(backupWithServiceResponseAsync(resourceGroupName, serviceName, parameters), serviceCallback); + } + + /** + * Creates a backup of the API Management service to the given Azure Storage Account. This is long running operation and could take several minutes to complete. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param parameters Parameters supplied to the ApiManagementService_Backup operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable backupAsync(String resourceGroupName, String serviceName, ApiManagementServiceBackupRestoreParameters parameters) { + return backupWithServiceResponseAsync(resourceGroupName, serviceName, parameters).map(new Func1, ApiManagementServiceResourceInner>() { + @Override + public ApiManagementServiceResourceInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates a backup of the API Management service to the given Azure Storage Account. This is long running operation and could take several minutes to complete. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param parameters Parameters supplied to the ApiManagementService_Backup operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> backupWithServiceResponseAsync(String resourceGroupName, String serviceName, ApiManagementServiceBackupRestoreParameters parameters) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(parameters); + Observable> observable = service.backup(resourceGroupName, serviceName, this.client.subscriptionId(), parameters, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new LongRunningOperationOptions().withFinalStateVia(LongRunningFinalState.LOCATION), new TypeToken() { }.getType()); + } + + /** + * Creates a backup of the API Management service to the given Azure Storage Account. This is long running operation and could take several minutes to complete. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param parameters Parameters supplied to the ApiManagementService_Backup operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ApiManagementServiceResourceInner object if successful. + */ + public ApiManagementServiceResourceInner beginBackup(String resourceGroupName, String serviceName, ApiManagementServiceBackupRestoreParameters parameters) { + return beginBackupWithServiceResponseAsync(resourceGroupName, serviceName, parameters).toBlocking().single().body(); + } + + /** + * Creates a backup of the API Management service to the given Azure Storage Account. This is long running operation and could take several minutes to complete. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param parameters Parameters supplied to the ApiManagementService_Backup operation. + * @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 beginBackupAsync(String resourceGroupName, String serviceName, ApiManagementServiceBackupRestoreParameters parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginBackupWithServiceResponseAsync(resourceGroupName, serviceName, parameters), serviceCallback); + } + + /** + * Creates a backup of the API Management service to the given Azure Storage Account. This is long running operation and could take several minutes to complete. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param parameters Parameters supplied to the ApiManagementService_Backup operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ApiManagementServiceResourceInner object + */ + public Observable beginBackupAsync(String resourceGroupName, String serviceName, ApiManagementServiceBackupRestoreParameters parameters) { + return beginBackupWithServiceResponseAsync(resourceGroupName, serviceName, parameters).map(new Func1, ApiManagementServiceResourceInner>() { + @Override + public ApiManagementServiceResourceInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates a backup of the API Management service to the given Azure Storage Account. This is long running operation and could take several minutes to complete. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param parameters Parameters supplied to the ApiManagementService_Backup operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ApiManagementServiceResourceInner object + */ + public Observable> beginBackupWithServiceResponseAsync(String resourceGroupName, String serviceName, ApiManagementServiceBackupRestoreParameters parameters) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(parameters); + return service.beginBackup(resourceGroupName, serviceName, this.client.subscriptionId(), parameters, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginBackupDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginBackupDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(202, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Creates or updates an API Management service. This is long running operation and could take several minutes to complete. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param parameters Parameters supplied to the CreateOrUpdate API Management service operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ApiManagementServiceResourceInner object if successful. + */ + public ApiManagementServiceResourceInner createOrUpdate(String resourceGroupName, String serviceName, ApiManagementServiceResourceInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serviceName, parameters).toBlocking().last().body(); + } + + /** + * Creates or updates an API Management service. This is long running operation and could take several minutes to complete. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param parameters Parameters supplied to the CreateOrUpdate API Management service operation. + * @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 createOrUpdateAsync(String resourceGroupName, String serviceName, ApiManagementServiceResourceInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, serviceName, parameters), serviceCallback); + } + + /** + * Creates or updates an API Management service. This is long running operation and could take several minutes to complete. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param parameters Parameters supplied to the CreateOrUpdate API Management service operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable createOrUpdateAsync(String resourceGroupName, String serviceName, ApiManagementServiceResourceInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serviceName, parameters).map(new Func1, ApiManagementServiceResourceInner>() { + @Override + public ApiManagementServiceResourceInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates an API Management service. This is long running operation and could take several minutes to complete. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param parameters Parameters supplied to the CreateOrUpdate API Management service operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String serviceName, ApiManagementServiceResourceInner parameters) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(parameters); + Observable> observable = service.createOrUpdate(resourceGroupName, serviceName, this.client.subscriptionId(), parameters, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Creates or updates an API Management service. This is long running operation and could take several minutes to complete. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param parameters Parameters supplied to the CreateOrUpdate API Management service operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ApiManagementServiceResourceInner object if successful. + */ + public ApiManagementServiceResourceInner beginCreateOrUpdate(String resourceGroupName, String serviceName, ApiManagementServiceResourceInner parameters) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serviceName, parameters).toBlocking().single().body(); + } + + /** + * Creates or updates an API Management service. This is long running operation and could take several minutes to complete. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param parameters Parameters supplied to the CreateOrUpdate API Management service operation. + * @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 beginCreateOrUpdateAsync(String resourceGroupName, String serviceName, ApiManagementServiceResourceInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serviceName, parameters), serviceCallback); + } + + /** + * Creates or updates an API Management service. This is long running operation and could take several minutes to complete. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param parameters Parameters supplied to the CreateOrUpdate API Management service operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ApiManagementServiceResourceInner object + */ + public Observable beginCreateOrUpdateAsync(String resourceGroupName, String serviceName, ApiManagementServiceResourceInner parameters) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serviceName, parameters).map(new Func1, ApiManagementServiceResourceInner>() { + @Override + public ApiManagementServiceResourceInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates an API Management service. This is long running operation and could take several minutes to complete. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param parameters Parameters supplied to the CreateOrUpdate API Management service operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ApiManagementServiceResourceInner object + */ + public Observable> beginCreateOrUpdateWithServiceResponseAsync(String resourceGroupName, String serviceName, ApiManagementServiceResourceInner parameters) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(parameters); + return service.beginCreateOrUpdate(resourceGroupName, serviceName, this.client.subscriptionId(), parameters, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginCreateOrUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginCreateOrUpdateDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(201, new TypeToken() { }.getType()) + .register(202, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Updates an existing API Management service. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param parameters Parameters supplied to the CreateOrUpdate API Management service operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ApiManagementServiceResourceInner object if successful. + */ + public ApiManagementServiceResourceInner update(String resourceGroupName, String serviceName, ApiManagementServiceUpdateParameters parameters) { + return updateWithServiceResponseAsync(resourceGroupName, serviceName, parameters).toBlocking().last().body(); + } + + /** + * Updates an existing API Management service. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param parameters Parameters supplied to the CreateOrUpdate API Management service operation. + * @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 serviceName, ApiManagementServiceUpdateParameters parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateWithServiceResponseAsync(resourceGroupName, serviceName, parameters), serviceCallback); + } + + /** + * Updates an existing API Management service. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param parameters Parameters supplied to the CreateOrUpdate API Management service operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable updateAsync(String resourceGroupName, String serviceName, ApiManagementServiceUpdateParameters parameters) { + return updateWithServiceResponseAsync(resourceGroupName, serviceName, parameters).map(new Func1, ApiManagementServiceResourceInner>() { + @Override + public ApiManagementServiceResourceInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates an existing API Management service. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param parameters Parameters supplied to the CreateOrUpdate API Management service operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> updateWithServiceResponseAsync(String resourceGroupName, String serviceName, ApiManagementServiceUpdateParameters parameters) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(parameters); + Observable> observable = service.update(resourceGroupName, serviceName, this.client.subscriptionId(), parameters, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Updates an existing API Management service. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param parameters Parameters supplied to the CreateOrUpdate API Management service operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ApiManagementServiceResourceInner object if successful. + */ + public ApiManagementServiceResourceInner beginUpdate(String resourceGroupName, String serviceName, ApiManagementServiceUpdateParameters parameters) { + return beginUpdateWithServiceResponseAsync(resourceGroupName, serviceName, parameters).toBlocking().single().body(); + } + + /** + * Updates an existing API Management service. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param parameters Parameters supplied to the CreateOrUpdate API Management service operation. + * @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 serviceName, ApiManagementServiceUpdateParameters parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginUpdateWithServiceResponseAsync(resourceGroupName, serviceName, parameters), serviceCallback); + } + + /** + * Updates an existing API Management service. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param parameters Parameters supplied to the CreateOrUpdate API Management service operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ApiManagementServiceResourceInner object + */ + public Observable beginUpdateAsync(String resourceGroupName, String serviceName, ApiManagementServiceUpdateParameters parameters) { + return beginUpdateWithServiceResponseAsync(resourceGroupName, serviceName, parameters).map(new Func1, ApiManagementServiceResourceInner>() { + @Override + public ApiManagementServiceResourceInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates an existing API Management service. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param parameters Parameters supplied to the CreateOrUpdate API Management service operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ApiManagementServiceResourceInner object + */ + public Observable> beginUpdateWithServiceResponseAsync(String resourceGroupName, String serviceName, ApiManagementServiceUpdateParameters parameters) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(parameters); + return service.beginUpdate(resourceGroupName, serviceName, this.client.subscriptionId(), parameters, this.client.apiVersion(), 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 CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(202, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Gets an API Management service resource description. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ApiManagementServiceResourceInner object if successful. + */ + public ApiManagementServiceResourceInner getByResourceGroup(String resourceGroupName, String serviceName) { + return getByResourceGroupWithServiceResponseAsync(resourceGroupName, serviceName).toBlocking().single().body(); + } + + /** + * Gets an API Management service resource description. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @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 serviceName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getByResourceGroupWithServiceResponseAsync(resourceGroupName, serviceName), serviceCallback); + } + + /** + * Gets an API Management service resource description. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ApiManagementServiceResourceInner object + */ + public Observable getByResourceGroupAsync(String resourceGroupName, String serviceName) { + return getByResourceGroupWithServiceResponseAsync(resourceGroupName, serviceName).map(new Func1, ApiManagementServiceResourceInner>() { + @Override + public ApiManagementServiceResourceInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets an API Management service resource description. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ApiManagementServiceResourceInner object + */ + public Observable> getByResourceGroupWithServiceResponseAsync(String resourceGroupName, String serviceName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + 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.getByResourceGroup(resourceGroupName, serviceName, this.client.subscriptionId(), 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 CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Deletes an existing API Management service. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ApiManagementServiceResourceInner object if successful. + */ + public ApiManagementServiceResourceInner delete(String resourceGroupName, String serviceName) { + return deleteWithServiceResponseAsync(resourceGroupName, serviceName).toBlocking().last().body(); + } + + /** + * Deletes an existing API Management service. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @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 serviceName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, serviceName), serviceCallback); + } + + /** + * Deletes an existing API Management service. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable deleteAsync(String resourceGroupName, String serviceName) { + return deleteWithServiceResponseAsync(resourceGroupName, serviceName).map(new Func1, ApiManagementServiceResourceInner>() { + @Override + public ApiManagementServiceResourceInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes an existing API Management service. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> deleteWithServiceResponseAsync(String resourceGroupName, String serviceName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + 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."); + } + Observable> observable = service.delete(resourceGroupName, serviceName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Deletes an existing API Management service. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ApiManagementServiceResourceInner object if successful. + */ + public ApiManagementServiceResourceInner beginDelete(String resourceGroupName, String serviceName) { + return beginDeleteWithServiceResponseAsync(resourceGroupName, serviceName).toBlocking().single().body(); + } + + /** + * Deletes an existing API Management service. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @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 serviceName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginDeleteWithServiceResponseAsync(resourceGroupName, serviceName), serviceCallback); + } + + /** + * Deletes an existing API Management service. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ApiManagementServiceResourceInner object + */ + public Observable beginDeleteAsync(String resourceGroupName, String serviceName) { + return beginDeleteWithServiceResponseAsync(resourceGroupName, serviceName).map(new Func1, ApiManagementServiceResourceInner>() { + @Override + public ApiManagementServiceResourceInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes an existing API Management service. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ApiManagementServiceResourceInner object + */ + public Observable> beginDeleteWithServiceResponseAsync(String resourceGroupName, String serviceName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + 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.beginDelete(resourceGroupName, serviceName, this.client.subscriptionId(), 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 CloudException, 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(CloudException.class) + .build(response); + } + + /** + * List all API Management services within a resource group. + * + * @param resourceGroupName The name of the resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException 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<ApiManagementServiceResourceInner> 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(); + } + }; + } + + /** + * List all API Management services within a resource group. + * + * @param resourceGroupName The name of the resource group. + * @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); + } + + /** + * List all API Management services within a resource group. + * + * @param resourceGroupName The name of the resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ApiManagementServiceResourceInner> object + */ + public Observable> listByResourceGroupAsync(final String resourceGroupName) { + return listByResourceGroupWithServiceResponseAsync(resourceGroupName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * List all API Management services within a resource group. + * + * @param resourceGroupName The name of the resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ApiManagementServiceResourceInner> 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)); + } + }); + } + + /** + * List all API Management services within a resource group. + * + ServiceResponse> * @param resourceGroupName The name of the resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ApiManagementServiceResourceInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByResourceGroupSinglePageAsync(final String resourceGroupName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + 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.listByResourceGroup(resourceGroupName, this.client.subscriptionId(), this.client.apiVersion(), 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 CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Lists all API Management services within an Azure subscription. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException 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<ApiManagementServiceResourceInner> 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 all API Management services within an Azure 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 all API Management services within an Azure subscription. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ApiManagementServiceResourceInner> object + */ + public Observable> listAsync() { + return listWithServiceResponseAsync() + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all API Management services within an Azure subscription. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ApiManagementServiceResourceInner> 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 all API Management services within an Azure subscription. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ApiManagementServiceResourceInner> 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."); + } + return service.list(this.client.subscriptionId(), this.client.apiVersion(), 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 CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Gets the Single-Sign-On token for the API Management Service which is valid for 5 Minutes. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ApiManagementServiceGetSsoTokenResultInner object if successful. + */ + public ApiManagementServiceGetSsoTokenResultInner getSsoToken(String resourceGroupName, String serviceName) { + return getSsoTokenWithServiceResponseAsync(resourceGroupName, serviceName).toBlocking().single().body(); + } + + /** + * Gets the Single-Sign-On token for the API Management Service which is valid for 5 Minutes. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @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 getSsoTokenAsync(String resourceGroupName, String serviceName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getSsoTokenWithServiceResponseAsync(resourceGroupName, serviceName), serviceCallback); + } + + /** + * Gets the Single-Sign-On token for the API Management Service which is valid for 5 Minutes. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ApiManagementServiceGetSsoTokenResultInner object + */ + public Observable getSsoTokenAsync(String resourceGroupName, String serviceName) { + return getSsoTokenWithServiceResponseAsync(resourceGroupName, serviceName).map(new Func1, ApiManagementServiceGetSsoTokenResultInner>() { + @Override + public ApiManagementServiceGetSsoTokenResultInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets the Single-Sign-On token for the API Management Service which is valid for 5 Minutes. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ApiManagementServiceGetSsoTokenResultInner object + */ + public Observable> getSsoTokenWithServiceResponseAsync(String resourceGroupName, String serviceName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + 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.getSsoToken(resourceGroupName, serviceName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getSsoTokenDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getSsoTokenDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Checks availability and correctness of a name for an API Management service. + * + * @param name The name to check for availability. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ApiManagementServiceNameAvailabilityResultInner object if successful. + */ + public ApiManagementServiceNameAvailabilityResultInner checkNameAvailability(String name) { + return checkNameAvailabilityWithServiceResponseAsync(name).toBlocking().single().body(); + } + + /** + * Checks availability and correctness of a name for an API Management service. + * + * @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 availability and correctness of a name for an API Management service. + * + * @param name The name to check for availability. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ApiManagementServiceNameAvailabilityResultInner object + */ + public Observable checkNameAvailabilityAsync(String name) { + return checkNameAvailabilityWithServiceResponseAsync(name).map(new Func1, ApiManagementServiceNameAvailabilityResultInner>() { + @Override + public ApiManagementServiceNameAvailabilityResultInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Checks availability and correctness of a name for an API Management service. + * + * @param name The name to check for availability. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ApiManagementServiceNameAvailabilityResultInner 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."); + } + ApiManagementServiceCheckNameAvailabilityParameters parameters = new ApiManagementServiceCheckNameAvailabilityParameters(); + parameters.withName(name); + return service.checkNameAvailability(this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), parameters, 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 CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Updates the Microsoft.ApiManagement resource running in the Virtual network to pick the updated network settings. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ApiManagementServiceResourceInner object if successful. + */ + public ApiManagementServiceResourceInner applyNetworkConfigurationUpdates(String resourceGroupName, String serviceName) { + return applyNetworkConfigurationUpdatesWithServiceResponseAsync(resourceGroupName, serviceName).toBlocking().last().body(); + } + + /** + * Updates the Microsoft.ApiManagement resource running in the Virtual network to pick the updated network settings. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @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 applyNetworkConfigurationUpdatesAsync(String resourceGroupName, String serviceName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(applyNetworkConfigurationUpdatesWithServiceResponseAsync(resourceGroupName, serviceName), serviceCallback); + } + + /** + * Updates the Microsoft.ApiManagement resource running in the Virtual network to pick the updated network settings. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable applyNetworkConfigurationUpdatesAsync(String resourceGroupName, String serviceName) { + return applyNetworkConfigurationUpdatesWithServiceResponseAsync(resourceGroupName, serviceName).map(new Func1, ApiManagementServiceResourceInner>() { + @Override + public ApiManagementServiceResourceInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates the Microsoft.ApiManagement resource running in the Virtual network to pick the updated network settings. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> applyNetworkConfigurationUpdatesWithServiceResponseAsync(String resourceGroupName, String serviceName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + 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 location = null; + ApiManagementServiceApplyNetworkConfigurationParameters parameters = new ApiManagementServiceApplyNetworkConfigurationParameters(); + parameters.withLocation(null); + Observable> observable = service.applyNetworkConfigurationUpdates(resourceGroupName, serviceName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), parameters, this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new LongRunningOperationOptions().withFinalStateVia(LongRunningFinalState.LOCATION), new TypeToken() { }.getType()); + } + /** + * Updates the Microsoft.ApiManagement resource running in the Virtual network to pick the updated network settings. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param location Location of the Api Management service to update for a multi-region service. For a service deployed in a single region, this parameter is not required. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ApiManagementServiceResourceInner object if successful. + */ + public ApiManagementServiceResourceInner applyNetworkConfigurationUpdates(String resourceGroupName, String serviceName, String location) { + return applyNetworkConfigurationUpdatesWithServiceResponseAsync(resourceGroupName, serviceName, location).toBlocking().last().body(); + } + + /** + * Updates the Microsoft.ApiManagement resource running in the Virtual network to pick the updated network settings. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param location Location of the Api Management service to update for a multi-region service. For a service deployed in a single region, this parameter is not required. + * @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 applyNetworkConfigurationUpdatesAsync(String resourceGroupName, String serviceName, String location, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(applyNetworkConfigurationUpdatesWithServiceResponseAsync(resourceGroupName, serviceName, location), serviceCallback); + } + + /** + * Updates the Microsoft.ApiManagement resource running in the Virtual network to pick the updated network settings. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param location Location of the Api Management service to update for a multi-region service. For a service deployed in a single region, this parameter is not required. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable applyNetworkConfigurationUpdatesAsync(String resourceGroupName, String serviceName, String location) { + return applyNetworkConfigurationUpdatesWithServiceResponseAsync(resourceGroupName, serviceName, location).map(new Func1, ApiManagementServiceResourceInner>() { + @Override + public ApiManagementServiceResourceInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates the Microsoft.ApiManagement resource running in the Virtual network to pick the updated network settings. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param location Location of the Api Management service to update for a multi-region service. For a service deployed in a single region, this parameter is not required. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> applyNetworkConfigurationUpdatesWithServiceResponseAsync(String resourceGroupName, String serviceName, String location) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + 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."); + } + ApiManagementServiceApplyNetworkConfigurationParameters parameters = null; + if (location != null) { + parameters = new ApiManagementServiceApplyNetworkConfigurationParameters(); + parameters.withLocation(location); + } + Observable> observable = service.applyNetworkConfigurationUpdates(resourceGroupName, serviceName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), parameters, this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new LongRunningOperationOptions().withFinalStateVia(LongRunningFinalState.LOCATION), new TypeToken() { }.getType()); + } + + /** + * Updates the Microsoft.ApiManagement resource running in the Virtual network to pick the updated network settings. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ApiManagementServiceResourceInner object if successful. + */ + public ApiManagementServiceResourceInner beginApplyNetworkConfigurationUpdates(String resourceGroupName, String serviceName) { + return beginApplyNetworkConfigurationUpdatesWithServiceResponseAsync(resourceGroupName, serviceName).toBlocking().single().body(); + } + + /** + * Updates the Microsoft.ApiManagement resource running in the Virtual network to pick the updated network settings. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @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 beginApplyNetworkConfigurationUpdatesAsync(String resourceGroupName, String serviceName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginApplyNetworkConfigurationUpdatesWithServiceResponseAsync(resourceGroupName, serviceName), serviceCallback); + } + + /** + * Updates the Microsoft.ApiManagement resource running in the Virtual network to pick the updated network settings. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ApiManagementServiceResourceInner object + */ + public Observable beginApplyNetworkConfigurationUpdatesAsync(String resourceGroupName, String serviceName) { + return beginApplyNetworkConfigurationUpdatesWithServiceResponseAsync(resourceGroupName, serviceName).map(new Func1, ApiManagementServiceResourceInner>() { + @Override + public ApiManagementServiceResourceInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates the Microsoft.ApiManagement resource running in the Virtual network to pick the updated network settings. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ApiManagementServiceResourceInner object + */ + public Observable> beginApplyNetworkConfigurationUpdatesWithServiceResponseAsync(String resourceGroupName, String serviceName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + 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 location = null; + ApiManagementServiceApplyNetworkConfigurationParameters parameters = new ApiManagementServiceApplyNetworkConfigurationParameters(); + parameters.withLocation(null); + return service.beginApplyNetworkConfigurationUpdates(resourceGroupName, serviceName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), parameters, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginApplyNetworkConfigurationUpdatesDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Updates the Microsoft.ApiManagement resource running in the Virtual network to pick the updated network settings. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param location Location of the Api Management service to update for a multi-region service. For a service deployed in a single region, this parameter is not required. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ApiManagementServiceResourceInner object if successful. + */ + public ApiManagementServiceResourceInner beginApplyNetworkConfigurationUpdates(String resourceGroupName, String serviceName, String location) { + return beginApplyNetworkConfigurationUpdatesWithServiceResponseAsync(resourceGroupName, serviceName, location).toBlocking().single().body(); + } + + /** + * Updates the Microsoft.ApiManagement resource running in the Virtual network to pick the updated network settings. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param location Location of the Api Management service to update for a multi-region service. For a service deployed in a single region, this parameter is not required. + * @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 beginApplyNetworkConfigurationUpdatesAsync(String resourceGroupName, String serviceName, String location, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginApplyNetworkConfigurationUpdatesWithServiceResponseAsync(resourceGroupName, serviceName, location), serviceCallback); + } + + /** + * Updates the Microsoft.ApiManagement resource running in the Virtual network to pick the updated network settings. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param location Location of the Api Management service to update for a multi-region service. For a service deployed in a single region, this parameter is not required. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ApiManagementServiceResourceInner object + */ + public Observable beginApplyNetworkConfigurationUpdatesAsync(String resourceGroupName, String serviceName, String location) { + return beginApplyNetworkConfigurationUpdatesWithServiceResponseAsync(resourceGroupName, serviceName, location).map(new Func1, ApiManagementServiceResourceInner>() { + @Override + public ApiManagementServiceResourceInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates the Microsoft.ApiManagement resource running in the Virtual network to pick the updated network settings. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param location Location of the Api Management service to update for a multi-region service. For a service deployed in a single region, this parameter is not required. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ApiManagementServiceResourceInner object + */ + public Observable> beginApplyNetworkConfigurationUpdatesWithServiceResponseAsync(String resourceGroupName, String serviceName, String location) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + 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."); + } + ApiManagementServiceApplyNetworkConfigurationParameters parameters = null; + if (location != null) { + parameters = new ApiManagementServiceApplyNetworkConfigurationParameters(); + parameters.withLocation(location); + } + return service.beginApplyNetworkConfigurationUpdates(resourceGroupName, serviceName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), parameters, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginApplyNetworkConfigurationUpdatesDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginApplyNetworkConfigurationUpdatesDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(202, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * List all API Management services within a resource group. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException 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<ApiManagementServiceResourceInner> 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(); + } + }; + } + + /** + * List all API Management services within a 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); + } + + /** + * List all API Management services within a 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<ApiManagementServiceResourceInner> object + */ + public Observable> listByResourceGroupNextAsync(final String nextPageLink) { + return listByResourceGroupNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * List all API Management services within a 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<ApiManagementServiceResourceInner> 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)); + } + }); + } + + /** + * List all API Management services within a 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<ApiManagementServiceResourceInner> 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 CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Lists all API Management services within an Azure subscription. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException 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<ApiManagementServiceResourceInner> 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 all API Management services within an Azure 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 all API Management services within an Azure 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<ApiManagementServiceResourceInner> object + */ + public Observable> listNextAsync(final String nextPageLink) { + return listNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all API Management services within an Azure 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<ApiManagementServiceResourceInner> 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 all API Management services within an Azure 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<ApiManagementServiceResourceInner> 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 CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ApiOperationPolicysImpl.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ApiOperationPolicysImpl.java new file mode 100644 index 0000000000000..9e15e93875a13 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ApiOperationPolicysImpl.java @@ -0,0 +1,81 @@ +/** + * 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.apimanagement.v2019_01_01.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.apimanagement.v2019_01_01.ApiOperationPolicys; +import rx.Completable; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.management.apimanagement.v2019_01_01.PolicyCollection; +import com.microsoft.azure.management.apimanagement.v2019_01_01.OperationApiPolicyContract; + +class ApiOperationPolicysImpl extends WrapperImpl implements ApiOperationPolicys { + private final ApiManagementManager manager; + + ApiOperationPolicysImpl(ApiManagementManager manager) { + super(manager.inner().apiOperationPolicys()); + this.manager = manager; + } + + public ApiManagementManager manager() { + return this.manager; + } + + @Override + public OperationApiPolicyContractImpl define(String name) { + return wrapModel(name); + } + + private OperationApiPolicyContractImpl wrapModel(PolicyContractInner inner) { + return new OperationApiPolicyContractImpl(inner, manager()); + } + + private OperationApiPolicyContractImpl wrapModel(String name) { + return new OperationApiPolicyContractImpl(name, this.manager()); + } + + @Override + public Observable listByOperationAsync(String resourceGroupName, String serviceName, String apiId, String operationId) { + ApiOperationPolicysInner client = this.inner(); + return client.listByOperationAsync(resourceGroupName, serviceName, apiId, operationId) + .map(new Func1() { + @Override + public PolicyCollection call(PolicyCollectionInner inner) { + return new PolicyCollectionImpl(inner, manager()); + } + }); + } + + @Override + public Completable getEntityTagAsync(String resourceGroupName, String serviceName, String apiId, String operationId) { + ApiOperationPolicysInner client = this.inner(); + return client.getEntityTagAsync(resourceGroupName, serviceName, apiId, operationId).toCompletable(); + } + + @Override + public Observable getAsync(String resourceGroupName, String serviceName, String apiId, String operationId) { + ApiOperationPolicysInner client = this.inner(); + return client.getAsync(resourceGroupName, serviceName, apiId, operationId) + .map(new Func1() { + @Override + public OperationApiPolicyContract call(PolicyContractInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Completable deleteAsync(String resourceGroupName, String serviceName, String apiId, String operationId, String ifMatch) { + ApiOperationPolicysInner client = this.inner(); + return client.deleteAsync(resourceGroupName, serviceName, apiId, operationId, ifMatch).toCompletable(); + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ApiOperationPolicysInner.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ApiOperationPolicysInner.java new file mode 100644 index 0000000000000..271b74d93c52b --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ApiOperationPolicysInner.java @@ -0,0 +1,811 @@ +/** + * 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.apimanagement.v2019_01_01.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.management.apimanagement.v2019_01_01.ApiOperationPolicyCreateOrUpdateHeaders; +import com.microsoft.azure.management.apimanagement.v2019_01_01.ApiOperationPolicyGetEntityTagHeaders; +import com.microsoft.azure.management.apimanagement.v2019_01_01.ApiOperationPolicyGetHeaders; +import com.microsoft.azure.management.apimanagement.v2019_01_01.ErrorResponseException; +import com.microsoft.azure.management.apimanagement.v2019_01_01.PolicyExportFormat; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import com.microsoft.rest.ServiceResponseWithHeaders; +import com.microsoft.rest.Validator; +import java.io.IOException; +import okhttp3.ResponseBody; +import retrofit2.http.Body; +import retrofit2.http.GET; +import retrofit2.http.HEAD; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.HTTP; +import retrofit2.http.Path; +import retrofit2.http.PUT; +import retrofit2.http.Query; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in ApiOperationPolicys. + */ +public class ApiOperationPolicysInner { + /** The Retrofit service to perform REST calls. */ + private ApiOperationPolicysService service; + /** The service client containing this operation class. */ + private ApiManagementClientImpl client; + + /** + * Initializes an instance of ApiOperationPolicysInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public ApiOperationPolicysInner(Retrofit retrofit, ApiManagementClientImpl client) { + this.service = retrofit.create(ApiOperationPolicysService.class); + this.client = client; + } + + /** + * The interface defining all the services for ApiOperationPolicys to be + * used by Retrofit to perform actually REST calls. + */ + interface ApiOperationPolicysService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.apimanagement.v2019_01_01.ApiOperationPolicys listByOperation" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/operations/{operationId}/policies") + Observable> listByOperation(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("apiId") String apiId, @Path("operationId") String operationId, @Path("subscriptionId") String subscriptionId, @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.apimanagement.v2019_01_01.ApiOperationPolicys getEntityTag" }) + @HEAD("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/operations/{operationId}/policies/{policyId}") + Observable> getEntityTag(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("apiId") String apiId, @Path("operationId") String operationId, @Path("policyId") String policyId, @Path("subscriptionId") String subscriptionId, @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.apimanagement.v2019_01_01.ApiOperationPolicys get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/operations/{operationId}/policies/{policyId}") + Observable> get(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("apiId") String apiId, @Path("operationId") String operationId, @Path("policyId") String policyId, @Path("subscriptionId") String subscriptionId, @Query("format") PolicyExportFormat format, @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.apimanagement.v2019_01_01.ApiOperationPolicys createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/operations/{operationId}/policies/{policyId}") + Observable> createOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("apiId") String apiId, @Path("operationId") String operationId, @Path("policyId") String policyId, @Path("subscriptionId") String subscriptionId, @Body PolicyContractInner parameters, @Header("If-Match") String ifMatch, @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.apimanagement.v2019_01_01.ApiOperationPolicys delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/operations/{operationId}/policies/{policyId}", method = "DELETE", hasBody = true) + Observable> delete(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("apiId") String apiId, @Path("operationId") String operationId, @Path("policyId") String policyId, @Path("subscriptionId") String subscriptionId, @Header("If-Match") String ifMatch, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Get the list of policy configuration at the API Operation level. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @param operationId Operation identifier within an API. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PolicyCollectionInner object if successful. + */ + public PolicyCollectionInner listByOperation(String resourceGroupName, String serviceName, String apiId, String operationId) { + return listByOperationWithServiceResponseAsync(resourceGroupName, serviceName, apiId, operationId).toBlocking().single().body(); + } + + /** + * Get the list of policy configuration at the API Operation level. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @param operationId Operation identifier within an API. Must be unique in the current API Management service instance. + * @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 listByOperationAsync(String resourceGroupName, String serviceName, String apiId, String operationId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(listByOperationWithServiceResponseAsync(resourceGroupName, serviceName, apiId, operationId), serviceCallback); + } + + /** + * Get the list of policy configuration at the API Operation level. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @param operationId Operation identifier within an API. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PolicyCollectionInner object + */ + public Observable listByOperationAsync(String resourceGroupName, String serviceName, String apiId, String operationId) { + return listByOperationWithServiceResponseAsync(resourceGroupName, serviceName, apiId, operationId).map(new Func1, PolicyCollectionInner>() { + @Override + public PolicyCollectionInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Get the list of policy configuration at the API Operation level. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @param operationId Operation identifier within an API. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PolicyCollectionInner object + */ + public Observable> listByOperationWithServiceResponseAsync(String resourceGroupName, String serviceName, String apiId, String operationId) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (apiId == null) { + throw new IllegalArgumentException("Parameter apiId is required and cannot be null."); + } + if (operationId == null) { + throw new IllegalArgumentException("Parameter operationId is required and cannot be null."); + } + 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.listByOperation(resourceGroupName, serviceName, apiId, operationId, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = listByOperationDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse listByOperationDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Gets the entity state (Etag) version of the API operation policy specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @param operationId Operation identifier within an API. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void getEntityTag(String resourceGroupName, String serviceName, String apiId, String operationId) { + getEntityTagWithServiceResponseAsync(resourceGroupName, serviceName, apiId, operationId).toBlocking().single().body(); + } + + /** + * Gets the entity state (Etag) version of the API operation policy specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @param operationId Operation identifier within an API. Must be unique in the current API Management service instance. + * @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 getEntityTagAsync(String resourceGroupName, String serviceName, String apiId, String operationId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(getEntityTagWithServiceResponseAsync(resourceGroupName, serviceName, apiId, operationId), serviceCallback); + } + + /** + * Gets the entity state (Etag) version of the API operation policy specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @param operationId Operation identifier within an API. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public Observable getEntityTagAsync(String resourceGroupName, String serviceName, String apiId, String operationId) { + return getEntityTagWithServiceResponseAsync(resourceGroupName, serviceName, apiId, operationId).map(new Func1, Void>() { + @Override + public Void call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Gets the entity state (Etag) version of the API operation policy specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @param operationId Operation identifier within an API. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public Observable> getEntityTagWithServiceResponseAsync(String resourceGroupName, String serviceName, String apiId, String operationId) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (apiId == null) { + throw new IllegalArgumentException("Parameter apiId is required and cannot be null."); + } + if (operationId == null) { + throw new IllegalArgumentException("Parameter operationId is required and cannot be null."); + } + 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 policyId = "policy"; + return service.getEntityTag(resourceGroupName, serviceName, apiId, operationId, policyId, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = getEntityTagDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponseWithHeaders getEntityTagDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .buildEmptyWithHeaders(response, ApiOperationPolicyGetEntityTagHeaders.class); + } + + /** + * Get the policy configuration at the API Operation level. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @param operationId Operation identifier within an API. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PolicyContractInner object if successful. + */ + public PolicyContractInner get(String resourceGroupName, String serviceName, String apiId, String operationId) { + return getWithServiceResponseAsync(resourceGroupName, serviceName, apiId, operationId).toBlocking().single().body(); + } + + /** + * Get the policy configuration at the API Operation level. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @param operationId Operation identifier within an API. Must be unique in the current API Management service instance. + * @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 getAsync(String resourceGroupName, String serviceName, String apiId, String operationId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(getWithServiceResponseAsync(resourceGroupName, serviceName, apiId, operationId), serviceCallback); + } + + /** + * Get the policy configuration at the API Operation level. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @param operationId Operation identifier within an API. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PolicyContractInner object + */ + public Observable getAsync(String resourceGroupName, String serviceName, String apiId, String operationId) { + return getWithServiceResponseAsync(resourceGroupName, serviceName, apiId, operationId).map(new Func1, PolicyContractInner>() { + @Override + public PolicyContractInner call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Get the policy configuration at the API Operation level. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @param operationId Operation identifier within an API. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PolicyContractInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String serviceName, String apiId, String operationId) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (apiId == null) { + throw new IllegalArgumentException("Parameter apiId is required and cannot be null."); + } + if (operationId == null) { + throw new IllegalArgumentException("Parameter operationId is required and cannot be null."); + } + 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 policyId = "policy"; + final PolicyExportFormat format = null; + return service.get(resourceGroupName, serviceName, apiId, operationId, policyId, this.client.subscriptionId(), format, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = getDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Get the policy configuration at the API Operation level. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @param operationId Operation identifier within an API. Must be unique in the current API Management service instance. + * @param format Policy Export Format. Possible values include: 'xml', 'rawxml' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PolicyContractInner object if successful. + */ + public PolicyContractInner get(String resourceGroupName, String serviceName, String apiId, String operationId, PolicyExportFormat format) { + return getWithServiceResponseAsync(resourceGroupName, serviceName, apiId, operationId, format).toBlocking().single().body(); + } + + /** + * Get the policy configuration at the API Operation level. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @param operationId Operation identifier within an API. Must be unique in the current API Management service instance. + * @param format Policy Export Format. Possible values include: 'xml', 'rawxml' + * @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 getAsync(String resourceGroupName, String serviceName, String apiId, String operationId, PolicyExportFormat format, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(getWithServiceResponseAsync(resourceGroupName, serviceName, apiId, operationId, format), serviceCallback); + } + + /** + * Get the policy configuration at the API Operation level. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @param operationId Operation identifier within an API. Must be unique in the current API Management service instance. + * @param format Policy Export Format. Possible values include: 'xml', 'rawxml' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PolicyContractInner object + */ + public Observable getAsync(String resourceGroupName, String serviceName, String apiId, String operationId, PolicyExportFormat format) { + return getWithServiceResponseAsync(resourceGroupName, serviceName, apiId, operationId, format).map(new Func1, PolicyContractInner>() { + @Override + public PolicyContractInner call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Get the policy configuration at the API Operation level. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @param operationId Operation identifier within an API. Must be unique in the current API Management service instance. + * @param format Policy Export Format. Possible values include: 'xml', 'rawxml' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PolicyContractInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String serviceName, String apiId, String operationId, PolicyExportFormat format) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (apiId == null) { + throw new IllegalArgumentException("Parameter apiId is required and cannot be null."); + } + if (operationId == null) { + throw new IllegalArgumentException("Parameter operationId is required and cannot be null."); + } + 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 policyId = "policy"; + return service.get(resourceGroupName, serviceName, apiId, operationId, policyId, this.client.subscriptionId(), format, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = getDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponseWithHeaders getDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .buildWithHeaders(response, ApiOperationPolicyGetHeaders.class); + } + + /** + * Creates or updates policy configuration for the API Operation level. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @param operationId Operation identifier within an API. Must be unique in the current API Management service instance. + * @param parameters The policy contents to apply. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PolicyContractInner object if successful. + */ + public PolicyContractInner createOrUpdate(String resourceGroupName, String serviceName, String apiId, String operationId, PolicyContractInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serviceName, apiId, operationId, parameters).toBlocking().single().body(); + } + + /** + * Creates or updates policy configuration for the API Operation level. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @param operationId Operation identifier within an API. Must be unique in the current API Management service instance. + * @param parameters The policy contents to apply. + * @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 createOrUpdateAsync(String resourceGroupName, String serviceName, String apiId, String operationId, PolicyContractInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, serviceName, apiId, operationId, parameters), serviceCallback); + } + + /** + * Creates or updates policy configuration for the API Operation level. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @param operationId Operation identifier within an API. Must be unique in the current API Management service instance. + * @param parameters The policy contents to apply. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PolicyContractInner object + */ + public Observable createOrUpdateAsync(String resourceGroupName, String serviceName, String apiId, String operationId, PolicyContractInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serviceName, apiId, operationId, parameters).map(new Func1, PolicyContractInner>() { + @Override + public PolicyContractInner call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Creates or updates policy configuration for the API Operation level. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @param operationId Operation identifier within an API. Must be unique in the current API Management service instance. + * @param parameters The policy contents to apply. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PolicyContractInner object + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String serviceName, String apiId, String operationId, PolicyContractInner parameters) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (apiId == null) { + throw new IllegalArgumentException("Parameter apiId is required and cannot be null."); + } + if (operationId == null) { + throw new IllegalArgumentException("Parameter operationId is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(parameters); + final String policyId = "policy"; + final String ifMatch = null; + return service.createOrUpdate(resourceGroupName, serviceName, apiId, operationId, policyId, this.client.subscriptionId(), parameters, ifMatch, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = createOrUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Creates or updates policy configuration for the API Operation level. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @param operationId Operation identifier within an API. Must be unique in the current API Management service instance. + * @param parameters The policy contents to apply. + * @param ifMatch ETag of the Entity. Not required when creating an entity, but required when updating an entity. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PolicyContractInner object if successful. + */ + public PolicyContractInner createOrUpdate(String resourceGroupName, String serviceName, String apiId, String operationId, PolicyContractInner parameters, String ifMatch) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serviceName, apiId, operationId, parameters, ifMatch).toBlocking().single().body(); + } + + /** + * Creates or updates policy configuration for the API Operation level. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @param operationId Operation identifier within an API. Must be unique in the current API Management service instance. + * @param parameters The policy contents to apply. + * @param ifMatch ETag of the Entity. Not required when creating an entity, but required when updating an entity. + * @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 createOrUpdateAsync(String resourceGroupName, String serviceName, String apiId, String operationId, PolicyContractInner parameters, String ifMatch, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, serviceName, apiId, operationId, parameters, ifMatch), serviceCallback); + } + + /** + * Creates or updates policy configuration for the API Operation level. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @param operationId Operation identifier within an API. Must be unique in the current API Management service instance. + * @param parameters The policy contents to apply. + * @param ifMatch ETag of the Entity. Not required when creating an entity, but required when updating an entity. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PolicyContractInner object + */ + public Observable createOrUpdateAsync(String resourceGroupName, String serviceName, String apiId, String operationId, PolicyContractInner parameters, String ifMatch) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serviceName, apiId, operationId, parameters, ifMatch).map(new Func1, PolicyContractInner>() { + @Override + public PolicyContractInner call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Creates or updates policy configuration for the API Operation level. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @param operationId Operation identifier within an API. Must be unique in the current API Management service instance. + * @param parameters The policy contents to apply. + * @param ifMatch ETag of the Entity. Not required when creating an entity, but required when updating an entity. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PolicyContractInner object + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String serviceName, String apiId, String operationId, PolicyContractInner parameters, String ifMatch) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (apiId == null) { + throw new IllegalArgumentException("Parameter apiId is required and cannot be null."); + } + if (operationId == null) { + throw new IllegalArgumentException("Parameter operationId is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(parameters); + final String policyId = "policy"; + return service.createOrUpdate(resourceGroupName, serviceName, apiId, operationId, policyId, this.client.subscriptionId(), parameters, ifMatch, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = createOrUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponseWithHeaders createOrUpdateDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(201, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .buildWithHeaders(response, ApiOperationPolicyCreateOrUpdateHeaders.class); + } + + /** + * Deletes the policy configuration at the Api Operation. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @param operationId Operation identifier within an API. Must be unique in the current API Management service instance. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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 serviceName, String apiId, String operationId, String ifMatch) { + deleteWithServiceResponseAsync(resourceGroupName, serviceName, apiId, operationId, ifMatch).toBlocking().single().body(); + } + + /** + * Deletes the policy configuration at the Api Operation. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @param operationId Operation identifier within an API. Must be unique in the current API Management service instance. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @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 serviceName, String apiId, String operationId, String ifMatch, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, serviceName, apiId, operationId, ifMatch), serviceCallback); + } + + /** + * Deletes the policy configuration at the Api Operation. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @param operationId Operation identifier within an API. Must be unique in the current API Management service instance. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable deleteAsync(String resourceGroupName, String serviceName, String apiId, String operationId, String ifMatch) { + return deleteWithServiceResponseAsync(resourceGroupName, serviceName, apiId, operationId, ifMatch).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes the policy configuration at the Api Operation. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @param operationId Operation identifier within an API. Must be unique in the current API Management service instance. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> deleteWithServiceResponseAsync(String resourceGroupName, String serviceName, String apiId, String operationId, String ifMatch) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (apiId == null) { + throw new IllegalArgumentException("Parameter apiId is required and cannot be null."); + } + if (operationId == null) { + throw new IllegalArgumentException("Parameter operationId is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (ifMatch == null) { + throw new IllegalArgumentException("Parameter ifMatch 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 policyId = "policy"; + return service.delete(resourceGroupName, serviceName, apiId, operationId, policyId, this.client.subscriptionId(), ifMatch, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = deleteDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse deleteDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(204, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ApiOperationsImpl.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ApiOperationsImpl.java new file mode 100644 index 0000000000000..e80c055cf70fe --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ApiOperationsImpl.java @@ -0,0 +1,87 @@ +/** + * 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.apimanagement.v2019_01_01.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.apimanagement.v2019_01_01.ApiOperations; +import rx.Completable; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.apimanagement.v2019_01_01.OperationContract; + +class ApiOperationsImpl extends WrapperImpl implements ApiOperations { + private final ApiManagementManager manager; + + ApiOperationsImpl(ApiManagementManager manager) { + super(manager.inner().apiOperations()); + this.manager = manager; + } + + public ApiManagementManager manager() { + return this.manager; + } + + @Override + public OperationContractImpl define(String name) { + return wrapModel(name); + } + + private OperationContractImpl wrapModel(OperationContractInner inner) { + return new OperationContractImpl(inner, manager()); + } + + private OperationContractImpl wrapModel(String name) { + return new OperationContractImpl(name, this.manager()); + } + + @Override + public Completable getEntityTagAsync(String resourceGroupName, String serviceName, String apiId, String operationId) { + ApiOperationsInner client = this.inner(); + return client.getEntityTagAsync(resourceGroupName, serviceName, apiId, operationId).toCompletable(); + } + + @Override + public Observable listByApiAsync(final String resourceGroupName, final String serviceName, final String apiId) { + ApiOperationsInner client = this.inner(); + return client.listByApiAsync(resourceGroupName, serviceName, apiId) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public OperationContract call(OperationContractInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Observable getAsync(String resourceGroupName, String serviceName, String apiId, String operationId) { + ApiOperationsInner client = this.inner(); + return client.getAsync(resourceGroupName, serviceName, apiId, operationId) + .map(new Func1() { + @Override + public OperationContract call(OperationContractInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Completable deleteAsync(String resourceGroupName, String serviceName, String apiId, String operationId, String ifMatch) { + ApiOperationsInner client = this.inner(); + return client.deleteAsync(resourceGroupName, serviceName, apiId, operationId, ifMatch).toCompletable(); + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ApiOperationsInner.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ApiOperationsInner.java new file mode 100644 index 0000000000000..1b7a92f5e98fe --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ApiOperationsInner.java @@ -0,0 +1,1126 @@ +/** + * 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.apimanagement.v2019_01_01.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.apimanagement.v2019_01_01.ApiOperationCreateOrUpdateHeaders; +import com.microsoft.azure.management.apimanagement.v2019_01_01.ApiOperationGetEntityTagHeaders; +import com.microsoft.azure.management.apimanagement.v2019_01_01.ApiOperationGetHeaders; +import com.microsoft.azure.management.apimanagement.v2019_01_01.ErrorResponseException; +import com.microsoft.azure.management.apimanagement.v2019_01_01.OperationUpdateContract; +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.ServiceResponseWithHeaders; +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.HEAD; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.HTTP; +import retrofit2.http.PATCH; +import retrofit2.http.Path; +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 ApiOperations. + */ +public class ApiOperationsInner { + /** The Retrofit service to perform REST calls. */ + private ApiOperationsService service; + /** The service client containing this operation class. */ + private ApiManagementClientImpl client; + + /** + * Initializes an instance of ApiOperationsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public ApiOperationsInner(Retrofit retrofit, ApiManagementClientImpl client) { + this.service = retrofit.create(ApiOperationsService.class); + this.client = client; + } + + /** + * The interface defining all the services for ApiOperations to be + * used by Retrofit to perform actually REST calls. + */ + interface ApiOperationsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.apimanagement.v2019_01_01.ApiOperations listByApi" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/operations") + Observable> listByApi(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("apiId") String apiId, @Path("subscriptionId") String subscriptionId, @Query("$filter") String filter, @Query("$top") Integer top, @Query("$skip") Integer skip, @Query("tags") String tags, @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.apimanagement.v2019_01_01.ApiOperations getEntityTag" }) + @HEAD("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/operations/{operationId}") + Observable> getEntityTag(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("apiId") String apiId, @Path("operationId") String operationId, @Path("subscriptionId") String subscriptionId, @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.apimanagement.v2019_01_01.ApiOperations get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/operations/{operationId}") + Observable> get(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("apiId") String apiId, @Path("operationId") String operationId, @Path("subscriptionId") String subscriptionId, @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.apimanagement.v2019_01_01.ApiOperations createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/operations/{operationId}") + Observable> createOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("apiId") String apiId, @Path("operationId") String operationId, @Path("subscriptionId") String subscriptionId, @Body OperationContractInner parameters, @Header("If-Match") String ifMatch, @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.apimanagement.v2019_01_01.ApiOperations update" }) + @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/operations/{operationId}") + Observable> update(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("apiId") String apiId, @Path("operationId") String operationId, @Path("subscriptionId") String subscriptionId, @Body OperationUpdateContract parameters, @Header("If-Match") String ifMatch, @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.apimanagement.v2019_01_01.ApiOperations delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/operations/{operationId}", method = "DELETE", hasBody = true) + Observable> delete(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("apiId") String apiId, @Path("operationId") String operationId, @Path("subscriptionId") String subscriptionId, @Header("If-Match") String ifMatch, @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.apimanagement.v2019_01_01.ApiOperations listByApiNext" }) + @GET + Observable> listByApiNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Lists a collection of the operations for the specified API. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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<OperationContractInner> object if successful. + */ + public PagedList listByApi(final String resourceGroupName, final String serviceName, final String apiId) { + ServiceResponse> response = listByApiSinglePageAsync(resourceGroupName, serviceName, apiId).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByApiNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists a collection of the operations for the specified API. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @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> listByApiAsync(final String resourceGroupName, final String serviceName, final String apiId, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByApiSinglePageAsync(resourceGroupName, serviceName, apiId), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByApiNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists a collection of the operations for the specified API. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<OperationContractInner> object + */ + public Observable> listByApiAsync(final String resourceGroupName, final String serviceName, final String apiId) { + return listByApiWithServiceResponseAsync(resourceGroupName, serviceName, apiId) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists a collection of the operations for the specified API. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<OperationContractInner> object + */ + public Observable>> listByApiWithServiceResponseAsync(final String resourceGroupName, final String serviceName, final String apiId) { + return listByApiSinglePageAsync(resourceGroupName, serviceName, apiId) + .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(listByApiNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists a collection of the operations for the specified API. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<OperationContractInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByApiSinglePageAsync(final String resourceGroupName, final String serviceName, final String apiId) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (apiId == null) { + throw new IllegalArgumentException("Parameter apiId is required and cannot be null."); + } + 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 filter = null; + final Integer top = null; + final Integer skip = null; + final String tags = null; + return service.listByApi(resourceGroupName, serviceName, apiId, this.client.subscriptionId(), filter, top, skip, tags, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByApiDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Lists a collection of the operations for the specified API. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| method | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| urlTemplate | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br> + * @param top Number of records to return. + * @param skip Number of records to skip. + * @param tags Include tags in the response. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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<OperationContractInner> object if successful. + */ + public PagedList listByApi(final String resourceGroupName, final String serviceName, final String apiId, final String filter, final Integer top, final Integer skip, final String tags) { + ServiceResponse> response = listByApiSinglePageAsync(resourceGroupName, serviceName, apiId, filter, top, skip, tags).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByApiNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists a collection of the operations for the specified API. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| method | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| urlTemplate | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br> + * @param top Number of records to return. + * @param skip Number of records to skip. + * @param tags Include tags in the response. + * @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> listByApiAsync(final String resourceGroupName, final String serviceName, final String apiId, final String filter, final Integer top, final Integer skip, final String tags, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByApiSinglePageAsync(resourceGroupName, serviceName, apiId, filter, top, skip, tags), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByApiNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists a collection of the operations for the specified API. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| method | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| urlTemplate | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br> + * @param top Number of records to return. + * @param skip Number of records to skip. + * @param tags Include tags in the response. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<OperationContractInner> object + */ + public Observable> listByApiAsync(final String resourceGroupName, final String serviceName, final String apiId, final String filter, final Integer top, final Integer skip, final String tags) { + return listByApiWithServiceResponseAsync(resourceGroupName, serviceName, apiId, filter, top, skip, tags) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists a collection of the operations for the specified API. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| method | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| urlTemplate | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br> + * @param top Number of records to return. + * @param skip Number of records to skip. + * @param tags Include tags in the response. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<OperationContractInner> object + */ + public Observable>> listByApiWithServiceResponseAsync(final String resourceGroupName, final String serviceName, final String apiId, final String filter, final Integer top, final Integer skip, final String tags) { + return listByApiSinglePageAsync(resourceGroupName, serviceName, apiId, filter, top, skip, tags) + .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(listByApiNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists a collection of the operations for the specified API. + * + ServiceResponse> * @param resourceGroupName The name of the resource group. + ServiceResponse> * @param serviceName The name of the API Management service. + ServiceResponse> * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + ServiceResponse> * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| method | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| urlTemplate | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br> + ServiceResponse> * @param top Number of records to return. + ServiceResponse> * @param skip Number of records to skip. + ServiceResponse> * @param tags Include tags in the response. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<OperationContractInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByApiSinglePageAsync(final String resourceGroupName, final String serviceName, final String apiId, final String filter, final Integer top, final Integer skip, final String tags) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (apiId == null) { + throw new IllegalArgumentException("Parameter apiId is required and cannot be null."); + } + 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.listByApi(resourceGroupName, serviceName, apiId, this.client.subscriptionId(), filter, top, skip, tags, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByApiDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByApiDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Gets the entity state (Etag) version of the API operation specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @param operationId Operation identifier within an API. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void getEntityTag(String resourceGroupName, String serviceName, String apiId, String operationId) { + getEntityTagWithServiceResponseAsync(resourceGroupName, serviceName, apiId, operationId).toBlocking().single().body(); + } + + /** + * Gets the entity state (Etag) version of the API operation specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @param operationId Operation identifier within an API. Must be unique in the current API Management service instance. + * @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 getEntityTagAsync(String resourceGroupName, String serviceName, String apiId, String operationId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(getEntityTagWithServiceResponseAsync(resourceGroupName, serviceName, apiId, operationId), serviceCallback); + } + + /** + * Gets the entity state (Etag) version of the API operation specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @param operationId Operation identifier within an API. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public Observable getEntityTagAsync(String resourceGroupName, String serviceName, String apiId, String operationId) { + return getEntityTagWithServiceResponseAsync(resourceGroupName, serviceName, apiId, operationId).map(new Func1, Void>() { + @Override + public Void call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Gets the entity state (Etag) version of the API operation specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @param operationId Operation identifier within an API. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public Observable> getEntityTagWithServiceResponseAsync(String resourceGroupName, String serviceName, String apiId, String operationId) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (apiId == null) { + throw new IllegalArgumentException("Parameter apiId is required and cannot be null."); + } + if (operationId == null) { + throw new IllegalArgumentException("Parameter operationId is required and cannot be null."); + } + 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.getEntityTag(resourceGroupName, serviceName, apiId, operationId, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = getEntityTagDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponseWithHeaders getEntityTagDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .buildEmptyWithHeaders(response, ApiOperationGetEntityTagHeaders.class); + } + + /** + * Gets the details of the API Operation specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @param operationId Operation identifier within an API. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the OperationContractInner object if successful. + */ + public OperationContractInner get(String resourceGroupName, String serviceName, String apiId, String operationId) { + return getWithServiceResponseAsync(resourceGroupName, serviceName, apiId, operationId).toBlocking().single().body(); + } + + /** + * Gets the details of the API Operation specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @param operationId Operation identifier within an API. Must be unique in the current API Management service instance. + * @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 getAsync(String resourceGroupName, String serviceName, String apiId, String operationId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(getWithServiceResponseAsync(resourceGroupName, serviceName, apiId, operationId), serviceCallback); + } + + /** + * Gets the details of the API Operation specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @param operationId Operation identifier within an API. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the OperationContractInner object + */ + public Observable getAsync(String resourceGroupName, String serviceName, String apiId, String operationId) { + return getWithServiceResponseAsync(resourceGroupName, serviceName, apiId, operationId).map(new Func1, OperationContractInner>() { + @Override + public OperationContractInner call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Gets the details of the API Operation specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @param operationId Operation identifier within an API. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the OperationContractInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String serviceName, String apiId, String operationId) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (apiId == null) { + throw new IllegalArgumentException("Parameter apiId is required and cannot be null."); + } + if (operationId == null) { + throw new IllegalArgumentException("Parameter operationId is required and cannot be null."); + } + 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.get(resourceGroupName, serviceName, apiId, operationId, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = getDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponseWithHeaders getDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .buildWithHeaders(response, ApiOperationGetHeaders.class); + } + + /** + * Creates a new operation in the API or updates an existing one. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @param operationId Operation identifier within an API. Must be unique in the current API Management service instance. + * @param parameters Create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the OperationContractInner object if successful. + */ + public OperationContractInner createOrUpdate(String resourceGroupName, String serviceName, String apiId, String operationId, OperationContractInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serviceName, apiId, operationId, parameters).toBlocking().single().body(); + } + + /** + * Creates a new operation in the API or updates an existing one. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @param operationId Operation identifier within an API. Must be unique in the current API Management service instance. + * @param parameters Create parameters. + * @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 createOrUpdateAsync(String resourceGroupName, String serviceName, String apiId, String operationId, OperationContractInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, serviceName, apiId, operationId, parameters), serviceCallback); + } + + /** + * Creates a new operation in the API or updates an existing one. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @param operationId Operation identifier within an API. Must be unique in the current API Management service instance. + * @param parameters Create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the OperationContractInner object + */ + public Observable createOrUpdateAsync(String resourceGroupName, String serviceName, String apiId, String operationId, OperationContractInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serviceName, apiId, operationId, parameters).map(new Func1, OperationContractInner>() { + @Override + public OperationContractInner call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Creates a new operation in the API or updates an existing one. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @param operationId Operation identifier within an API. Must be unique in the current API Management service instance. + * @param parameters Create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the OperationContractInner object + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String serviceName, String apiId, String operationId, OperationContractInner parameters) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (apiId == null) { + throw new IllegalArgumentException("Parameter apiId is required and cannot be null."); + } + if (operationId == null) { + throw new IllegalArgumentException("Parameter operationId is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(parameters); + final String ifMatch = null; + return service.createOrUpdate(resourceGroupName, serviceName, apiId, operationId, this.client.subscriptionId(), parameters, ifMatch, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = createOrUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Creates a new operation in the API or updates an existing one. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @param operationId Operation identifier within an API. Must be unique in the current API Management service instance. + * @param parameters Create parameters. + * @param ifMatch ETag of the Entity. Not required when creating an entity, but required when updating an entity. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the OperationContractInner object if successful. + */ + public OperationContractInner createOrUpdate(String resourceGroupName, String serviceName, String apiId, String operationId, OperationContractInner parameters, String ifMatch) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serviceName, apiId, operationId, parameters, ifMatch).toBlocking().single().body(); + } + + /** + * Creates a new operation in the API or updates an existing one. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @param operationId Operation identifier within an API. Must be unique in the current API Management service instance. + * @param parameters Create parameters. + * @param ifMatch ETag of the Entity. Not required when creating an entity, but required when updating an entity. + * @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 createOrUpdateAsync(String resourceGroupName, String serviceName, String apiId, String operationId, OperationContractInner parameters, String ifMatch, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, serviceName, apiId, operationId, parameters, ifMatch), serviceCallback); + } + + /** + * Creates a new operation in the API or updates an existing one. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @param operationId Operation identifier within an API. Must be unique in the current API Management service instance. + * @param parameters Create parameters. + * @param ifMatch ETag of the Entity. Not required when creating an entity, but required when updating an entity. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the OperationContractInner object + */ + public Observable createOrUpdateAsync(String resourceGroupName, String serviceName, String apiId, String operationId, OperationContractInner parameters, String ifMatch) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serviceName, apiId, operationId, parameters, ifMatch).map(new Func1, OperationContractInner>() { + @Override + public OperationContractInner call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Creates a new operation in the API or updates an existing one. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @param operationId Operation identifier within an API. Must be unique in the current API Management service instance. + * @param parameters Create parameters. + * @param ifMatch ETag of the Entity. Not required when creating an entity, but required when updating an entity. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the OperationContractInner object + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String serviceName, String apiId, String operationId, OperationContractInner parameters, String ifMatch) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (apiId == null) { + throw new IllegalArgumentException("Parameter apiId is required and cannot be null."); + } + if (operationId == null) { + throw new IllegalArgumentException("Parameter operationId is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(parameters); + return service.createOrUpdate(resourceGroupName, serviceName, apiId, operationId, this.client.subscriptionId(), parameters, ifMatch, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = createOrUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponseWithHeaders createOrUpdateDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(201, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .buildWithHeaders(response, ApiOperationCreateOrUpdateHeaders.class); + } + + /** + * Updates the details of the operation in the API specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @param operationId Operation identifier within an API. Must be unique in the current API Management service instance. + * @param parameters API Operation Update parameters. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void update(String resourceGroupName, String serviceName, String apiId, String operationId, OperationUpdateContract parameters, String ifMatch) { + updateWithServiceResponseAsync(resourceGroupName, serviceName, apiId, operationId, parameters, ifMatch).toBlocking().single().body(); + } + + /** + * Updates the details of the operation in the API specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @param operationId Operation identifier within an API. Must be unique in the current API Management service instance. + * @param parameters API Operation Update parameters. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @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 serviceName, String apiId, String operationId, OperationUpdateContract parameters, String ifMatch, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateWithServiceResponseAsync(resourceGroupName, serviceName, apiId, operationId, parameters, ifMatch), serviceCallback); + } + + /** + * Updates the details of the operation in the API specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @param operationId Operation identifier within an API. Must be unique in the current API Management service instance. + * @param parameters API Operation Update parameters. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable updateAsync(String resourceGroupName, String serviceName, String apiId, String operationId, OperationUpdateContract parameters, String ifMatch) { + return updateWithServiceResponseAsync(resourceGroupName, serviceName, apiId, operationId, parameters, ifMatch).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates the details of the operation in the API specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @param operationId Operation identifier within an API. Must be unique in the current API Management service instance. + * @param parameters API Operation Update parameters. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> updateWithServiceResponseAsync(String resourceGroupName, String serviceName, String apiId, String operationId, OperationUpdateContract parameters, String ifMatch) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (apiId == null) { + throw new IllegalArgumentException("Parameter apiId is required and cannot be null."); + } + if (operationId == null) { + throw new IllegalArgumentException("Parameter operationId is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + if (ifMatch == null) { + throw new IllegalArgumentException("Parameter ifMatch is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(parameters); + return service.update(resourceGroupName, serviceName, apiId, operationId, this.client.subscriptionId(), parameters, ifMatch, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = updateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse updateDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(204, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Deletes the specified operation in the API. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @param operationId Operation identifier within an API. Must be unique in the current API Management service instance. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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 serviceName, String apiId, String operationId, String ifMatch) { + deleteWithServiceResponseAsync(resourceGroupName, serviceName, apiId, operationId, ifMatch).toBlocking().single().body(); + } + + /** + * Deletes the specified operation in the API. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @param operationId Operation identifier within an API. Must be unique in the current API Management service instance. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @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 serviceName, String apiId, String operationId, String ifMatch, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, serviceName, apiId, operationId, ifMatch), serviceCallback); + } + + /** + * Deletes the specified operation in the API. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @param operationId Operation identifier within an API. Must be unique in the current API Management service instance. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable deleteAsync(String resourceGroupName, String serviceName, String apiId, String operationId, String ifMatch) { + return deleteWithServiceResponseAsync(resourceGroupName, serviceName, apiId, operationId, ifMatch).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes the specified operation in the API. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @param operationId Operation identifier within an API. Must be unique in the current API Management service instance. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> deleteWithServiceResponseAsync(String resourceGroupName, String serviceName, String apiId, String operationId, String ifMatch) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (apiId == null) { + throw new IllegalArgumentException("Parameter apiId is required and cannot be null."); + } + if (operationId == null) { + throw new IllegalArgumentException("Parameter operationId is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (ifMatch == null) { + throw new IllegalArgumentException("Parameter ifMatch 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.delete(resourceGroupName, serviceName, apiId, operationId, this.client.subscriptionId(), ifMatch, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = deleteDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse deleteDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(204, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists a collection of the operations for the specified API. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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<OperationContractInner> object if successful. + */ + public PagedList listByApiNext(final String nextPageLink) { + ServiceResponse> response = listByApiNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByApiNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists a collection of the operations for the specified API. + * + * @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> listByApiNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByApiNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByApiNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists a collection of the operations for the specified API. + * + * @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<OperationContractInner> object + */ + public Observable> listByApiNextAsync(final String nextPageLink) { + return listByApiNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists a collection of the operations for the specified API. + * + * @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<OperationContractInner> object + */ + public Observable>> listByApiNextWithServiceResponseAsync(final String nextPageLink) { + return listByApiNextSinglePageAsync(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(listByApiNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists a collection of the operations for the specified API. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<OperationContractInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByApiNextSinglePageAsync(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.listByApiNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByApiNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByApiNextDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ApiPolicyContractImpl.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ApiPolicyContractImpl.java new file mode 100644 index 0000000000000..d85ac4717f3e5 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ApiPolicyContractImpl.java @@ -0,0 +1,130 @@ +/** + * 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.apimanagement.v2019_01_01.implementation; + +import com.microsoft.azure.management.apimanagement.v2019_01_01.ApiPolicyContract; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import com.microsoft.azure.management.apimanagement.v2019_01_01.PolicyContentFormat; + +class ApiPolicyContractImpl extends CreatableUpdatableImpl implements ApiPolicyContract, ApiPolicyContract.Definition, ApiPolicyContract.Update { + private final ApiManagementManager manager; + private String resourceGroupName; + private String serviceName; + private String apiId; + private String cifMatch; + private String uifMatch; + + ApiPolicyContractImpl(String name, ApiManagementManager manager) { + super(name, new PolicyContractInner()); + this.manager = manager; + // Set resource name + this.apiId = name; + // + } + + ApiPolicyContractImpl(PolicyContractInner inner, ApiManagementManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.apiId = inner.name(); + // set resource ancestor and positional variables + this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourceGroups"); + this.serviceName = IdParsingUtils.getValueFromIdByName(inner.id(), "service"); + this.apiId = IdParsingUtils.getValueFromIdByName(inner.id(), "apis"); + // + } + + @Override + public ApiManagementManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + ApiPolicysInner client = this.manager().inner().apiPolicys(); + return client.createOrUpdateAsync(this.resourceGroupName, this.serviceName, this.apiId, this.inner(), this.cifMatch) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + ApiPolicysInner client = this.manager().inner().apiPolicys(); + return client.createOrUpdateAsync(this.resourceGroupName, this.serviceName, this.apiId, this.inner(), this.uifMatch) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + ApiPolicysInner client = this.manager().inner().apiPolicys(); + return client.getAsync(this.resourceGroupName, this.serviceName, this.apiId); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + + @Override + public PolicyContentFormat format() { + return this.inner().format(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public String value() { + return this.inner().value(); + } + + @Override + public ApiPolicyContractImpl withExistingApi(String resourceGroupName, String serviceName, String apiId) { + this.resourceGroupName = resourceGroupName; + this.serviceName = serviceName; + this.apiId = apiId; + return this; + } + + @Override + public ApiPolicyContractImpl withValue(String value) { + this.inner().withValue(value); + return this; + } + + @Override + public ApiPolicyContractImpl withIfMatch(String ifMatch) { + if (isInCreateMode()) { + this.cifMatch = ifMatch; + } else { + this.uifMatch = ifMatch; + } + return this; + } + + @Override + public ApiPolicyContractImpl withFormat(PolicyContentFormat format) { + this.inner().withFormat(format); + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ApiPolicysImpl.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ApiPolicysImpl.java new file mode 100644 index 0000000000000..5721e28cb3502 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ApiPolicysImpl.java @@ -0,0 +1,81 @@ +/** + * 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.apimanagement.v2019_01_01.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.apimanagement.v2019_01_01.ApiPolicys; +import rx.Completable; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.management.apimanagement.v2019_01_01.PolicyCollection; +import com.microsoft.azure.management.apimanagement.v2019_01_01.ApiPolicyContract; + +class ApiPolicysImpl extends WrapperImpl implements ApiPolicys { + private final ApiManagementManager manager; + + ApiPolicysImpl(ApiManagementManager manager) { + super(manager.inner().apiPolicys()); + this.manager = manager; + } + + public ApiManagementManager manager() { + return this.manager; + } + + @Override + public ApiPolicyContractImpl define(String name) { + return wrapModel(name); + } + + private ApiPolicyContractImpl wrapModel(PolicyContractInner inner) { + return new ApiPolicyContractImpl(inner, manager()); + } + + private ApiPolicyContractImpl wrapModel(String name) { + return new ApiPolicyContractImpl(name, this.manager()); + } + + @Override + public Observable listByApiAsync(String resourceGroupName, String serviceName, String apiId) { + ApiPolicysInner client = this.inner(); + return client.listByApiAsync(resourceGroupName, serviceName, apiId) + .map(new Func1() { + @Override + public PolicyCollection call(PolicyCollectionInner inner) { + return new PolicyCollectionImpl(inner, manager()); + } + }); + } + + @Override + public Completable getEntityTagAsync(String resourceGroupName, String serviceName, String apiId) { + ApiPolicysInner client = this.inner(); + return client.getEntityTagAsync(resourceGroupName, serviceName, apiId).toCompletable(); + } + + @Override + public Observable getAsync(String resourceGroupName, String serviceName, String apiId) { + ApiPolicysInner client = this.inner(); + return client.getAsync(resourceGroupName, serviceName, apiId) + .map(new Func1() { + @Override + public ApiPolicyContract call(PolicyContractInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Completable deleteAsync(String resourceGroupName, String serviceName, String apiId, String ifMatch) { + ApiPolicysInner client = this.inner(); + return client.deleteAsync(resourceGroupName, serviceName, apiId, ifMatch).toCompletable(); + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ApiPolicysInner.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ApiPolicysInner.java new file mode 100644 index 0000000000000..c8bf138258259 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ApiPolicysInner.java @@ -0,0 +1,762 @@ +/** + * 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.apimanagement.v2019_01_01.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.management.apimanagement.v2019_01_01.ApiPolicyCreateOrUpdateHeaders; +import com.microsoft.azure.management.apimanagement.v2019_01_01.ApiPolicyGetEntityTagHeaders; +import com.microsoft.azure.management.apimanagement.v2019_01_01.ApiPolicyGetHeaders; +import com.microsoft.azure.management.apimanagement.v2019_01_01.ErrorResponseException; +import com.microsoft.azure.management.apimanagement.v2019_01_01.PolicyExportFormat; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import com.microsoft.rest.ServiceResponseWithHeaders; +import com.microsoft.rest.Validator; +import java.io.IOException; +import okhttp3.ResponseBody; +import retrofit2.http.Body; +import retrofit2.http.GET; +import retrofit2.http.HEAD; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.HTTP; +import retrofit2.http.Path; +import retrofit2.http.PUT; +import retrofit2.http.Query; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in ApiPolicys. + */ +public class ApiPolicysInner { + /** The Retrofit service to perform REST calls. */ + private ApiPolicysService service; + /** The service client containing this operation class. */ + private ApiManagementClientImpl client; + + /** + * Initializes an instance of ApiPolicysInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public ApiPolicysInner(Retrofit retrofit, ApiManagementClientImpl client) { + this.service = retrofit.create(ApiPolicysService.class); + this.client = client; + } + + /** + * The interface defining all the services for ApiPolicys to be + * used by Retrofit to perform actually REST calls. + */ + interface ApiPolicysService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.apimanagement.v2019_01_01.ApiPolicys listByApi" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/policies") + Observable> listByApi(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("apiId") String apiId, @Path("subscriptionId") String subscriptionId, @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.apimanagement.v2019_01_01.ApiPolicys getEntityTag" }) + @HEAD("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/policies/{policyId}") + Observable> getEntityTag(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("apiId") String apiId, @Path("policyId") String policyId, @Path("subscriptionId") String subscriptionId, @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.apimanagement.v2019_01_01.ApiPolicys get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/policies/{policyId}") + Observable> get(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("apiId") String apiId, @Path("policyId") String policyId, @Path("subscriptionId") String subscriptionId, @Query("format") PolicyExportFormat format, @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.apimanagement.v2019_01_01.ApiPolicys createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/policies/{policyId}") + Observable> createOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("apiId") String apiId, @Path("policyId") String policyId, @Path("subscriptionId") String subscriptionId, @Body PolicyContractInner parameters, @Header("If-Match") String ifMatch, @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.apimanagement.v2019_01_01.ApiPolicys delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/policies/{policyId}", method = "DELETE", hasBody = true) + Observable> delete(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("apiId") String apiId, @Path("policyId") String policyId, @Path("subscriptionId") String subscriptionId, @Header("If-Match") String ifMatch, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Get the policy configuration at the API level. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PolicyCollectionInner object if successful. + */ + public PolicyCollectionInner listByApi(String resourceGroupName, String serviceName, String apiId) { + return listByApiWithServiceResponseAsync(resourceGroupName, serviceName, apiId).toBlocking().single().body(); + } + + /** + * Get the policy configuration at the API level. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @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 listByApiAsync(String resourceGroupName, String serviceName, String apiId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(listByApiWithServiceResponseAsync(resourceGroupName, serviceName, apiId), serviceCallback); + } + + /** + * Get the policy configuration at the API level. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PolicyCollectionInner object + */ + public Observable listByApiAsync(String resourceGroupName, String serviceName, String apiId) { + return listByApiWithServiceResponseAsync(resourceGroupName, serviceName, apiId).map(new Func1, PolicyCollectionInner>() { + @Override + public PolicyCollectionInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Get the policy configuration at the API level. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PolicyCollectionInner object + */ + public Observable> listByApiWithServiceResponseAsync(String resourceGroupName, String serviceName, String apiId) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (apiId == null) { + throw new IllegalArgumentException("Parameter apiId is required and cannot be null."); + } + 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.listByApi(resourceGroupName, serviceName, apiId, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = listByApiDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse listByApiDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Gets the entity state (Etag) version of the API policy specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void getEntityTag(String resourceGroupName, String serviceName, String apiId) { + getEntityTagWithServiceResponseAsync(resourceGroupName, serviceName, apiId).toBlocking().single().body(); + } + + /** + * Gets the entity state (Etag) version of the API policy specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @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 getEntityTagAsync(String resourceGroupName, String serviceName, String apiId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(getEntityTagWithServiceResponseAsync(resourceGroupName, serviceName, apiId), serviceCallback); + } + + /** + * Gets the entity state (Etag) version of the API policy specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public Observable getEntityTagAsync(String resourceGroupName, String serviceName, String apiId) { + return getEntityTagWithServiceResponseAsync(resourceGroupName, serviceName, apiId).map(new Func1, Void>() { + @Override + public Void call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Gets the entity state (Etag) version of the API policy specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public Observable> getEntityTagWithServiceResponseAsync(String resourceGroupName, String serviceName, String apiId) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (apiId == null) { + throw new IllegalArgumentException("Parameter apiId is required and cannot be null."); + } + 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 policyId = "policy"; + return service.getEntityTag(resourceGroupName, serviceName, apiId, policyId, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = getEntityTagDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponseWithHeaders getEntityTagDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .buildEmptyWithHeaders(response, ApiPolicyGetEntityTagHeaders.class); + } + + /** + * Get the policy configuration at the API level. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PolicyContractInner object if successful. + */ + public PolicyContractInner get(String resourceGroupName, String serviceName, String apiId) { + return getWithServiceResponseAsync(resourceGroupName, serviceName, apiId).toBlocking().single().body(); + } + + /** + * Get the policy configuration at the API level. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @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 getAsync(String resourceGroupName, String serviceName, String apiId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(getWithServiceResponseAsync(resourceGroupName, serviceName, apiId), serviceCallback); + } + + /** + * Get the policy configuration at the API level. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PolicyContractInner object + */ + public Observable getAsync(String resourceGroupName, String serviceName, String apiId) { + return getWithServiceResponseAsync(resourceGroupName, serviceName, apiId).map(new Func1, PolicyContractInner>() { + @Override + public PolicyContractInner call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Get the policy configuration at the API level. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PolicyContractInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String serviceName, String apiId) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (apiId == null) { + throw new IllegalArgumentException("Parameter apiId is required and cannot be null."); + } + 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 policyId = "policy"; + final PolicyExportFormat format = null; + return service.get(resourceGroupName, serviceName, apiId, policyId, this.client.subscriptionId(), format, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = getDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Get the policy configuration at the API level. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @param format Policy Export Format. Possible values include: 'xml', 'rawxml' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PolicyContractInner object if successful. + */ + public PolicyContractInner get(String resourceGroupName, String serviceName, String apiId, PolicyExportFormat format) { + return getWithServiceResponseAsync(resourceGroupName, serviceName, apiId, format).toBlocking().single().body(); + } + + /** + * Get the policy configuration at the API level. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @param format Policy Export Format. Possible values include: 'xml', 'rawxml' + * @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 getAsync(String resourceGroupName, String serviceName, String apiId, PolicyExportFormat format, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(getWithServiceResponseAsync(resourceGroupName, serviceName, apiId, format), serviceCallback); + } + + /** + * Get the policy configuration at the API level. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @param format Policy Export Format. Possible values include: 'xml', 'rawxml' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PolicyContractInner object + */ + public Observable getAsync(String resourceGroupName, String serviceName, String apiId, PolicyExportFormat format) { + return getWithServiceResponseAsync(resourceGroupName, serviceName, apiId, format).map(new Func1, PolicyContractInner>() { + @Override + public PolicyContractInner call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Get the policy configuration at the API level. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @param format Policy Export Format. Possible values include: 'xml', 'rawxml' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PolicyContractInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String serviceName, String apiId, PolicyExportFormat format) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (apiId == null) { + throw new IllegalArgumentException("Parameter apiId is required and cannot be null."); + } + 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 policyId = "policy"; + return service.get(resourceGroupName, serviceName, apiId, policyId, this.client.subscriptionId(), format, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = getDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponseWithHeaders getDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .buildWithHeaders(response, ApiPolicyGetHeaders.class); + } + + /** + * Creates or updates policy configuration for the API. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @param parameters The policy contents to apply. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PolicyContractInner object if successful. + */ + public PolicyContractInner createOrUpdate(String resourceGroupName, String serviceName, String apiId, PolicyContractInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serviceName, apiId, parameters).toBlocking().single().body(); + } + + /** + * Creates or updates policy configuration for the API. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @param parameters The policy contents to apply. + * @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 createOrUpdateAsync(String resourceGroupName, String serviceName, String apiId, PolicyContractInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, serviceName, apiId, parameters), serviceCallback); + } + + /** + * Creates or updates policy configuration for the API. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @param parameters The policy contents to apply. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PolicyContractInner object + */ + public Observable createOrUpdateAsync(String resourceGroupName, String serviceName, String apiId, PolicyContractInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serviceName, apiId, parameters).map(new Func1, PolicyContractInner>() { + @Override + public PolicyContractInner call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Creates or updates policy configuration for the API. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @param parameters The policy contents to apply. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PolicyContractInner object + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String serviceName, String apiId, PolicyContractInner parameters) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (apiId == null) { + throw new IllegalArgumentException("Parameter apiId is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(parameters); + final String policyId = "policy"; + final String ifMatch = null; + return service.createOrUpdate(resourceGroupName, serviceName, apiId, policyId, this.client.subscriptionId(), parameters, ifMatch, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = createOrUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Creates or updates policy configuration for the API. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @param parameters The policy contents to apply. + * @param ifMatch ETag of the Entity. Not required when creating an entity, but required when updating an entity. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PolicyContractInner object if successful. + */ + public PolicyContractInner createOrUpdate(String resourceGroupName, String serviceName, String apiId, PolicyContractInner parameters, String ifMatch) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serviceName, apiId, parameters, ifMatch).toBlocking().single().body(); + } + + /** + * Creates or updates policy configuration for the API. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @param parameters The policy contents to apply. + * @param ifMatch ETag of the Entity. Not required when creating an entity, but required when updating an entity. + * @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 createOrUpdateAsync(String resourceGroupName, String serviceName, String apiId, PolicyContractInner parameters, String ifMatch, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, serviceName, apiId, parameters, ifMatch), serviceCallback); + } + + /** + * Creates or updates policy configuration for the API. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @param parameters The policy contents to apply. + * @param ifMatch ETag of the Entity. Not required when creating an entity, but required when updating an entity. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PolicyContractInner object + */ + public Observable createOrUpdateAsync(String resourceGroupName, String serviceName, String apiId, PolicyContractInner parameters, String ifMatch) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serviceName, apiId, parameters, ifMatch).map(new Func1, PolicyContractInner>() { + @Override + public PolicyContractInner call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Creates or updates policy configuration for the API. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @param parameters The policy contents to apply. + * @param ifMatch ETag of the Entity. Not required when creating an entity, but required when updating an entity. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PolicyContractInner object + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String serviceName, String apiId, PolicyContractInner parameters, String ifMatch) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (apiId == null) { + throw new IllegalArgumentException("Parameter apiId is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(parameters); + final String policyId = "policy"; + return service.createOrUpdate(resourceGroupName, serviceName, apiId, policyId, this.client.subscriptionId(), parameters, ifMatch, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = createOrUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponseWithHeaders createOrUpdateDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(201, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .buildWithHeaders(response, ApiPolicyCreateOrUpdateHeaders.class); + } + + /** + * Deletes the policy configuration at the Api. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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 serviceName, String apiId, String ifMatch) { + deleteWithServiceResponseAsync(resourceGroupName, serviceName, apiId, ifMatch).toBlocking().single().body(); + } + + /** + * Deletes the policy configuration at the Api. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @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 serviceName, String apiId, String ifMatch, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, serviceName, apiId, ifMatch), serviceCallback); + } + + /** + * Deletes the policy configuration at the Api. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable deleteAsync(String resourceGroupName, String serviceName, String apiId, String ifMatch) { + return deleteWithServiceResponseAsync(resourceGroupName, serviceName, apiId, ifMatch).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes the policy configuration at the Api. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> deleteWithServiceResponseAsync(String resourceGroupName, String serviceName, String apiId, String ifMatch) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (apiId == null) { + throw new IllegalArgumentException("Parameter apiId is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (ifMatch == null) { + throw new IllegalArgumentException("Parameter ifMatch 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 policyId = "policy"; + return service.delete(resourceGroupName, serviceName, apiId, policyId, this.client.subscriptionId(), ifMatch, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = deleteDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse deleteDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(204, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ApiProductContractImpl.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ApiProductContractImpl.java new file mode 100644 index 0000000000000..4116809d77901 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ApiProductContractImpl.java @@ -0,0 +1,81 @@ +/** + * 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.apimanagement.v2019_01_01.implementation; + +import com.microsoft.azure.management.apimanagement.v2019_01_01.ApiProductContract; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import rx.Observable; +import com.microsoft.azure.management.apimanagement.v2019_01_01.ProductState; + +class ApiProductContractImpl extends WrapperImpl implements ApiProductContract { + private final ApiManagementManager manager; + + ApiProductContractImpl(ProductContractInner inner, ApiManagementManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public ApiManagementManager manager() { + return this.manager; + } + + + + @Override + public Boolean approvalRequired() { + return this.inner().approvalRequired(); + } + + @Override + public String description() { + return this.inner().description(); + } + + @Override + public String displayName() { + return this.inner().displayName(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public ProductState state() { + return this.inner().state(); + } + + @Override + public Boolean subscriptionRequired() { + return this.inner().subscriptionRequired(); + } + + @Override + public Integer subscriptionsLimit() { + return this.inner().subscriptionsLimit(); + } + + @Override + public String terms() { + return this.inner().terms(); + } + + @Override + public String type() { + return this.inner().type(); + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ApiProductsImpl.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ApiProductsImpl.java new file mode 100644 index 0000000000000..1b7c4464c57b1 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ApiProductsImpl.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.apimanagement.v2019_01_01.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.apimanagement.v2019_01_01.ApiProducts; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.apimanagement.v2019_01_01.ApiProductContract; + +class ApiProductsImpl extends WrapperImpl implements ApiProducts { + private final ApiManagementManager manager; + + ApiProductsImpl(ApiManagementManager manager) { + super(manager.inner().apiProducts()); + this.manager = manager; + } + + public ApiManagementManager manager() { + return this.manager; + } + + private ApiProductContractImpl wrapModel(ProductContractInner inner) { + return new ApiProductContractImpl(inner, manager()); + } + + @Override + public Observable listByApisAsync(final String resourceGroupName, final String serviceName, final String apiId) { + ApiProductsInner client = this.inner(); + return client.listByApisAsync(resourceGroupName, serviceName, apiId) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public ApiProductContract call(ProductContractInner inner) { + return wrapModel(inner); + } + }); + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ApiProductsInner.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ApiProductsInner.java new file mode 100644 index 0000000000000..99f8ec8cba887 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ApiProductsInner.java @@ -0,0 +1,453 @@ +/** + * 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.apimanagement.v2019_01_01.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.apimanagement.v2019_01_01.ErrorResponseException; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Path; +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 ApiProducts. + */ +public class ApiProductsInner { + /** The Retrofit service to perform REST calls. */ + private ApiProductsService service; + /** The service client containing this operation class. */ + private ApiManagementClientImpl client; + + /** + * Initializes an instance of ApiProductsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public ApiProductsInner(Retrofit retrofit, ApiManagementClientImpl client) { + this.service = retrofit.create(ApiProductsService.class); + this.client = client; + } + + /** + * The interface defining all the services for ApiProducts to be + * used by Retrofit to perform actually REST calls. + */ + interface ApiProductsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.apimanagement.v2019_01_01.ApiProducts listByApis" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/products") + Observable> listByApis(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("apiId") String apiId, @Path("subscriptionId") String subscriptionId, @Query("$filter") String filter, @Query("$top") Integer top, @Query("$skip") Integer skip, @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.apimanagement.v2019_01_01.ApiProducts listByApisNext" }) + @GET + Observable> listByApisNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Lists all Products, which the API is part of. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API identifier. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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<ProductContractInner> object if successful. + */ + public PagedList listByApis(final String resourceGroupName, final String serviceName, final String apiId) { + ServiceResponse> response = listByApisSinglePageAsync(resourceGroupName, serviceName, apiId).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByApisNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists all Products, which the API is part of. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API identifier. Must be unique in the current API Management service instance. + * @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> listByApisAsync(final String resourceGroupName, final String serviceName, final String apiId, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByApisSinglePageAsync(resourceGroupName, serviceName, apiId), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByApisNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists all Products, which the API is part of. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API identifier. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ProductContractInner> object + */ + public Observable> listByApisAsync(final String resourceGroupName, final String serviceName, final String apiId) { + return listByApisWithServiceResponseAsync(resourceGroupName, serviceName, apiId) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all Products, which the API is part of. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API identifier. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ProductContractInner> object + */ + public Observable>> listByApisWithServiceResponseAsync(final String resourceGroupName, final String serviceName, final String apiId) { + return listByApisSinglePageAsync(resourceGroupName, serviceName, apiId) + .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(listByApisNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists all Products, which the API is part of. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API identifier. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ProductContractInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByApisSinglePageAsync(final String resourceGroupName, final String serviceName, final String apiId) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (apiId == null) { + throw new IllegalArgumentException("Parameter apiId is required and cannot be null."); + } + 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 filter = null; + final Integer top = null; + final Integer skip = null; + return service.listByApis(resourceGroupName, serviceName, apiId, this.client.subscriptionId(), filter, top, skip, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByApisDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Lists all Products, which the API is part of. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API identifier. Must be unique in the current API Management service instance. + * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br> + * @param top Number of records to return. + * @param skip Number of records to skip. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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<ProductContractInner> object if successful. + */ + public PagedList listByApis(final String resourceGroupName, final String serviceName, final String apiId, final String filter, final Integer top, final Integer skip) { + ServiceResponse> response = listByApisSinglePageAsync(resourceGroupName, serviceName, apiId, filter, top, skip).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByApisNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists all Products, which the API is part of. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API identifier. Must be unique in the current API Management service instance. + * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br> + * @param top Number of records to return. + * @param skip Number of records to skip. + * @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> listByApisAsync(final String resourceGroupName, final String serviceName, final String apiId, final String filter, final Integer top, final Integer skip, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByApisSinglePageAsync(resourceGroupName, serviceName, apiId, filter, top, skip), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByApisNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists all Products, which the API is part of. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API identifier. Must be unique in the current API Management service instance. + * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br> + * @param top Number of records to return. + * @param skip Number of records to skip. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ProductContractInner> object + */ + public Observable> listByApisAsync(final String resourceGroupName, final String serviceName, final String apiId, final String filter, final Integer top, final Integer skip) { + return listByApisWithServiceResponseAsync(resourceGroupName, serviceName, apiId, filter, top, skip) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all Products, which the API is part of. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API identifier. Must be unique in the current API Management service instance. + * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br> + * @param top Number of records to return. + * @param skip Number of records to skip. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ProductContractInner> object + */ + public Observable>> listByApisWithServiceResponseAsync(final String resourceGroupName, final String serviceName, final String apiId, final String filter, final Integer top, final Integer skip) { + return listByApisSinglePageAsync(resourceGroupName, serviceName, apiId, filter, top, skip) + .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(listByApisNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists all Products, which the API is part of. + * + ServiceResponse> * @param resourceGroupName The name of the resource group. + ServiceResponse> * @param serviceName The name of the API Management service. + ServiceResponse> * @param apiId API identifier. Must be unique in the current API Management service instance. + ServiceResponse> * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br> + ServiceResponse> * @param top Number of records to return. + ServiceResponse> * @param skip Number of records to skip. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ProductContractInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByApisSinglePageAsync(final String resourceGroupName, final String serviceName, final String apiId, final String filter, final Integer top, final Integer skip) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (apiId == null) { + throw new IllegalArgumentException("Parameter apiId is required and cannot be null."); + } + 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.listByApis(resourceGroupName, serviceName, apiId, this.client.subscriptionId(), filter, top, skip, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByApisDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByApisDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists all Products, which the API is part of. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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<ProductContractInner> object if successful. + */ + public PagedList listByApisNext(final String nextPageLink) { + ServiceResponse> response = listByApisNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByApisNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists all Products, which the API is part of. + * + * @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> listByApisNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByApisNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByApisNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists all Products, which the API is part of. + * + * @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<ProductContractInner> object + */ + public Observable> listByApisNextAsync(final String nextPageLink) { + return listByApisNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all Products, which the API is part of. + * + * @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<ProductContractInner> object + */ + public Observable>> listByApisNextWithServiceResponseAsync(final String nextPageLink) { + return listByApisNextSinglePageAsync(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(listByApisNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists all Products, which the API is part of. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ProductContractInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByApisNextSinglePageAsync(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.listByApisNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByApisNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByApisNextDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ApiReleaseContractImpl.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ApiReleaseContractImpl.java new file mode 100644 index 0000000000000..2ca5108b070e5 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ApiReleaseContractImpl.java @@ -0,0 +1,142 @@ +/** + * 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.apimanagement.v2019_01_01.implementation; + +import com.microsoft.azure.management.apimanagement.v2019_01_01.ApiReleaseContract; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import org.joda.time.DateTime; + +class ApiReleaseContractImpl extends CreatableUpdatableImpl implements ApiReleaseContract, ApiReleaseContract.Definition, ApiReleaseContract.Update { + private final ApiManagementManager manager; + private String resourceGroupName; + private String serviceName; + private String apiId; + private String releaseId; + private String cifMatch; + private String uifMatch; + + ApiReleaseContractImpl(String name, ApiManagementManager manager) { + super(name, new ApiReleaseContractInner()); + this.manager = manager; + // Set resource name + this.releaseId = name; + // + } + + ApiReleaseContractImpl(ApiReleaseContractInner inner, ApiManagementManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.releaseId = inner.name(); + // set resource ancestor and positional variables + this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourceGroups"); + this.serviceName = IdParsingUtils.getValueFromIdByName(inner.id(), "service"); + this.apiId = IdParsingUtils.getValueFromIdByName(inner.id(), "apis"); + this.releaseId = IdParsingUtils.getValueFromIdByName(inner.id(), "releases"); + // + } + + @Override + public ApiManagementManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + ApiReleasesInner client = this.manager().inner().apiReleases(); + return client.createOrUpdateAsync(this.resourceGroupName, this.serviceName, this.apiId, this.releaseId, this.inner(), this.cifMatch) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + ApiReleasesInner client = this.manager().inner().apiReleases(); + return client.createOrUpdateAsync(this.resourceGroupName, this.serviceName, this.apiId, this.releaseId, this.inner(), this.uifMatch) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + ApiReleasesInner client = this.manager().inner().apiReleases(); + return client.getAsync(this.resourceGroupName, this.serviceName, this.apiId, this.releaseId); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + + @Override + public String apiId() { + return this.inner().apiId(); + } + + @Override + public DateTime createdDateTime() { + return this.inner().createdDateTime(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public String notes() { + return this.inner().notes(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public DateTime updatedDateTime() { + return this.inner().updatedDateTime(); + } + + @Override + public ApiReleaseContractImpl withExistingApi(String resourceGroupName, String serviceName, String apiId) { + this.resourceGroupName = resourceGroupName; + this.serviceName = serviceName; + this.apiId = apiId; + return this; + } + + @Override + public ApiReleaseContractImpl withIfMatch(String ifMatch) { + if (isInCreateMode()) { + this.cifMatch = ifMatch; + } else { + this.uifMatch = ifMatch; + } + return this; + } + + @Override + public ApiReleaseContractImpl withApiId(String apiId) { + this.inner().withApiId(apiId); + return this; + } + + @Override + public ApiReleaseContractImpl withNotes(String notes) { + this.inner().withNotes(notes); + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ApiReleaseContractInner.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ApiReleaseContractInner.java new file mode 100644 index 0000000000000..5361d6f3fcf13 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ApiReleaseContractInner.java @@ -0,0 +1,104 @@ +/** + * 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.apimanagement.v2019_01_01.implementation; + +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * ApiRelease details. + */ +@JsonFlatten +public class ApiReleaseContractInner extends ProxyResource { + /** + * Identifier of the API the release belongs to. + */ + @JsonProperty(value = "properties.apiId") + private String apiId; + + /** + * The time the API was released. The date conforms to the following + * format: yyyy-MM-ddTHH:mm:ssZ as specified by the ISO 8601 standard. + */ + @JsonProperty(value = "properties.createdDateTime", access = JsonProperty.Access.WRITE_ONLY) + private DateTime createdDateTime; + + /** + * The time the API release was updated. + */ + @JsonProperty(value = "properties.updatedDateTime", access = JsonProperty.Access.WRITE_ONLY) + private DateTime updatedDateTime; + + /** + * Release Notes. + */ + @JsonProperty(value = "properties.notes") + private String notes; + + /** + * Get identifier of the API the release belongs to. + * + * @return the apiId value + */ + public String apiId() { + return this.apiId; + } + + /** + * Set identifier of the API the release belongs to. + * + * @param apiId the apiId value to set + * @return the ApiReleaseContractInner object itself. + */ + public ApiReleaseContractInner withApiId(String apiId) { + this.apiId = apiId; + return this; + } + + /** + * Get the time the API was released. The date conforms to the following format: yyyy-MM-ddTHH:mm:ssZ as specified by the ISO 8601 standard. + * + * @return the createdDateTime value + */ + public DateTime createdDateTime() { + return this.createdDateTime; + } + + /** + * Get the time the API release was updated. + * + * @return the updatedDateTime value + */ + public DateTime updatedDateTime() { + return this.updatedDateTime; + } + + /** + * Get release Notes. + * + * @return the notes value + */ + public String notes() { + return this.notes; + } + + /** + * Set release Notes. + * + * @param notes the notes value to set + * @return the ApiReleaseContractInner object itself. + */ + public ApiReleaseContractInner withNotes(String notes) { + this.notes = notes; + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ApiReleasesImpl.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ApiReleasesImpl.java new file mode 100644 index 0000000000000..882ee3a267a47 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ApiReleasesImpl.java @@ -0,0 +1,87 @@ +/** + * 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.apimanagement.v2019_01_01.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.apimanagement.v2019_01_01.ApiReleases; +import rx.Completable; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.apimanagement.v2019_01_01.ApiReleaseContract; + +class ApiReleasesImpl extends WrapperImpl implements ApiReleases { + private final ApiManagementManager manager; + + ApiReleasesImpl(ApiManagementManager manager) { + super(manager.inner().apiReleases()); + this.manager = manager; + } + + public ApiManagementManager manager() { + return this.manager; + } + + @Override + public ApiReleaseContractImpl define(String name) { + return wrapModel(name); + } + + private ApiReleaseContractImpl wrapModel(ApiReleaseContractInner inner) { + return new ApiReleaseContractImpl(inner, manager()); + } + + private ApiReleaseContractImpl wrapModel(String name) { + return new ApiReleaseContractImpl(name, this.manager()); + } + + @Override + public Completable getEntityTagAsync(String resourceGroupName, String serviceName, String apiId, String releaseId) { + ApiReleasesInner client = this.inner(); + return client.getEntityTagAsync(resourceGroupName, serviceName, apiId, releaseId).toCompletable(); + } + + @Override + public Observable listByServiceAsync(final String resourceGroupName, final String serviceName, final String apiId) { + ApiReleasesInner client = this.inner(); + return client.listByServiceAsync(resourceGroupName, serviceName, apiId) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public ApiReleaseContract call(ApiReleaseContractInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Observable getAsync(String resourceGroupName, String serviceName, String apiId, String releaseId) { + ApiReleasesInner client = this.inner(); + return client.getAsync(resourceGroupName, serviceName, apiId, releaseId) + .map(new Func1() { + @Override + public ApiReleaseContract call(ApiReleaseContractInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Completable deleteAsync(String resourceGroupName, String serviceName, String apiId, String releaseId, String ifMatch) { + ApiReleasesInner client = this.inner(); + return client.deleteAsync(resourceGroupName, serviceName, apiId, releaseId, ifMatch).toCompletable(); + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ApiReleasesInner.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ApiReleasesInner.java new file mode 100644 index 0000000000000..e81763ceff837 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ApiReleasesInner.java @@ -0,0 +1,1119 @@ +/** + * 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.apimanagement.v2019_01_01.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.apimanagement.v2019_01_01.ApiReleaseCreateOrUpdateHeaders; +import com.microsoft.azure.management.apimanagement.v2019_01_01.ApiReleaseGetEntityTagHeaders; +import com.microsoft.azure.management.apimanagement.v2019_01_01.ApiReleaseGetHeaders; +import com.microsoft.azure.management.apimanagement.v2019_01_01.ErrorResponseException; +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.ServiceResponseWithHeaders; +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.HEAD; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.HTTP; +import retrofit2.http.PATCH; +import retrofit2.http.Path; +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 ApiReleases. + */ +public class ApiReleasesInner { + /** The Retrofit service to perform REST calls. */ + private ApiReleasesService service; + /** The service client containing this operation class. */ + private ApiManagementClientImpl client; + + /** + * Initializes an instance of ApiReleasesInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public ApiReleasesInner(Retrofit retrofit, ApiManagementClientImpl client) { + this.service = retrofit.create(ApiReleasesService.class); + this.client = client; + } + + /** + * The interface defining all the services for ApiReleases to be + * used by Retrofit to perform actually REST calls. + */ + interface ApiReleasesService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.apimanagement.v2019_01_01.ApiReleases listByService" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/releases") + Observable> listByService(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("apiId") String apiId, @Path("subscriptionId") String subscriptionId, @Query("$filter") String filter, @Query("$top") Integer top, @Query("$skip") Integer skip, @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.apimanagement.v2019_01_01.ApiReleases getEntityTag" }) + @HEAD("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/releases/{releaseId}") + Observable> getEntityTag(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("apiId") String apiId, @Path("releaseId") String releaseId, @Path("subscriptionId") String subscriptionId, @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.apimanagement.v2019_01_01.ApiReleases get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/releases/{releaseId}") + Observable> get(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("apiId") String apiId, @Path("releaseId") String releaseId, @Path("subscriptionId") String subscriptionId, @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.apimanagement.v2019_01_01.ApiReleases createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/releases/{releaseId}") + Observable> createOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("apiId") String apiId, @Path("releaseId") String releaseId, @Path("subscriptionId") String subscriptionId, @Body ApiReleaseContractInner parameters, @Header("If-Match") String ifMatch, @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.apimanagement.v2019_01_01.ApiReleases update" }) + @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/releases/{releaseId}") + Observable> update(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("apiId") String apiId, @Path("releaseId") String releaseId, @Path("subscriptionId") String subscriptionId, @Body ApiReleaseContractInner parameters, @Header("If-Match") String ifMatch, @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.apimanagement.v2019_01_01.ApiReleases delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/releases/{releaseId}", method = "DELETE", hasBody = true) + Observable> delete(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("apiId") String apiId, @Path("releaseId") String releaseId, @Path("subscriptionId") String subscriptionId, @Header("If-Match") String ifMatch, @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.apimanagement.v2019_01_01.ApiReleases listByServiceNext" }) + @GET + Observable> listByServiceNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Lists all releases of an API. An API release is created when making an API Revision current. Releases are also used to rollback to previous revisions. Results will be paged and can be constrained by the $top and $skip parameters. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API identifier. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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<ApiReleaseContractInner> object if successful. + */ + public PagedList listByService(final String resourceGroupName, final String serviceName, final String apiId) { + ServiceResponse> response = listByServiceSinglePageAsync(resourceGroupName, serviceName, apiId).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByServiceNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists all releases of an API. An API release is created when making an API Revision current. Releases are also used to rollback to previous revisions. Results will be paged and can be constrained by the $top and $skip parameters. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API identifier. Must be unique in the current API Management service instance. + * @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> listByServiceAsync(final String resourceGroupName, final String serviceName, final String apiId, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByServiceSinglePageAsync(resourceGroupName, serviceName, apiId), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByServiceNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists all releases of an API. An API release is created when making an API Revision current. Releases are also used to rollback to previous revisions. Results will be paged and can be constrained by the $top and $skip parameters. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API identifier. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ApiReleaseContractInner> object + */ + public Observable> listByServiceAsync(final String resourceGroupName, final String serviceName, final String apiId) { + return listByServiceWithServiceResponseAsync(resourceGroupName, serviceName, apiId) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all releases of an API. An API release is created when making an API Revision current. Releases are also used to rollback to previous revisions. Results will be paged and can be constrained by the $top and $skip parameters. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API identifier. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ApiReleaseContractInner> object + */ + public Observable>> listByServiceWithServiceResponseAsync(final String resourceGroupName, final String serviceName, final String apiId) { + return listByServiceSinglePageAsync(resourceGroupName, serviceName, apiId) + .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(listByServiceNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists all releases of an API. An API release is created when making an API Revision current. Releases are also used to rollback to previous revisions. Results will be paged and can be constrained by the $top and $skip parameters. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API identifier. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ApiReleaseContractInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByServiceSinglePageAsync(final String resourceGroupName, final String serviceName, final String apiId) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (apiId == null) { + throw new IllegalArgumentException("Parameter apiId is required and cannot be null."); + } + 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 filter = null; + final Integer top = null; + final Integer skip = null; + return service.listByService(resourceGroupName, serviceName, apiId, this.client.subscriptionId(), filter, top, skip, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByServiceDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Lists all releases of an API. An API release is created when making an API Revision current. Releases are also used to rollback to previous revisions. Results will be paged and can be constrained by the $top and $skip parameters. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API identifier. Must be unique in the current API Management service instance. + * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| notes | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br> + * @param top Number of records to return. + * @param skip Number of records to skip. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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<ApiReleaseContractInner> object if successful. + */ + public PagedList listByService(final String resourceGroupName, final String serviceName, final String apiId, final String filter, final Integer top, final Integer skip) { + ServiceResponse> response = listByServiceSinglePageAsync(resourceGroupName, serviceName, apiId, filter, top, skip).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByServiceNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists all releases of an API. An API release is created when making an API Revision current. Releases are also used to rollback to previous revisions. Results will be paged and can be constrained by the $top and $skip parameters. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API identifier. Must be unique in the current API Management service instance. + * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| notes | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br> + * @param top Number of records to return. + * @param skip Number of records to skip. + * @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> listByServiceAsync(final String resourceGroupName, final String serviceName, final String apiId, final String filter, final Integer top, final Integer skip, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByServiceSinglePageAsync(resourceGroupName, serviceName, apiId, filter, top, skip), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByServiceNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists all releases of an API. An API release is created when making an API Revision current. Releases are also used to rollback to previous revisions. Results will be paged and can be constrained by the $top and $skip parameters. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API identifier. Must be unique in the current API Management service instance. + * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| notes | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br> + * @param top Number of records to return. + * @param skip Number of records to skip. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ApiReleaseContractInner> object + */ + public Observable> listByServiceAsync(final String resourceGroupName, final String serviceName, final String apiId, final String filter, final Integer top, final Integer skip) { + return listByServiceWithServiceResponseAsync(resourceGroupName, serviceName, apiId, filter, top, skip) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all releases of an API. An API release is created when making an API Revision current. Releases are also used to rollback to previous revisions. Results will be paged and can be constrained by the $top and $skip parameters. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API identifier. Must be unique in the current API Management service instance. + * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| notes | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br> + * @param top Number of records to return. + * @param skip Number of records to skip. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ApiReleaseContractInner> object + */ + public Observable>> listByServiceWithServiceResponseAsync(final String resourceGroupName, final String serviceName, final String apiId, final String filter, final Integer top, final Integer skip) { + return listByServiceSinglePageAsync(resourceGroupName, serviceName, apiId, filter, top, skip) + .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(listByServiceNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists all releases of an API. An API release is created when making an API Revision current. Releases are also used to rollback to previous revisions. Results will be paged and can be constrained by the $top and $skip parameters. + * + ServiceResponse> * @param resourceGroupName The name of the resource group. + ServiceResponse> * @param serviceName The name of the API Management service. + ServiceResponse> * @param apiId API identifier. Must be unique in the current API Management service instance. + ServiceResponse> * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| notes | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br> + ServiceResponse> * @param top Number of records to return. + ServiceResponse> * @param skip Number of records to skip. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ApiReleaseContractInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByServiceSinglePageAsync(final String resourceGroupName, final String serviceName, final String apiId, final String filter, final Integer top, final Integer skip) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (apiId == null) { + throw new IllegalArgumentException("Parameter apiId is required and cannot be null."); + } + 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.listByService(resourceGroupName, serviceName, apiId, this.client.subscriptionId(), filter, top, skip, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByServiceDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByServiceDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Returns the etag of an API release. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API identifier. Must be unique in the current API Management service instance. + * @param releaseId Release identifier within an API. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void getEntityTag(String resourceGroupName, String serviceName, String apiId, String releaseId) { + getEntityTagWithServiceResponseAsync(resourceGroupName, serviceName, apiId, releaseId).toBlocking().single().body(); + } + + /** + * Returns the etag of an API release. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API identifier. Must be unique in the current API Management service instance. + * @param releaseId Release identifier within an API. Must be unique in the current API Management service instance. + * @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 getEntityTagAsync(String resourceGroupName, String serviceName, String apiId, String releaseId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(getEntityTagWithServiceResponseAsync(resourceGroupName, serviceName, apiId, releaseId), serviceCallback); + } + + /** + * Returns the etag of an API release. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API identifier. Must be unique in the current API Management service instance. + * @param releaseId Release identifier within an API. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public Observable getEntityTagAsync(String resourceGroupName, String serviceName, String apiId, String releaseId) { + return getEntityTagWithServiceResponseAsync(resourceGroupName, serviceName, apiId, releaseId).map(new Func1, Void>() { + @Override + public Void call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Returns the etag of an API release. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API identifier. Must be unique in the current API Management service instance. + * @param releaseId Release identifier within an API. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public Observable> getEntityTagWithServiceResponseAsync(String resourceGroupName, String serviceName, String apiId, String releaseId) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (apiId == null) { + throw new IllegalArgumentException("Parameter apiId is required and cannot be null."); + } + if (releaseId == null) { + throw new IllegalArgumentException("Parameter releaseId is required and cannot be null."); + } + 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.getEntityTag(resourceGroupName, serviceName, apiId, releaseId, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = getEntityTagDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponseWithHeaders getEntityTagDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .buildEmptyWithHeaders(response, ApiReleaseGetEntityTagHeaders.class); + } + + /** + * Returns the details of an API release. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API identifier. Must be unique in the current API Management service instance. + * @param releaseId Release identifier within an API. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ApiReleaseContractInner object if successful. + */ + public ApiReleaseContractInner get(String resourceGroupName, String serviceName, String apiId, String releaseId) { + return getWithServiceResponseAsync(resourceGroupName, serviceName, apiId, releaseId).toBlocking().single().body(); + } + + /** + * Returns the details of an API release. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API identifier. Must be unique in the current API Management service instance. + * @param releaseId Release identifier within an API. Must be unique in the current API Management service instance. + * @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 getAsync(String resourceGroupName, String serviceName, String apiId, String releaseId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(getWithServiceResponseAsync(resourceGroupName, serviceName, apiId, releaseId), serviceCallback); + } + + /** + * Returns the details of an API release. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API identifier. Must be unique in the current API Management service instance. + * @param releaseId Release identifier within an API. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ApiReleaseContractInner object + */ + public Observable getAsync(String resourceGroupName, String serviceName, String apiId, String releaseId) { + return getWithServiceResponseAsync(resourceGroupName, serviceName, apiId, releaseId).map(new Func1, ApiReleaseContractInner>() { + @Override + public ApiReleaseContractInner call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Returns the details of an API release. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API identifier. Must be unique in the current API Management service instance. + * @param releaseId Release identifier within an API. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ApiReleaseContractInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String serviceName, String apiId, String releaseId) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (apiId == null) { + throw new IllegalArgumentException("Parameter apiId is required and cannot be null."); + } + if (releaseId == null) { + throw new IllegalArgumentException("Parameter releaseId is required and cannot be null."); + } + 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.get(resourceGroupName, serviceName, apiId, releaseId, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = getDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponseWithHeaders getDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .buildWithHeaders(response, ApiReleaseGetHeaders.class); + } + + /** + * Creates a new Release for the API. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API identifier. Must be unique in the current API Management service instance. + * @param releaseId Release identifier within an API. Must be unique in the current API Management service instance. + * @param parameters Create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ApiReleaseContractInner object if successful. + */ + public ApiReleaseContractInner createOrUpdate(String resourceGroupName, String serviceName, String apiId, String releaseId, ApiReleaseContractInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serviceName, apiId, releaseId, parameters).toBlocking().single().body(); + } + + /** + * Creates a new Release for the API. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API identifier. Must be unique in the current API Management service instance. + * @param releaseId Release identifier within an API. Must be unique in the current API Management service instance. + * @param parameters Create parameters. + * @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 createOrUpdateAsync(String resourceGroupName, String serviceName, String apiId, String releaseId, ApiReleaseContractInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, serviceName, apiId, releaseId, parameters), serviceCallback); + } + + /** + * Creates a new Release for the API. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API identifier. Must be unique in the current API Management service instance. + * @param releaseId Release identifier within an API. Must be unique in the current API Management service instance. + * @param parameters Create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ApiReleaseContractInner object + */ + public Observable createOrUpdateAsync(String resourceGroupName, String serviceName, String apiId, String releaseId, ApiReleaseContractInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serviceName, apiId, releaseId, parameters).map(new Func1, ApiReleaseContractInner>() { + @Override + public ApiReleaseContractInner call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Creates a new Release for the API. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API identifier. Must be unique in the current API Management service instance. + * @param releaseId Release identifier within an API. Must be unique in the current API Management service instance. + * @param parameters Create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ApiReleaseContractInner object + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String serviceName, String apiId, String releaseId, ApiReleaseContractInner parameters) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (apiId == null) { + throw new IllegalArgumentException("Parameter apiId is required and cannot be null."); + } + if (releaseId == null) { + throw new IllegalArgumentException("Parameter releaseId is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(parameters); + final String ifMatch = null; + return service.createOrUpdate(resourceGroupName, serviceName, apiId, releaseId, this.client.subscriptionId(), parameters, ifMatch, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = createOrUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Creates a new Release for the API. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API identifier. Must be unique in the current API Management service instance. + * @param releaseId Release identifier within an API. Must be unique in the current API Management service instance. + * @param parameters Create parameters. + * @param ifMatch ETag of the Entity. Not required when creating an entity, but required when updating an entity. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ApiReleaseContractInner object if successful. + */ + public ApiReleaseContractInner createOrUpdate(String resourceGroupName, String serviceName, String apiId, String releaseId, ApiReleaseContractInner parameters, String ifMatch) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serviceName, apiId, releaseId, parameters, ifMatch).toBlocking().single().body(); + } + + /** + * Creates a new Release for the API. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API identifier. Must be unique in the current API Management service instance. + * @param releaseId Release identifier within an API. Must be unique in the current API Management service instance. + * @param parameters Create parameters. + * @param ifMatch ETag of the Entity. Not required when creating an entity, but required when updating an entity. + * @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 createOrUpdateAsync(String resourceGroupName, String serviceName, String apiId, String releaseId, ApiReleaseContractInner parameters, String ifMatch, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, serviceName, apiId, releaseId, parameters, ifMatch), serviceCallback); + } + + /** + * Creates a new Release for the API. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API identifier. Must be unique in the current API Management service instance. + * @param releaseId Release identifier within an API. Must be unique in the current API Management service instance. + * @param parameters Create parameters. + * @param ifMatch ETag of the Entity. Not required when creating an entity, but required when updating an entity. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ApiReleaseContractInner object + */ + public Observable createOrUpdateAsync(String resourceGroupName, String serviceName, String apiId, String releaseId, ApiReleaseContractInner parameters, String ifMatch) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serviceName, apiId, releaseId, parameters, ifMatch).map(new Func1, ApiReleaseContractInner>() { + @Override + public ApiReleaseContractInner call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Creates a new Release for the API. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API identifier. Must be unique in the current API Management service instance. + * @param releaseId Release identifier within an API. Must be unique in the current API Management service instance. + * @param parameters Create parameters. + * @param ifMatch ETag of the Entity. Not required when creating an entity, but required when updating an entity. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ApiReleaseContractInner object + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String serviceName, String apiId, String releaseId, ApiReleaseContractInner parameters, String ifMatch) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (apiId == null) { + throw new IllegalArgumentException("Parameter apiId is required and cannot be null."); + } + if (releaseId == null) { + throw new IllegalArgumentException("Parameter releaseId is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(parameters); + return service.createOrUpdate(resourceGroupName, serviceName, apiId, releaseId, this.client.subscriptionId(), parameters, ifMatch, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = createOrUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponseWithHeaders createOrUpdateDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(201, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .buildWithHeaders(response, ApiReleaseCreateOrUpdateHeaders.class); + } + + /** + * Updates the details of the release of the API specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API identifier. Must be unique in the current API Management service instance. + * @param releaseId Release identifier within an API. Must be unique in the current API Management service instance. + * @param parameters API Release Update parameters. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void update(String resourceGroupName, String serviceName, String apiId, String releaseId, ApiReleaseContractInner parameters, String ifMatch) { + updateWithServiceResponseAsync(resourceGroupName, serviceName, apiId, releaseId, parameters, ifMatch).toBlocking().single().body(); + } + + /** + * Updates the details of the release of the API specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API identifier. Must be unique in the current API Management service instance. + * @param releaseId Release identifier within an API. Must be unique in the current API Management service instance. + * @param parameters API Release Update parameters. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @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 serviceName, String apiId, String releaseId, ApiReleaseContractInner parameters, String ifMatch, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateWithServiceResponseAsync(resourceGroupName, serviceName, apiId, releaseId, parameters, ifMatch), serviceCallback); + } + + /** + * Updates the details of the release of the API specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API identifier. Must be unique in the current API Management service instance. + * @param releaseId Release identifier within an API. Must be unique in the current API Management service instance. + * @param parameters API Release Update parameters. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable updateAsync(String resourceGroupName, String serviceName, String apiId, String releaseId, ApiReleaseContractInner parameters, String ifMatch) { + return updateWithServiceResponseAsync(resourceGroupName, serviceName, apiId, releaseId, parameters, ifMatch).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates the details of the release of the API specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API identifier. Must be unique in the current API Management service instance. + * @param releaseId Release identifier within an API. Must be unique in the current API Management service instance. + * @param parameters API Release Update parameters. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> updateWithServiceResponseAsync(String resourceGroupName, String serviceName, String apiId, String releaseId, ApiReleaseContractInner parameters, String ifMatch) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (apiId == null) { + throw new IllegalArgumentException("Parameter apiId is required and cannot be null."); + } + if (releaseId == null) { + throw new IllegalArgumentException("Parameter releaseId is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + if (ifMatch == null) { + throw new IllegalArgumentException("Parameter ifMatch is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(parameters); + return service.update(resourceGroupName, serviceName, apiId, releaseId, this.client.subscriptionId(), parameters, ifMatch, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = updateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse updateDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(204, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Deletes the specified release in the API. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API identifier. Must be unique in the current API Management service instance. + * @param releaseId Release identifier within an API. Must be unique in the current API Management service instance. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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 serviceName, String apiId, String releaseId, String ifMatch) { + deleteWithServiceResponseAsync(resourceGroupName, serviceName, apiId, releaseId, ifMatch).toBlocking().single().body(); + } + + /** + * Deletes the specified release in the API. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API identifier. Must be unique in the current API Management service instance. + * @param releaseId Release identifier within an API. Must be unique in the current API Management service instance. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @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 serviceName, String apiId, String releaseId, String ifMatch, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, serviceName, apiId, releaseId, ifMatch), serviceCallback); + } + + /** + * Deletes the specified release in the API. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API identifier. Must be unique in the current API Management service instance. + * @param releaseId Release identifier within an API. Must be unique in the current API Management service instance. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable deleteAsync(String resourceGroupName, String serviceName, String apiId, String releaseId, String ifMatch) { + return deleteWithServiceResponseAsync(resourceGroupName, serviceName, apiId, releaseId, ifMatch).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes the specified release in the API. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API identifier. Must be unique in the current API Management service instance. + * @param releaseId Release identifier within an API. Must be unique in the current API Management service instance. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> deleteWithServiceResponseAsync(String resourceGroupName, String serviceName, String apiId, String releaseId, String ifMatch) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (apiId == null) { + throw new IllegalArgumentException("Parameter apiId is required and cannot be null."); + } + if (releaseId == null) { + throw new IllegalArgumentException("Parameter releaseId is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (ifMatch == null) { + throw new IllegalArgumentException("Parameter ifMatch 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.delete(resourceGroupName, serviceName, apiId, releaseId, this.client.subscriptionId(), ifMatch, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = deleteDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse deleteDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(204, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists all releases of an API. An API release is created when making an API Revision current. Releases are also used to rollback to previous revisions. Results will be paged and can be constrained by the $top and $skip parameters. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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<ApiReleaseContractInner> object if successful. + */ + public PagedList listByServiceNext(final String nextPageLink) { + ServiceResponse> response = listByServiceNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByServiceNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists all releases of an API. An API release is created when making an API Revision current. Releases are also used to rollback to previous revisions. Results will be paged and can be constrained by the $top and $skip parameters. + * + * @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> listByServiceNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByServiceNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByServiceNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists all releases of an API. An API release is created when making an API Revision current. Releases are also used to rollback to previous revisions. Results will be paged and can be constrained by the $top and $skip parameters. + * + * @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<ApiReleaseContractInner> object + */ + public Observable> listByServiceNextAsync(final String nextPageLink) { + return listByServiceNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all releases of an API. An API release is created when making an API Revision current. Releases are also used to rollback to previous revisions. Results will be paged and can be constrained by the $top and $skip parameters. + * + * @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<ApiReleaseContractInner> object + */ + public Observable>> listByServiceNextWithServiceResponseAsync(final String nextPageLink) { + return listByServiceNextSinglePageAsync(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(listByServiceNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists all releases of an API. An API release is created when making an API Revision current. Releases are also used to rollback to previous revisions. Results will be paged and can be constrained by the $top and $skip parameters. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ApiReleaseContractInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByServiceNextSinglePageAsync(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.listByServiceNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByServiceNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByServiceNextDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ApiRevisionContractImpl.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ApiRevisionContractImpl.java new file mode 100644 index 0000000000000..918599a786ea4 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ApiRevisionContractImpl.java @@ -0,0 +1,71 @@ +/** + * 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.apimanagement.v2019_01_01.implementation; + +import com.microsoft.azure.management.apimanagement.v2019_01_01.ApiRevisionContract; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import rx.Observable; +import org.joda.time.DateTime; + +class ApiRevisionContractImpl extends WrapperImpl implements ApiRevisionContract { + private final ApiManagementManager manager; + + ApiRevisionContractImpl(ApiRevisionContractInner inner, ApiManagementManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public ApiManagementManager manager() { + return this.manager; + } + + + + @Override + public String apiId() { + return this.inner().apiId(); + } + + @Override + public String apiRevision() { + return this.inner().apiRevision(); + } + + @Override + public DateTime createdDateTime() { + return this.inner().createdDateTime(); + } + + @Override + public String description() { + return this.inner().description(); + } + + @Override + public Boolean isCurrent() { + return this.inner().isCurrent(); + } + + @Override + public Boolean isOnline() { + return this.inner().isOnline(); + } + + @Override + public String privateUrl() { + return this.inner().privateUrl(); + } + + @Override + public DateTime updatedDateTime() { + return this.inner().updatedDateTime(); + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ApiRevisionContractInner.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ApiRevisionContractInner.java new file mode 100644 index 0000000000000..5f5e85c193e84 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ApiRevisionContractInner.java @@ -0,0 +1,142 @@ +/** + * 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.apimanagement.v2019_01_01.implementation; + +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Summary of revision metadata. + */ +public class ApiRevisionContractInner { + /** + * Identifier of the API Revision. + */ + @JsonProperty(value = "apiId", access = JsonProperty.Access.WRITE_ONLY) + private String apiId; + + /** + * Revision number of API. + */ + @JsonProperty(value = "apiRevision", access = JsonProperty.Access.WRITE_ONLY) + private String apiRevision; + + /** + * The time the API Revision was created. The date conforms to the + * following format: yyyy-MM-ddTHH:mm:ssZ as specified by the ISO 8601 + * standard. + */ + @JsonProperty(value = "createdDateTime", access = JsonProperty.Access.WRITE_ONLY) + private DateTime createdDateTime; + + /** + * The time the API Revision were updated. The date conforms to the + * following format: yyyy-MM-ddTHH:mm:ssZ as specified by the ISO 8601 + * standard. + */ + @JsonProperty(value = "updatedDateTime", access = JsonProperty.Access.WRITE_ONLY) + private DateTime updatedDateTime; + + /** + * Description of the API Revision. + */ + @JsonProperty(value = "description", access = JsonProperty.Access.WRITE_ONLY) + private String description; + + /** + * Gateway URL for accessing the non-current API Revision. + */ + @JsonProperty(value = "privateUrl", access = JsonProperty.Access.WRITE_ONLY) + private String privateUrl; + + /** + * Indicates if API revision is the current api revision. + */ + @JsonProperty(value = "isOnline", access = JsonProperty.Access.WRITE_ONLY) + private Boolean isOnline; + + /** + * Indicates if API revision is accessible via the gateway. + */ + @JsonProperty(value = "isCurrent", access = JsonProperty.Access.WRITE_ONLY) + private Boolean isCurrent; + + /** + * Get identifier of the API Revision. + * + * @return the apiId value + */ + public String apiId() { + return this.apiId; + } + + /** + * Get revision number of API. + * + * @return the apiRevision value + */ + public String apiRevision() { + return this.apiRevision; + } + + /** + * Get the time the API Revision was created. The date conforms to the following format: yyyy-MM-ddTHH:mm:ssZ as specified by the ISO 8601 standard. + * + * @return the createdDateTime value + */ + public DateTime createdDateTime() { + return this.createdDateTime; + } + + /** + * Get the time the API Revision were updated. The date conforms to the following format: yyyy-MM-ddTHH:mm:ssZ as specified by the ISO 8601 standard. + * + * @return the updatedDateTime value + */ + public DateTime updatedDateTime() { + return this.updatedDateTime; + } + + /** + * Get description of the API Revision. + * + * @return the description value + */ + public String description() { + return this.description; + } + + /** + * Get gateway URL for accessing the non-current API Revision. + * + * @return the privateUrl value + */ + public String privateUrl() { + return this.privateUrl; + } + + /** + * Get indicates if API revision is the current api revision. + * + * @return the isOnline value + */ + public Boolean isOnline() { + return this.isOnline; + } + + /** + * Get indicates if API revision is accessible via the gateway. + * + * @return the isCurrent value + */ + public Boolean isCurrent() { + return this.isCurrent; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ApiRevisionsImpl.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ApiRevisionsImpl.java new file mode 100644 index 0000000000000..45da9ffb1bd9b --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ApiRevisionsImpl.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.apimanagement.v2019_01_01.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.apimanagement.v2019_01_01.ApiRevisions; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.apimanagement.v2019_01_01.ApiRevisionContract; + +class ApiRevisionsImpl extends WrapperImpl implements ApiRevisions { + private final ApiManagementManager manager; + + ApiRevisionsImpl(ApiManagementManager manager) { + super(manager.inner().apiRevisions()); + this.manager = manager; + } + + public ApiManagementManager manager() { + return this.manager; + } + + private ApiRevisionContractImpl wrapModel(ApiRevisionContractInner inner) { + return new ApiRevisionContractImpl(inner, manager()); + } + + @Override + public Observable listByServiceAsync(final String resourceGroupName, final String serviceName, final String apiId) { + ApiRevisionsInner client = this.inner(); + return client.listByServiceAsync(resourceGroupName, serviceName, apiId) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public ApiRevisionContract call(ApiRevisionContractInner inner) { + return wrapModel(inner); + } + }); + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ApiRevisionsInner.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ApiRevisionsInner.java new file mode 100644 index 0000000000000..42cf0de15d0fc --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ApiRevisionsInner.java @@ -0,0 +1,453 @@ +/** + * 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.apimanagement.v2019_01_01.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.apimanagement.v2019_01_01.ErrorResponseException; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Path; +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 ApiRevisions. + */ +public class ApiRevisionsInner { + /** The Retrofit service to perform REST calls. */ + private ApiRevisionsService service; + /** The service client containing this operation class. */ + private ApiManagementClientImpl client; + + /** + * Initializes an instance of ApiRevisionsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public ApiRevisionsInner(Retrofit retrofit, ApiManagementClientImpl client) { + this.service = retrofit.create(ApiRevisionsService.class); + this.client = client; + } + + /** + * The interface defining all the services for ApiRevisions to be + * used by Retrofit to perform actually REST calls. + */ + interface ApiRevisionsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.apimanagement.v2019_01_01.ApiRevisions listByService" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/revisions") + Observable> listByService(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("apiId") String apiId, @Path("subscriptionId") String subscriptionId, @Query("$filter") String filter, @Query("$top") Integer top, @Query("$skip") Integer skip, @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.apimanagement.v2019_01_01.ApiRevisions listByServiceNext" }) + @GET + Observable> listByServiceNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Lists all revisions of an API. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API identifier. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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<ApiRevisionContractInner> object if successful. + */ + public PagedList listByService(final String resourceGroupName, final String serviceName, final String apiId) { + ServiceResponse> response = listByServiceSinglePageAsync(resourceGroupName, serviceName, apiId).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByServiceNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists all revisions of an API. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API identifier. Must be unique in the current API Management service instance. + * @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> listByServiceAsync(final String resourceGroupName, final String serviceName, final String apiId, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByServiceSinglePageAsync(resourceGroupName, serviceName, apiId), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByServiceNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists all revisions of an API. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API identifier. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ApiRevisionContractInner> object + */ + public Observable> listByServiceAsync(final String resourceGroupName, final String serviceName, final String apiId) { + return listByServiceWithServiceResponseAsync(resourceGroupName, serviceName, apiId) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all revisions of an API. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API identifier. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ApiRevisionContractInner> object + */ + public Observable>> listByServiceWithServiceResponseAsync(final String resourceGroupName, final String serviceName, final String apiId) { + return listByServiceSinglePageAsync(resourceGroupName, serviceName, apiId) + .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(listByServiceNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists all revisions of an API. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API identifier. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ApiRevisionContractInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByServiceSinglePageAsync(final String resourceGroupName, final String serviceName, final String apiId) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (apiId == null) { + throw new IllegalArgumentException("Parameter apiId is required and cannot be null."); + } + 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 filter = null; + final Integer top = null; + final Integer skip = null; + return service.listByService(resourceGroupName, serviceName, apiId, this.client.subscriptionId(), filter, top, skip, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByServiceDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Lists all revisions of an API. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API identifier. Must be unique in the current API Management service instance. + * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| apiRevision | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br> + * @param top Number of records to return. + * @param skip Number of records to skip. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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<ApiRevisionContractInner> object if successful. + */ + public PagedList listByService(final String resourceGroupName, final String serviceName, final String apiId, final String filter, final Integer top, final Integer skip) { + ServiceResponse> response = listByServiceSinglePageAsync(resourceGroupName, serviceName, apiId, filter, top, skip).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByServiceNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists all revisions of an API. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API identifier. Must be unique in the current API Management service instance. + * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| apiRevision | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br> + * @param top Number of records to return. + * @param skip Number of records to skip. + * @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> listByServiceAsync(final String resourceGroupName, final String serviceName, final String apiId, final String filter, final Integer top, final Integer skip, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByServiceSinglePageAsync(resourceGroupName, serviceName, apiId, filter, top, skip), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByServiceNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists all revisions of an API. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API identifier. Must be unique in the current API Management service instance. + * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| apiRevision | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br> + * @param top Number of records to return. + * @param skip Number of records to skip. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ApiRevisionContractInner> object + */ + public Observable> listByServiceAsync(final String resourceGroupName, final String serviceName, final String apiId, final String filter, final Integer top, final Integer skip) { + return listByServiceWithServiceResponseAsync(resourceGroupName, serviceName, apiId, filter, top, skip) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all revisions of an API. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API identifier. Must be unique in the current API Management service instance. + * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| apiRevision | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br> + * @param top Number of records to return. + * @param skip Number of records to skip. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ApiRevisionContractInner> object + */ + public Observable>> listByServiceWithServiceResponseAsync(final String resourceGroupName, final String serviceName, final String apiId, final String filter, final Integer top, final Integer skip) { + return listByServiceSinglePageAsync(resourceGroupName, serviceName, apiId, filter, top, skip) + .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(listByServiceNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists all revisions of an API. + * + ServiceResponse> * @param resourceGroupName The name of the resource group. + ServiceResponse> * @param serviceName The name of the API Management service. + ServiceResponse> * @param apiId API identifier. Must be unique in the current API Management service instance. + ServiceResponse> * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| apiRevision | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br> + ServiceResponse> * @param top Number of records to return. + ServiceResponse> * @param skip Number of records to skip. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ApiRevisionContractInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByServiceSinglePageAsync(final String resourceGroupName, final String serviceName, final String apiId, final String filter, final Integer top, final Integer skip) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (apiId == null) { + throw new IllegalArgumentException("Parameter apiId is required and cannot be null."); + } + 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.listByService(resourceGroupName, serviceName, apiId, this.client.subscriptionId(), filter, top, skip, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByServiceDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByServiceDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists all revisions of an API. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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<ApiRevisionContractInner> object if successful. + */ + public PagedList listByServiceNext(final String nextPageLink) { + ServiceResponse> response = listByServiceNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByServiceNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists all revisions of an API. + * + * @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> listByServiceNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByServiceNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByServiceNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists all revisions of an API. + * + * @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<ApiRevisionContractInner> object + */ + public Observable> listByServiceNextAsync(final String nextPageLink) { + return listByServiceNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all revisions of an API. + * + * @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<ApiRevisionContractInner> object + */ + public Observable>> listByServiceNextWithServiceResponseAsync(final String nextPageLink) { + return listByServiceNextSinglePageAsync(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(listByServiceNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists all revisions of an API. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ApiRevisionContractInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByServiceNextSinglePageAsync(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.listByServiceNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByServiceNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByServiceNextDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ApiSchemasImpl.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ApiSchemasImpl.java new file mode 100644 index 0000000000000..07edc68850401 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ApiSchemasImpl.java @@ -0,0 +1,87 @@ +/** + * 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.apimanagement.v2019_01_01.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.apimanagement.v2019_01_01.ApiSchemas; +import rx.Completable; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.apimanagement.v2019_01_01.SchemaContract; + +class ApiSchemasImpl extends WrapperImpl implements ApiSchemas { + private final ApiManagementManager manager; + + ApiSchemasImpl(ApiManagementManager manager) { + super(manager.inner().apiSchemas()); + this.manager = manager; + } + + public ApiManagementManager manager() { + return this.manager; + } + + @Override + public SchemaContractImpl define(String name) { + return wrapModel(name); + } + + private SchemaContractImpl wrapModel(SchemaContractInner inner) { + return new SchemaContractImpl(inner, manager()); + } + + private SchemaContractImpl wrapModel(String name) { + return new SchemaContractImpl(name, this.manager()); + } + + @Override + public Completable getEntityTagAsync(String resourceGroupName, String serviceName, String apiId, String schemaId) { + ApiSchemasInner client = this.inner(); + return client.getEntityTagAsync(resourceGroupName, serviceName, apiId, schemaId).toCompletable(); + } + + @Override + public Observable listByApiAsync(final String resourceGroupName, final String serviceName, final String apiId) { + ApiSchemasInner client = this.inner(); + return client.listByApiAsync(resourceGroupName, serviceName, apiId) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public SchemaContract call(SchemaContractInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Observable getAsync(String resourceGroupName, String serviceName, String apiId, String schemaId) { + ApiSchemasInner client = this.inner(); + return client.getAsync(resourceGroupName, serviceName, apiId, schemaId) + .map(new Func1() { + @Override + public SchemaContract call(SchemaContractInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Completable deleteAsync(String resourceGroupName, String serviceName, String apiId, String schemaId, String ifMatch) { + ApiSchemasInner client = this.inner(); + return client.deleteAsync(resourceGroupName, serviceName, apiId, schemaId, ifMatch).toCompletable(); + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ApiSchemasInner.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ApiSchemasInner.java new file mode 100644 index 0000000000000..9b2c531883d21 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ApiSchemasInner.java @@ -0,0 +1,1105 @@ +/** + * 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.apimanagement.v2019_01_01.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.apimanagement.v2019_01_01.ApiSchemaCreateOrUpdateHeaders; +import com.microsoft.azure.management.apimanagement.v2019_01_01.ApiSchemaGetEntityTagHeaders; +import com.microsoft.azure.management.apimanagement.v2019_01_01.ApiSchemaGetHeaders; +import com.microsoft.azure.management.apimanagement.v2019_01_01.ErrorResponseException; +import com.microsoft.azure.management.apimanagement.v2019_01_01.SchemaCreateOrUpdateContract; +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.ServiceResponseWithHeaders; +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.HEAD; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.HTTP; +import retrofit2.http.Path; +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 ApiSchemas. + */ +public class ApiSchemasInner { + /** The Retrofit service to perform REST calls. */ + private ApiSchemasService service; + /** The service client containing this operation class. */ + private ApiManagementClientImpl client; + + /** + * Initializes an instance of ApiSchemasInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public ApiSchemasInner(Retrofit retrofit, ApiManagementClientImpl client) { + this.service = retrofit.create(ApiSchemasService.class); + this.client = client; + } + + /** + * The interface defining all the services for ApiSchemas to be + * used by Retrofit to perform actually REST calls. + */ + interface ApiSchemasService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.apimanagement.v2019_01_01.ApiSchemas listByApi" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/schemas") + Observable> listByApi(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("apiId") String apiId, @Path("subscriptionId") String subscriptionId, @Query("$filter") String filter, @Query("$top") Integer top, @Query("$skip") Integer skip, @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.apimanagement.v2019_01_01.ApiSchemas getEntityTag" }) + @HEAD("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/schemas/{schemaId}") + Observable> getEntityTag(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("apiId") String apiId, @Path("schemaId") String schemaId, @Path("subscriptionId") String subscriptionId, @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.apimanagement.v2019_01_01.ApiSchemas get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/schemas/{schemaId}") + Observable> get(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("apiId") String apiId, @Path("schemaId") String schemaId, @Path("subscriptionId") String subscriptionId, @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.apimanagement.v2019_01_01.ApiSchemas createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/schemas/{schemaId}") + Observable> createOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("apiId") String apiId, @Path("schemaId") String schemaId, @Path("subscriptionId") String subscriptionId, @Body SchemaCreateOrUpdateContract parameters, @Header("If-Match") String ifMatch, @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.apimanagement.v2019_01_01.ApiSchemas delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/schemas/{schemaId}", method = "DELETE", hasBody = true) + Observable> delete(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("apiId") String apiId, @Path("schemaId") String schemaId, @Path("subscriptionId") String subscriptionId, @Query("force") Boolean force, @Header("If-Match") String ifMatch, @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.apimanagement.v2019_01_01.ApiSchemas listByApiNext" }) + @GET + Observable> listByApiNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Get the schema configuration at the API level. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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<SchemaContractInner> object if successful. + */ + public PagedList listByApi(final String resourceGroupName, final String serviceName, final String apiId) { + ServiceResponse> response = listByApiSinglePageAsync(resourceGroupName, serviceName, apiId).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByApiNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Get the schema configuration at the API level. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @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> listByApiAsync(final String resourceGroupName, final String serviceName, final String apiId, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByApiSinglePageAsync(resourceGroupName, serviceName, apiId), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByApiNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Get the schema configuration at the API level. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<SchemaContractInner> object + */ + public Observable> listByApiAsync(final String resourceGroupName, final String serviceName, final String apiId) { + return listByApiWithServiceResponseAsync(resourceGroupName, serviceName, apiId) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Get the schema configuration at the API level. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<SchemaContractInner> object + */ + public Observable>> listByApiWithServiceResponseAsync(final String resourceGroupName, final String serviceName, final String apiId) { + return listByApiSinglePageAsync(resourceGroupName, serviceName, apiId) + .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(listByApiNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Get the schema configuration at the API level. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<SchemaContractInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByApiSinglePageAsync(final String resourceGroupName, final String serviceName, final String apiId) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (apiId == null) { + throw new IllegalArgumentException("Parameter apiId is required and cannot be null."); + } + 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 filter = null; + final Integer top = null; + final Integer skip = null; + return service.listByApi(resourceGroupName, serviceName, apiId, this.client.subscriptionId(), filter, top, skip, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByApiDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Get the schema configuration at the API level. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| contentType | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br> + * @param top Number of records to return. + * @param skip Number of records to skip. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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<SchemaContractInner> object if successful. + */ + public PagedList listByApi(final String resourceGroupName, final String serviceName, final String apiId, final String filter, final Integer top, final Integer skip) { + ServiceResponse> response = listByApiSinglePageAsync(resourceGroupName, serviceName, apiId, filter, top, skip).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByApiNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Get the schema configuration at the API level. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| contentType | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br> + * @param top Number of records to return. + * @param skip Number of records to skip. + * @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> listByApiAsync(final String resourceGroupName, final String serviceName, final String apiId, final String filter, final Integer top, final Integer skip, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByApiSinglePageAsync(resourceGroupName, serviceName, apiId, filter, top, skip), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByApiNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Get the schema configuration at the API level. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| contentType | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br> + * @param top Number of records to return. + * @param skip Number of records to skip. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<SchemaContractInner> object + */ + public Observable> listByApiAsync(final String resourceGroupName, final String serviceName, final String apiId, final String filter, final Integer top, final Integer skip) { + return listByApiWithServiceResponseAsync(resourceGroupName, serviceName, apiId, filter, top, skip) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Get the schema configuration at the API level. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| contentType | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br> + * @param top Number of records to return. + * @param skip Number of records to skip. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<SchemaContractInner> object + */ + public Observable>> listByApiWithServiceResponseAsync(final String resourceGroupName, final String serviceName, final String apiId, final String filter, final Integer top, final Integer skip) { + return listByApiSinglePageAsync(resourceGroupName, serviceName, apiId, filter, top, skip) + .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(listByApiNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Get the schema configuration at the API level. + * + ServiceResponse> * @param resourceGroupName The name of the resource group. + ServiceResponse> * @param serviceName The name of the API Management service. + ServiceResponse> * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + ServiceResponse> * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| contentType | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br> + ServiceResponse> * @param top Number of records to return. + ServiceResponse> * @param skip Number of records to skip. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<SchemaContractInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByApiSinglePageAsync(final String resourceGroupName, final String serviceName, final String apiId, final String filter, final Integer top, final Integer skip) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (apiId == null) { + throw new IllegalArgumentException("Parameter apiId is required and cannot be null."); + } + 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.listByApi(resourceGroupName, serviceName, apiId, this.client.subscriptionId(), filter, top, skip, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByApiDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByApiDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Gets the entity state (Etag) version of the schema specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @param schemaId Schema identifier within an API. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void getEntityTag(String resourceGroupName, String serviceName, String apiId, String schemaId) { + getEntityTagWithServiceResponseAsync(resourceGroupName, serviceName, apiId, schemaId).toBlocking().single().body(); + } + + /** + * Gets the entity state (Etag) version of the schema specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @param schemaId Schema identifier within an API. Must be unique in the current API Management service instance. + * @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 getEntityTagAsync(String resourceGroupName, String serviceName, String apiId, String schemaId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(getEntityTagWithServiceResponseAsync(resourceGroupName, serviceName, apiId, schemaId), serviceCallback); + } + + /** + * Gets the entity state (Etag) version of the schema specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @param schemaId Schema identifier within an API. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public Observable getEntityTagAsync(String resourceGroupName, String serviceName, String apiId, String schemaId) { + return getEntityTagWithServiceResponseAsync(resourceGroupName, serviceName, apiId, schemaId).map(new Func1, Void>() { + @Override + public Void call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Gets the entity state (Etag) version of the schema specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @param schemaId Schema identifier within an API. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public Observable> getEntityTagWithServiceResponseAsync(String resourceGroupName, String serviceName, String apiId, String schemaId) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (apiId == null) { + throw new IllegalArgumentException("Parameter apiId is required and cannot be null."); + } + if (schemaId == null) { + throw new IllegalArgumentException("Parameter schemaId is required and cannot be null."); + } + 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.getEntityTag(resourceGroupName, serviceName, apiId, schemaId, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = getEntityTagDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponseWithHeaders getEntityTagDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .buildEmptyWithHeaders(response, ApiSchemaGetEntityTagHeaders.class); + } + + /** + * Get the schema configuration at the API level. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @param schemaId Schema identifier within an API. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the SchemaContractInner object if successful. + */ + public SchemaContractInner get(String resourceGroupName, String serviceName, String apiId, String schemaId) { + return getWithServiceResponseAsync(resourceGroupName, serviceName, apiId, schemaId).toBlocking().single().body(); + } + + /** + * Get the schema configuration at the API level. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @param schemaId Schema identifier within an API. Must be unique in the current API Management service instance. + * @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 getAsync(String resourceGroupName, String serviceName, String apiId, String schemaId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(getWithServiceResponseAsync(resourceGroupName, serviceName, apiId, schemaId), serviceCallback); + } + + /** + * Get the schema configuration at the API level. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @param schemaId Schema identifier within an API. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SchemaContractInner object + */ + public Observable getAsync(String resourceGroupName, String serviceName, String apiId, String schemaId) { + return getWithServiceResponseAsync(resourceGroupName, serviceName, apiId, schemaId).map(new Func1, SchemaContractInner>() { + @Override + public SchemaContractInner call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Get the schema configuration at the API level. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @param schemaId Schema identifier within an API. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SchemaContractInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String serviceName, String apiId, String schemaId) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (apiId == null) { + throw new IllegalArgumentException("Parameter apiId is required and cannot be null."); + } + if (schemaId == null) { + throw new IllegalArgumentException("Parameter schemaId is required and cannot be null."); + } + 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.get(resourceGroupName, serviceName, apiId, schemaId, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = getDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponseWithHeaders getDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .buildWithHeaders(response, ApiSchemaGetHeaders.class); + } + + /** + * Creates or updates schema configuration for the API. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @param schemaId Schema identifier within an API. Must be unique in the current API Management service instance. + * @param parameters The schema contents to apply. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the SchemaContractInner object if successful. + */ + public SchemaContractInner createOrUpdate(String resourceGroupName, String serviceName, String apiId, String schemaId, SchemaCreateOrUpdateContract parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serviceName, apiId, schemaId, parameters).toBlocking().single().body(); + } + + /** + * Creates or updates schema configuration for the API. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @param schemaId Schema identifier within an API. Must be unique in the current API Management service instance. + * @param parameters The schema contents to apply. + * @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 createOrUpdateAsync(String resourceGroupName, String serviceName, String apiId, String schemaId, SchemaCreateOrUpdateContract parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, serviceName, apiId, schemaId, parameters), serviceCallback); + } + + /** + * Creates or updates schema configuration for the API. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @param schemaId Schema identifier within an API. Must be unique in the current API Management service instance. + * @param parameters The schema contents to apply. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SchemaContractInner object + */ + public Observable createOrUpdateAsync(String resourceGroupName, String serviceName, String apiId, String schemaId, SchemaCreateOrUpdateContract parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serviceName, apiId, schemaId, parameters).map(new Func1, SchemaContractInner>() { + @Override + public SchemaContractInner call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Creates or updates schema configuration for the API. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @param schemaId Schema identifier within an API. Must be unique in the current API Management service instance. + * @param parameters The schema contents to apply. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SchemaContractInner object + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String serviceName, String apiId, String schemaId, SchemaCreateOrUpdateContract parameters) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (apiId == null) { + throw new IllegalArgumentException("Parameter apiId is required and cannot be null."); + } + if (schemaId == null) { + throw new IllegalArgumentException("Parameter schemaId is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(parameters); + final String ifMatch = null; + return service.createOrUpdate(resourceGroupName, serviceName, apiId, schemaId, this.client.subscriptionId(), parameters, ifMatch, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = createOrUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Creates or updates schema configuration for the API. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @param schemaId Schema identifier within an API. Must be unique in the current API Management service instance. + * @param parameters The schema contents to apply. + * @param ifMatch ETag of the Entity. Not required when creating an entity, but required when updating an entity. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the SchemaContractInner object if successful. + */ + public SchemaContractInner createOrUpdate(String resourceGroupName, String serviceName, String apiId, String schemaId, SchemaCreateOrUpdateContract parameters, String ifMatch) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serviceName, apiId, schemaId, parameters, ifMatch).toBlocking().single().body(); + } + + /** + * Creates or updates schema configuration for the API. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @param schemaId Schema identifier within an API. Must be unique in the current API Management service instance. + * @param parameters The schema contents to apply. + * @param ifMatch ETag of the Entity. Not required when creating an entity, but required when updating an entity. + * @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 createOrUpdateAsync(String resourceGroupName, String serviceName, String apiId, String schemaId, SchemaCreateOrUpdateContract parameters, String ifMatch, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, serviceName, apiId, schemaId, parameters, ifMatch), serviceCallback); + } + + /** + * Creates or updates schema configuration for the API. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @param schemaId Schema identifier within an API. Must be unique in the current API Management service instance. + * @param parameters The schema contents to apply. + * @param ifMatch ETag of the Entity. Not required when creating an entity, but required when updating an entity. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SchemaContractInner object + */ + public Observable createOrUpdateAsync(String resourceGroupName, String serviceName, String apiId, String schemaId, SchemaCreateOrUpdateContract parameters, String ifMatch) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serviceName, apiId, schemaId, parameters, ifMatch).map(new Func1, SchemaContractInner>() { + @Override + public SchemaContractInner call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Creates or updates schema configuration for the API. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @param schemaId Schema identifier within an API. Must be unique in the current API Management service instance. + * @param parameters The schema contents to apply. + * @param ifMatch ETag of the Entity. Not required when creating an entity, but required when updating an entity. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SchemaContractInner object + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String serviceName, String apiId, String schemaId, SchemaCreateOrUpdateContract parameters, String ifMatch) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (apiId == null) { + throw new IllegalArgumentException("Parameter apiId is required and cannot be null."); + } + if (schemaId == null) { + throw new IllegalArgumentException("Parameter schemaId is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(parameters); + return service.createOrUpdate(resourceGroupName, serviceName, apiId, schemaId, this.client.subscriptionId(), parameters, ifMatch, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = createOrUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponseWithHeaders createOrUpdateDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(201, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .buildWithHeaders(response, ApiSchemaCreateOrUpdateHeaders.class); + } + + /** + * Deletes the schema configuration at the Api. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @param schemaId Schema identifier within an API. Must be unique in the current API Management service instance. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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 serviceName, String apiId, String schemaId, String ifMatch) { + deleteWithServiceResponseAsync(resourceGroupName, serviceName, apiId, schemaId, ifMatch).toBlocking().single().body(); + } + + /** + * Deletes the schema configuration at the Api. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @param schemaId Schema identifier within an API. Must be unique in the current API Management service instance. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @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 serviceName, String apiId, String schemaId, String ifMatch, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, serviceName, apiId, schemaId, ifMatch), serviceCallback); + } + + /** + * Deletes the schema configuration at the Api. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @param schemaId Schema identifier within an API. Must be unique in the current API Management service instance. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable deleteAsync(String resourceGroupName, String serviceName, String apiId, String schemaId, String ifMatch) { + return deleteWithServiceResponseAsync(resourceGroupName, serviceName, apiId, schemaId, ifMatch).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes the schema configuration at the Api. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @param schemaId Schema identifier within an API. Must be unique in the current API Management service instance. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> deleteWithServiceResponseAsync(String resourceGroupName, String serviceName, String apiId, String schemaId, String ifMatch) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (apiId == null) { + throw new IllegalArgumentException("Parameter apiId is required and cannot be null."); + } + if (schemaId == null) { + throw new IllegalArgumentException("Parameter schemaId is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (ifMatch == null) { + throw new IllegalArgumentException("Parameter ifMatch 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 Boolean force = null; + return service.delete(resourceGroupName, serviceName, apiId, schemaId, this.client.subscriptionId(), force, ifMatch, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = deleteDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Deletes the schema configuration at the Api. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @param schemaId Schema identifier within an API. Must be unique in the current API Management service instance. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @param force If true removes all references to the schema before deleting it. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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 serviceName, String apiId, String schemaId, String ifMatch, Boolean force) { + deleteWithServiceResponseAsync(resourceGroupName, serviceName, apiId, schemaId, ifMatch, force).toBlocking().single().body(); + } + + /** + * Deletes the schema configuration at the Api. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @param schemaId Schema identifier within an API. Must be unique in the current API Management service instance. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @param force If true removes all references to the schema before deleting it. + * @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 serviceName, String apiId, String schemaId, String ifMatch, Boolean force, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, serviceName, apiId, schemaId, ifMatch, force), serviceCallback); + } + + /** + * Deletes the schema configuration at the Api. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @param schemaId Schema identifier within an API. Must be unique in the current API Management service instance. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @param force If true removes all references to the schema before deleting it. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable deleteAsync(String resourceGroupName, String serviceName, String apiId, String schemaId, String ifMatch, Boolean force) { + return deleteWithServiceResponseAsync(resourceGroupName, serviceName, apiId, schemaId, ifMatch, force).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes the schema configuration at the Api. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @param schemaId Schema identifier within an API. Must be unique in the current API Management service instance. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @param force If true removes all references to the schema before deleting it. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> deleteWithServiceResponseAsync(String resourceGroupName, String serviceName, String apiId, String schemaId, String ifMatch, Boolean force) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (apiId == null) { + throw new IllegalArgumentException("Parameter apiId is required and cannot be null."); + } + if (schemaId == null) { + throw new IllegalArgumentException("Parameter schemaId is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (ifMatch == null) { + throw new IllegalArgumentException("Parameter ifMatch 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.delete(resourceGroupName, serviceName, apiId, schemaId, this.client.subscriptionId(), force, ifMatch, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = deleteDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse deleteDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(204, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Get the schema configuration at the API level. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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<SchemaContractInner> object if successful. + */ + public PagedList listByApiNext(final String nextPageLink) { + ServiceResponse> response = listByApiNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByApiNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Get the schema configuration at the API level. + * + * @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> listByApiNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByApiNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByApiNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Get the schema configuration at the API level. + * + * @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<SchemaContractInner> object + */ + public Observable> listByApiNextAsync(final String nextPageLink) { + return listByApiNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Get the schema configuration at the API level. + * + * @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<SchemaContractInner> object + */ + public Observable>> listByApiNextWithServiceResponseAsync(final String nextPageLink) { + return listByApiNextSinglePageAsync(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(listByApiNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Get the schema configuration at the API level. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<SchemaContractInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByApiNextSinglePageAsync(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.listByApiNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByApiNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByApiNextDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ApiTagDescriptionsImpl.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ApiTagDescriptionsImpl.java new file mode 100644 index 0000000000000..54cd58293abbe --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ApiTagDescriptionsImpl.java @@ -0,0 +1,87 @@ +/** + * 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.apimanagement.v2019_01_01.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.apimanagement.v2019_01_01.ApiTagDescriptions; +import rx.Completable; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.apimanagement.v2019_01_01.TagDescriptionContract; + +class ApiTagDescriptionsImpl extends WrapperImpl implements ApiTagDescriptions { + private final ApiManagementManager manager; + + ApiTagDescriptionsImpl(ApiManagementManager manager) { + super(manager.inner().apiTagDescriptions()); + this.manager = manager; + } + + public ApiManagementManager manager() { + return this.manager; + } + + @Override + public TagDescriptionContractImpl define(String name) { + return wrapModel(name); + } + + private TagDescriptionContractImpl wrapModel(TagDescriptionContractInner inner) { + return new TagDescriptionContractImpl(inner, manager()); + } + + private TagDescriptionContractImpl wrapModel(String name) { + return new TagDescriptionContractImpl(name, this.manager()); + } + + @Override + public Completable getEntityTagAsync(String resourceGroupName, String serviceName, String apiId, String tagId) { + ApiTagDescriptionsInner client = this.inner(); + return client.getEntityTagAsync(resourceGroupName, serviceName, apiId, tagId).toCompletable(); + } + + @Override + public Observable listByServiceAsync(final String resourceGroupName, final String serviceName, final String apiId) { + ApiTagDescriptionsInner client = this.inner(); + return client.listByServiceAsync(resourceGroupName, serviceName, apiId) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public TagDescriptionContract call(TagDescriptionContractInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Observable getAsync(String resourceGroupName, String serviceName, String apiId, String tagId) { + ApiTagDescriptionsInner client = this.inner(); + return client.getAsync(resourceGroupName, serviceName, apiId, tagId) + .map(new Func1() { + @Override + public TagDescriptionContract call(TagDescriptionContractInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Completable deleteAsync(String resourceGroupName, String serviceName, String apiId, String tagId, String ifMatch) { + ApiTagDescriptionsInner client = this.inner(); + return client.deleteAsync(resourceGroupName, serviceName, apiId, tagId, ifMatch).toCompletable(); + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ApiTagDescriptionsInner.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ApiTagDescriptionsInner.java new file mode 100644 index 0000000000000..3f566a662ab93 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ApiTagDescriptionsInner.java @@ -0,0 +1,1001 @@ +/** + * 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.apimanagement.v2019_01_01.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.apimanagement.v2019_01_01.ApiTagDescriptionCreateOrUpdateHeaders; +import com.microsoft.azure.management.apimanagement.v2019_01_01.ApiTagDescriptionGetEntityTagHeaders; +import com.microsoft.azure.management.apimanagement.v2019_01_01.ApiTagDescriptionGetHeaders; +import com.microsoft.azure.management.apimanagement.v2019_01_01.ErrorResponseException; +import com.microsoft.azure.management.apimanagement.v2019_01_01.TagDescriptionCreateParameters; +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.ServiceResponseWithHeaders; +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.HEAD; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.HTTP; +import retrofit2.http.Path; +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 ApiTagDescriptions. + */ +public class ApiTagDescriptionsInner { + /** The Retrofit service to perform REST calls. */ + private ApiTagDescriptionsService service; + /** The service client containing this operation class. */ + private ApiManagementClientImpl client; + + /** + * Initializes an instance of ApiTagDescriptionsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public ApiTagDescriptionsInner(Retrofit retrofit, ApiManagementClientImpl client) { + this.service = retrofit.create(ApiTagDescriptionsService.class); + this.client = client; + } + + /** + * The interface defining all the services for ApiTagDescriptions to be + * used by Retrofit to perform actually REST calls. + */ + interface ApiTagDescriptionsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.apimanagement.v2019_01_01.ApiTagDescriptions listByService" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/tagDescriptions") + Observable> listByService(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("apiId") String apiId, @Path("subscriptionId") String subscriptionId, @Query("$filter") String filter, @Query("$top") Integer top, @Query("$skip") Integer skip, @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.apimanagement.v2019_01_01.ApiTagDescriptions getEntityTag" }) + @HEAD("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/tagDescriptions/{tagId}") + Observable> getEntityTag(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("apiId") String apiId, @Path("tagId") String tagId, @Path("subscriptionId") String subscriptionId, @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.apimanagement.v2019_01_01.ApiTagDescriptions get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/tagDescriptions/{tagId}") + Observable> get(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("apiId") String apiId, @Path("tagId") String tagId, @Path("subscriptionId") String subscriptionId, @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.apimanagement.v2019_01_01.ApiTagDescriptions createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/tagDescriptions/{tagId}") + Observable> createOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("apiId") String apiId, @Path("tagId") String tagId, @Path("subscriptionId") String subscriptionId, @Body TagDescriptionCreateParameters parameters, @Header("If-Match") String ifMatch, @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.apimanagement.v2019_01_01.ApiTagDescriptions delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/tagDescriptions/{tagId}", method = "DELETE", hasBody = true) + Observable> delete(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("apiId") String apiId, @Path("tagId") String tagId, @Path("subscriptionId") String subscriptionId, @Header("If-Match") String ifMatch, @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.apimanagement.v2019_01_01.ApiTagDescriptions listByServiceNext" }) + @GET + Observable> listByServiceNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Lists all Tags descriptions in scope of API. Model similar to swagger - tagDescription is defined on API level but tag may be assigned to the Operations. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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<TagDescriptionContractInner> object if successful. + */ + public PagedList listByService(final String resourceGroupName, final String serviceName, final String apiId) { + ServiceResponse> response = listByServiceSinglePageAsync(resourceGroupName, serviceName, apiId).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByServiceNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists all Tags descriptions in scope of API. Model similar to swagger - tagDescription is defined on API level but tag may be assigned to the Operations. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @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> listByServiceAsync(final String resourceGroupName, final String serviceName, final String apiId, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByServiceSinglePageAsync(resourceGroupName, serviceName, apiId), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByServiceNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists all Tags descriptions in scope of API. Model similar to swagger - tagDescription is defined on API level but tag may be assigned to the Operations. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<TagDescriptionContractInner> object + */ + public Observable> listByServiceAsync(final String resourceGroupName, final String serviceName, final String apiId) { + return listByServiceWithServiceResponseAsync(resourceGroupName, serviceName, apiId) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all Tags descriptions in scope of API. Model similar to swagger - tagDescription is defined on API level but tag may be assigned to the Operations. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<TagDescriptionContractInner> object + */ + public Observable>> listByServiceWithServiceResponseAsync(final String resourceGroupName, final String serviceName, final String apiId) { + return listByServiceSinglePageAsync(resourceGroupName, serviceName, apiId) + .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(listByServiceNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists all Tags descriptions in scope of API. Model similar to swagger - tagDescription is defined on API level but tag may be assigned to the Operations. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<TagDescriptionContractInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByServiceSinglePageAsync(final String resourceGroupName, final String serviceName, final String apiId) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (apiId == null) { + throw new IllegalArgumentException("Parameter apiId is required and cannot be null."); + } + 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 filter = null; + final Integer top = null; + final Integer skip = null; + return service.listByService(resourceGroupName, serviceName, apiId, this.client.subscriptionId(), filter, top, skip, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByServiceDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Lists all Tags descriptions in scope of API. Model similar to swagger - tagDescription is defined on API level but tag may be assigned to the Operations. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br> + * @param top Number of records to return. + * @param skip Number of records to skip. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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<TagDescriptionContractInner> object if successful. + */ + public PagedList listByService(final String resourceGroupName, final String serviceName, final String apiId, final String filter, final Integer top, final Integer skip) { + ServiceResponse> response = listByServiceSinglePageAsync(resourceGroupName, serviceName, apiId, filter, top, skip).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByServiceNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists all Tags descriptions in scope of API. Model similar to swagger - tagDescription is defined on API level but tag may be assigned to the Operations. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br> + * @param top Number of records to return. + * @param skip Number of records to skip. + * @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> listByServiceAsync(final String resourceGroupName, final String serviceName, final String apiId, final String filter, final Integer top, final Integer skip, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByServiceSinglePageAsync(resourceGroupName, serviceName, apiId, filter, top, skip), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByServiceNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists all Tags descriptions in scope of API. Model similar to swagger - tagDescription is defined on API level but tag may be assigned to the Operations. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br> + * @param top Number of records to return. + * @param skip Number of records to skip. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<TagDescriptionContractInner> object + */ + public Observable> listByServiceAsync(final String resourceGroupName, final String serviceName, final String apiId, final String filter, final Integer top, final Integer skip) { + return listByServiceWithServiceResponseAsync(resourceGroupName, serviceName, apiId, filter, top, skip) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all Tags descriptions in scope of API. Model similar to swagger - tagDescription is defined on API level but tag may be assigned to the Operations. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br> + * @param top Number of records to return. + * @param skip Number of records to skip. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<TagDescriptionContractInner> object + */ + public Observable>> listByServiceWithServiceResponseAsync(final String resourceGroupName, final String serviceName, final String apiId, final String filter, final Integer top, final Integer skip) { + return listByServiceSinglePageAsync(resourceGroupName, serviceName, apiId, filter, top, skip) + .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(listByServiceNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists all Tags descriptions in scope of API. Model similar to swagger - tagDescription is defined on API level but tag may be assigned to the Operations. + * + ServiceResponse> * @param resourceGroupName The name of the resource group. + ServiceResponse> * @param serviceName The name of the API Management service. + ServiceResponse> * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + ServiceResponse> * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br> + ServiceResponse> * @param top Number of records to return. + ServiceResponse> * @param skip Number of records to skip. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<TagDescriptionContractInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByServiceSinglePageAsync(final String resourceGroupName, final String serviceName, final String apiId, final String filter, final Integer top, final Integer skip) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (apiId == null) { + throw new IllegalArgumentException("Parameter apiId is required and cannot be null."); + } + 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.listByService(resourceGroupName, serviceName, apiId, this.client.subscriptionId(), filter, top, skip, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByServiceDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByServiceDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Gets the entity state version of the tag specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @param tagId Tag identifier. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void getEntityTag(String resourceGroupName, String serviceName, String apiId, String tagId) { + getEntityTagWithServiceResponseAsync(resourceGroupName, serviceName, apiId, tagId).toBlocking().single().body(); + } + + /** + * Gets the entity state version of the tag specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @param tagId Tag identifier. Must be unique in the current API Management service instance. + * @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 getEntityTagAsync(String resourceGroupName, String serviceName, String apiId, String tagId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(getEntityTagWithServiceResponseAsync(resourceGroupName, serviceName, apiId, tagId), serviceCallback); + } + + /** + * Gets the entity state version of the tag specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @param tagId Tag identifier. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public Observable getEntityTagAsync(String resourceGroupName, String serviceName, String apiId, String tagId) { + return getEntityTagWithServiceResponseAsync(resourceGroupName, serviceName, apiId, tagId).map(new Func1, Void>() { + @Override + public Void call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Gets the entity state version of the tag specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @param tagId Tag identifier. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public Observable> getEntityTagWithServiceResponseAsync(String resourceGroupName, String serviceName, String apiId, String tagId) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (apiId == null) { + throw new IllegalArgumentException("Parameter apiId is required and cannot be null."); + } + if (tagId == null) { + throw new IllegalArgumentException("Parameter tagId is required and cannot be null."); + } + 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.getEntityTag(resourceGroupName, serviceName, apiId, tagId, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = getEntityTagDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponseWithHeaders getEntityTagDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .buildEmptyWithHeaders(response, ApiTagDescriptionGetEntityTagHeaders.class); + } + + /** + * Get Tag description in scope of API. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @param tagId Tag identifier. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the TagDescriptionContractInner object if successful. + */ + public TagDescriptionContractInner get(String resourceGroupName, String serviceName, String apiId, String tagId) { + return getWithServiceResponseAsync(resourceGroupName, serviceName, apiId, tagId).toBlocking().single().body(); + } + + /** + * Get Tag description in scope of API. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @param tagId Tag identifier. Must be unique in the current API Management service instance. + * @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 getAsync(String resourceGroupName, String serviceName, String apiId, String tagId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(getWithServiceResponseAsync(resourceGroupName, serviceName, apiId, tagId), serviceCallback); + } + + /** + * Get Tag description in scope of API. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @param tagId Tag identifier. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the TagDescriptionContractInner object + */ + public Observable getAsync(String resourceGroupName, String serviceName, String apiId, String tagId) { + return getWithServiceResponseAsync(resourceGroupName, serviceName, apiId, tagId).map(new Func1, TagDescriptionContractInner>() { + @Override + public TagDescriptionContractInner call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Get Tag description in scope of API. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @param tagId Tag identifier. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the TagDescriptionContractInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String serviceName, String apiId, String tagId) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (apiId == null) { + throw new IllegalArgumentException("Parameter apiId is required and cannot be null."); + } + if (tagId == null) { + throw new IllegalArgumentException("Parameter tagId is required and cannot be null."); + } + 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.get(resourceGroupName, serviceName, apiId, tagId, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = getDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponseWithHeaders getDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .buildWithHeaders(response, ApiTagDescriptionGetHeaders.class); + } + + /** + * Create/Update tag description in scope of the Api. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @param tagId Tag identifier. Must be unique in the current API Management service instance. + * @param parameters Create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the TagDescriptionContractInner object if successful. + */ + public TagDescriptionContractInner createOrUpdate(String resourceGroupName, String serviceName, String apiId, String tagId, TagDescriptionCreateParameters parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serviceName, apiId, tagId, parameters).toBlocking().single().body(); + } + + /** + * Create/Update tag description in scope of the Api. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @param tagId Tag identifier. Must be unique in the current API Management service instance. + * @param parameters Create parameters. + * @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 createOrUpdateAsync(String resourceGroupName, String serviceName, String apiId, String tagId, TagDescriptionCreateParameters parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, serviceName, apiId, tagId, parameters), serviceCallback); + } + + /** + * Create/Update tag description in scope of the Api. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @param tagId Tag identifier. Must be unique in the current API Management service instance. + * @param parameters Create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the TagDescriptionContractInner object + */ + public Observable createOrUpdateAsync(String resourceGroupName, String serviceName, String apiId, String tagId, TagDescriptionCreateParameters parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serviceName, apiId, tagId, parameters).map(new Func1, TagDescriptionContractInner>() { + @Override + public TagDescriptionContractInner call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Create/Update tag description in scope of the Api. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @param tagId Tag identifier. Must be unique in the current API Management service instance. + * @param parameters Create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the TagDescriptionContractInner object + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String serviceName, String apiId, String tagId, TagDescriptionCreateParameters parameters) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (apiId == null) { + throw new IllegalArgumentException("Parameter apiId is required and cannot be null."); + } + if (tagId == null) { + throw new IllegalArgumentException("Parameter tagId is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(parameters); + final String ifMatch = null; + return service.createOrUpdate(resourceGroupName, serviceName, apiId, tagId, this.client.subscriptionId(), parameters, ifMatch, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = createOrUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Create/Update tag description in scope of the Api. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @param tagId Tag identifier. Must be unique in the current API Management service instance. + * @param parameters Create parameters. + * @param ifMatch ETag of the Entity. Not required when creating an entity, but required when updating an entity. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the TagDescriptionContractInner object if successful. + */ + public TagDescriptionContractInner createOrUpdate(String resourceGroupName, String serviceName, String apiId, String tagId, TagDescriptionCreateParameters parameters, String ifMatch) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serviceName, apiId, tagId, parameters, ifMatch).toBlocking().single().body(); + } + + /** + * Create/Update tag description in scope of the Api. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @param tagId Tag identifier. Must be unique in the current API Management service instance. + * @param parameters Create parameters. + * @param ifMatch ETag of the Entity. Not required when creating an entity, but required when updating an entity. + * @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 createOrUpdateAsync(String resourceGroupName, String serviceName, String apiId, String tagId, TagDescriptionCreateParameters parameters, String ifMatch, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, serviceName, apiId, tagId, parameters, ifMatch), serviceCallback); + } + + /** + * Create/Update tag description in scope of the Api. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @param tagId Tag identifier. Must be unique in the current API Management service instance. + * @param parameters Create parameters. + * @param ifMatch ETag of the Entity. Not required when creating an entity, but required when updating an entity. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the TagDescriptionContractInner object + */ + public Observable createOrUpdateAsync(String resourceGroupName, String serviceName, String apiId, String tagId, TagDescriptionCreateParameters parameters, String ifMatch) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serviceName, apiId, tagId, parameters, ifMatch).map(new Func1, TagDescriptionContractInner>() { + @Override + public TagDescriptionContractInner call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Create/Update tag description in scope of the Api. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @param tagId Tag identifier. Must be unique in the current API Management service instance. + * @param parameters Create parameters. + * @param ifMatch ETag of the Entity. Not required when creating an entity, but required when updating an entity. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the TagDescriptionContractInner object + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String serviceName, String apiId, String tagId, TagDescriptionCreateParameters parameters, String ifMatch) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (apiId == null) { + throw new IllegalArgumentException("Parameter apiId is required and cannot be null."); + } + if (tagId == null) { + throw new IllegalArgumentException("Parameter tagId is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(parameters); + return service.createOrUpdate(resourceGroupName, serviceName, apiId, tagId, this.client.subscriptionId(), parameters, ifMatch, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = createOrUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponseWithHeaders createOrUpdateDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(201, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .buildWithHeaders(response, ApiTagDescriptionCreateOrUpdateHeaders.class); + } + + /** + * Delete tag description for the Api. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @param tagId Tag identifier. Must be unique in the current API Management service instance. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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 serviceName, String apiId, String tagId, String ifMatch) { + deleteWithServiceResponseAsync(resourceGroupName, serviceName, apiId, tagId, ifMatch).toBlocking().single().body(); + } + + /** + * Delete tag description for the Api. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @param tagId Tag identifier. Must be unique in the current API Management service instance. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @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 serviceName, String apiId, String tagId, String ifMatch, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, serviceName, apiId, tagId, ifMatch), serviceCallback); + } + + /** + * Delete tag description for the Api. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @param tagId Tag identifier. Must be unique in the current API Management service instance. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable deleteAsync(String resourceGroupName, String serviceName, String apiId, String tagId, String ifMatch) { + return deleteWithServiceResponseAsync(resourceGroupName, serviceName, apiId, tagId, ifMatch).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Delete tag description for the Api. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @param tagId Tag identifier. Must be unique in the current API Management service instance. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> deleteWithServiceResponseAsync(String resourceGroupName, String serviceName, String apiId, String tagId, String ifMatch) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (apiId == null) { + throw new IllegalArgumentException("Parameter apiId is required and cannot be null."); + } + if (tagId == null) { + throw new IllegalArgumentException("Parameter tagId is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (ifMatch == null) { + throw new IllegalArgumentException("Parameter ifMatch 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.delete(resourceGroupName, serviceName, apiId, tagId, this.client.subscriptionId(), ifMatch, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = deleteDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse deleteDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(204, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists all Tags descriptions in scope of API. Model similar to swagger - tagDescription is defined on API level but tag may be assigned to the Operations. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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<TagDescriptionContractInner> object if successful. + */ + public PagedList listByServiceNext(final String nextPageLink) { + ServiceResponse> response = listByServiceNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByServiceNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists all Tags descriptions in scope of API. Model similar to swagger - tagDescription is defined on API level but tag may be assigned to the Operations. + * + * @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> listByServiceNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByServiceNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByServiceNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists all Tags descriptions in scope of API. Model similar to swagger - tagDescription is defined on API level but tag may be assigned to the Operations. + * + * @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<TagDescriptionContractInner> object + */ + public Observable> listByServiceNextAsync(final String nextPageLink) { + return listByServiceNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all Tags descriptions in scope of API. Model similar to swagger - tagDescription is defined on API level but tag may be assigned to the Operations. + * + * @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<TagDescriptionContractInner> object + */ + public Observable>> listByServiceNextWithServiceResponseAsync(final String nextPageLink) { + return listByServiceNextSinglePageAsync(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(listByServiceNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists all Tags descriptions in scope of API. Model similar to swagger - tagDescription is defined on API level but tag may be assigned to the Operations. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<TagDescriptionContractInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByServiceNextSinglePageAsync(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.listByServiceNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByServiceNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByServiceNextDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ApiVersionSetContractImpl.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ApiVersionSetContractImpl.java new file mode 100644 index 0000000000000..8efaa6223b47f --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ApiVersionSetContractImpl.java @@ -0,0 +1,168 @@ +/** + * 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.apimanagement.v2019_01_01.implementation; + +import com.microsoft.azure.management.apimanagement.v2019_01_01.ApiVersionSetContract; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import com.microsoft.azure.management.apimanagement.v2019_01_01.VersioningScheme; + +class ApiVersionSetContractImpl extends CreatableUpdatableImpl implements ApiVersionSetContract, ApiVersionSetContract.Definition, ApiVersionSetContract.Update { + private String resourceGroupName; + private String serviceName; + private String versionSetId; + private String cifMatch; + private String uifMatch; + private final ApiManagementManager manager; + + ApiVersionSetContractImpl(String name, ApiManagementManager manager) { + super(name, new ApiVersionSetContractInner()); + this.manager = manager; + // Set resource name + this.versionSetId = name; + // + } + + ApiVersionSetContractImpl(ApiVersionSetContractInner inner, ApiManagementManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.versionSetId = inner.name(); + // set resource ancestor and positional variables + this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourceGroups"); + this.serviceName = IdParsingUtils.getValueFromIdByName(inner.id(), "service"); + this.versionSetId = IdParsingUtils.getValueFromIdByName(inner.id(), "apiVersionSets"); + // set other parameters for create and update + } + + @Override + public ApiManagementManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + ApiVersionSetsInner client = this.manager().inner().apiVersionSets(); + return client.createOrUpdateAsync(this.resourceGroupName, this.serviceName, this.versionSetId, this.inner(), this.cifMatch) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + ApiVersionSetsInner client = this.manager().inner().apiVersionSets(); + return client.createOrUpdateAsync(this.resourceGroupName, this.serviceName, this.versionSetId, this.inner(), this.uifMatch) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + ApiVersionSetsInner client = this.manager().inner().apiVersionSets(); + return null; // NOP getInnerAsync implementation as get is not supported + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + + @Override + public String description() { + return this.inner().description(); + } + + @Override + public String displayName() { + return this.inner().displayName(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public String versionHeaderName() { + return this.inner().versionHeaderName(); + } + + @Override + public VersioningScheme versioningScheme() { + return this.inner().versioningScheme(); + } + + @Override + public String versionQueryName() { + return this.inner().versionQueryName(); + } + + @Override + public ApiVersionSetContractImpl withResourceGroupName(String resourceGroupName) { + this.resourceGroupName = resourceGroupName; + return this; + } + + @Override + public ApiVersionSetContractImpl withServiceName(String serviceName) { + this.serviceName = serviceName; + return this; + } + + @Override + public ApiVersionSetContractImpl withDisplayName(String displayName) { + this.inner().withDisplayName(displayName); + return this; + } + + @Override + public ApiVersionSetContractImpl withVersioningScheme(VersioningScheme versioningScheme) { + this.inner().withVersioningScheme(versioningScheme); + return this; + } + + @Override + public ApiVersionSetContractImpl withIfMatch(String ifMatch) { + if (isInCreateMode()) { + this.cifMatch = ifMatch; + } else { + this.uifMatch = ifMatch; + } + return this; + } + + @Override + public ApiVersionSetContractImpl withDescription(String description) { + this.inner().withDescription(description); + return this; + } + + @Override + public ApiVersionSetContractImpl withVersionHeaderName(String versionHeaderName) { + this.inner().withVersionHeaderName(versionHeaderName); + return this; + } + + @Override + public ApiVersionSetContractImpl withVersionQueryName(String versionQueryName) { + this.inner().withVersionQueryName(versionQueryName); + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ApiVersionSetContractInner.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ApiVersionSetContractInner.java new file mode 100644 index 0000000000000..fbed952e08e9a --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ApiVersionSetContractInner.java @@ -0,0 +1,155 @@ +/** + * 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.apimanagement.v2019_01_01.implementation; + +import com.microsoft.azure.management.apimanagement.v2019_01_01.VersioningScheme; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * Api Version Set Contract details. + */ +@JsonFlatten +public class ApiVersionSetContractInner extends ProxyResource { + /** + * Description of API Version Set. + */ + @JsonProperty(value = "properties.description") + private String description; + + /** + * Name of query parameter that indicates the API Version if + * versioningScheme is set to `query`. + */ + @JsonProperty(value = "properties.versionQueryName") + private String versionQueryName; + + /** + * Name of HTTP header parameter that indicates the API Version if + * versioningScheme is set to `header`. + */ + @JsonProperty(value = "properties.versionHeaderName") + private String versionHeaderName; + + /** + * Name of API Version Set. + */ + @JsonProperty(value = "properties.displayName", required = true) + private String displayName; + + /** + * An value that determines where the API Version identifer will be located + * in a HTTP request. Possible values include: 'Segment', 'Query', + * 'Header'. + */ + @JsonProperty(value = "properties.versioningScheme", required = true) + private VersioningScheme versioningScheme; + + /** + * Get description of API Version Set. + * + * @return the description value + */ + public String description() { + return this.description; + } + + /** + * Set description of API Version Set. + * + * @param description the description value to set + * @return the ApiVersionSetContractInner object itself. + */ + public ApiVersionSetContractInner withDescription(String description) { + this.description = description; + return this; + } + + /** + * Get name of query parameter that indicates the API Version if versioningScheme is set to `query`. + * + * @return the versionQueryName value + */ + public String versionQueryName() { + return this.versionQueryName; + } + + /** + * Set name of query parameter that indicates the API Version if versioningScheme is set to `query`. + * + * @param versionQueryName the versionQueryName value to set + * @return the ApiVersionSetContractInner object itself. + */ + public ApiVersionSetContractInner withVersionQueryName(String versionQueryName) { + this.versionQueryName = versionQueryName; + return this; + } + + /** + * Get name of HTTP header parameter that indicates the API Version if versioningScheme is set to `header`. + * + * @return the versionHeaderName value + */ + public String versionHeaderName() { + return this.versionHeaderName; + } + + /** + * Set name of HTTP header parameter that indicates the API Version if versioningScheme is set to `header`. + * + * @param versionHeaderName the versionHeaderName value to set + * @return the ApiVersionSetContractInner object itself. + */ + public ApiVersionSetContractInner withVersionHeaderName(String versionHeaderName) { + this.versionHeaderName = versionHeaderName; + return this; + } + + /** + * Get name of API Version Set. + * + * @return the displayName value + */ + public String displayName() { + return this.displayName; + } + + /** + * Set name of API Version Set. + * + * @param displayName the displayName value to set + * @return the ApiVersionSetContractInner object itself. + */ + public ApiVersionSetContractInner withDisplayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Get an value that determines where the API Version identifer will be located in a HTTP request. Possible values include: 'Segment', 'Query', 'Header'. + * + * @return the versioningScheme value + */ + public VersioningScheme versioningScheme() { + return this.versioningScheme; + } + + /** + * Set an value that determines where the API Version identifer will be located in a HTTP request. Possible values include: 'Segment', 'Query', 'Header'. + * + * @param versioningScheme the versioningScheme value to set + * @return the ApiVersionSetContractInner object itself. + */ + public ApiVersionSetContractInner withVersioningScheme(VersioningScheme versioningScheme) { + this.versioningScheme = versioningScheme; + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ApiVersionSetsImpl.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ApiVersionSetsImpl.java new file mode 100644 index 0000000000000..43c61f98ce32c --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ApiVersionSetsImpl.java @@ -0,0 +1,87 @@ +/** + * 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. + * jkl + */ + +package com.microsoft.azure.management.apimanagement.v2019_01_01.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.apimanagement.v2019_01_01.ApiVersionSets; +import rx.Completable; +import rx.functions.Func1; +import rx.Observable; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.apimanagement.v2019_01_01.ApiVersionSetContract; + +class ApiVersionSetsImpl extends WrapperImpl implements ApiVersionSets { + private final ApiManagementManager manager; + + ApiVersionSetsImpl(ApiManagementManager manager) { + super(manager.inner().apiVersionSets()); + this.manager = manager; + } + + public ApiManagementManager manager() { + return this.manager; + } + + @Override + public ApiVersionSetContractImpl define(String name) { + return wrapModel(name); + } + + private ApiVersionSetContractImpl wrapModel(ApiVersionSetContractInner inner) { + return new ApiVersionSetContractImpl(inner, manager()); + } + + private ApiVersionSetContractImpl wrapModel(String name) { + return new ApiVersionSetContractImpl(name, this.manager()); + } + + @Override + public Observable listByServiceAsync(final String resourceGroupName, final String serviceName) { + ApiVersionSetsInner client = this.inner(); + return client.listByServiceAsync(resourceGroupName, serviceName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public ApiVersionSetContract call(ApiVersionSetContractInner inner) { + return new ApiVersionSetContractImpl(inner, manager()); + } + }); + } + + @Override + public Completable getEntityTagAsync(String resourceGroupName, String serviceName, String versionSetId) { + ApiVersionSetsInner client = this.inner(); + return client.getEntityTagAsync(resourceGroupName, serviceName, versionSetId).toCompletable(); + } + + @Override + public Observable getAsync(String resourceGroupName, String serviceName, String versionSetId) { + ApiVersionSetsInner client = this.inner(); + return client.getAsync(resourceGroupName, serviceName, versionSetId) + .map(new Func1() { + @Override + public ApiVersionSetContract call(ApiVersionSetContractInner inner) { + return new ApiVersionSetContractImpl(inner, manager()); + } + }); + } + + @Override + public Completable deleteAsync(String resourceGroupName, String serviceName, String versionSetId, String ifMatch) { + ApiVersionSetsInner client = this.inner(); + return client.deleteAsync(resourceGroupName, serviceName, versionSetId, ifMatch).toCompletable(); + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ApiVersionSetsInner.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ApiVersionSetsInner.java new file mode 100644 index 0000000000000..356bf04142359 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ApiVersionSetsInner.java @@ -0,0 +1,1062 @@ +/** + * 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.apimanagement.v2019_01_01.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.apimanagement.v2019_01_01.ApiVersionSetCreateOrUpdateHeaders; +import com.microsoft.azure.management.apimanagement.v2019_01_01.ApiVersionSetGetEntityTagHeaders; +import com.microsoft.azure.management.apimanagement.v2019_01_01.ApiVersionSetGetHeaders; +import com.microsoft.azure.management.apimanagement.v2019_01_01.ApiVersionSetUpdateParameters; +import com.microsoft.azure.management.apimanagement.v2019_01_01.ErrorResponseException; +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.ServiceResponseWithHeaders; +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.HEAD; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.HTTP; +import retrofit2.http.PATCH; +import retrofit2.http.Path; +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 ApiVersionSets. + */ +public class ApiVersionSetsInner { + /** The Retrofit service to perform REST calls. */ + private ApiVersionSetsService service; + /** The service client containing this operation class. */ + private ApiManagementClientImpl client; + + /** + * Initializes an instance of ApiVersionSetsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public ApiVersionSetsInner(Retrofit retrofit, ApiManagementClientImpl client) { + this.service = retrofit.create(ApiVersionSetsService.class); + this.client = client; + } + + /** + * The interface defining all the services for ApiVersionSets to be + * used by Retrofit to perform actually REST calls. + */ + interface ApiVersionSetsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.apimanagement.v2019_01_01.ApiVersionSets listByService" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apiVersionSets") + Observable> listByService(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("subscriptionId") String subscriptionId, @Query("$filter") String filter, @Query("$top") Integer top, @Query("$skip") Integer skip, @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.apimanagement.v2019_01_01.ApiVersionSets getEntityTag" }) + @HEAD("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apiVersionSets/{versionSetId}") + Observable> getEntityTag(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("versionSetId") String versionSetId, @Path("subscriptionId") String subscriptionId, @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.apimanagement.v2019_01_01.ApiVersionSets get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apiVersionSets/{versionSetId}") + Observable> get(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("versionSetId") String versionSetId, @Path("subscriptionId") String subscriptionId, @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.apimanagement.v2019_01_01.ApiVersionSets createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apiVersionSets/{versionSetId}") + Observable> createOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("versionSetId") String versionSetId, @Path("subscriptionId") String subscriptionId, @Body ApiVersionSetContractInner parameters, @Header("If-Match") String ifMatch, @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.apimanagement.v2019_01_01.ApiVersionSets update" }) + @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apiVersionSets/{versionSetId}") + Observable> update(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("versionSetId") String versionSetId, @Path("subscriptionId") String subscriptionId, @Body ApiVersionSetUpdateParameters parameters, @Header("If-Match") String ifMatch, @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.apimanagement.v2019_01_01.ApiVersionSets delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apiVersionSets/{versionSetId}", method = "DELETE", hasBody = true) + Observable> delete(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("versionSetId") String versionSetId, @Path("subscriptionId") String subscriptionId, @Header("If-Match") String ifMatch, @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.apimanagement.v2019_01_01.ApiVersionSets listByServiceNext" }) + @GET + Observable> listByServiceNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Lists a collection of API Version Sets in the specified service instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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<ApiVersionSetContractInner> object if successful. + */ + public PagedList listByService(final String resourceGroupName, final String serviceName) { + ServiceResponse> response = listByServiceSinglePageAsync(resourceGroupName, serviceName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByServiceNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists a collection of API Version Sets in the specified service instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @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> listByServiceAsync(final String resourceGroupName, final String serviceName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByServiceSinglePageAsync(resourceGroupName, serviceName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByServiceNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists a collection of API Version Sets in the specified service instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ApiVersionSetContractInner> object + */ + public Observable> listByServiceAsync(final String resourceGroupName, final String serviceName) { + return listByServiceWithServiceResponseAsync(resourceGroupName, serviceName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists a collection of API Version Sets in the specified service instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ApiVersionSetContractInner> object + */ + public Observable>> listByServiceWithServiceResponseAsync(final String resourceGroupName, final String serviceName) { + return listByServiceSinglePageAsync(resourceGroupName, serviceName) + .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(listByServiceNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists a collection of API Version Sets in the specified service instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ApiVersionSetContractInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByServiceSinglePageAsync(final String resourceGroupName, final String serviceName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + 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 filter = null; + final Integer top = null; + final Integer skip = null; + return service.listByService(resourceGroupName, serviceName, this.client.subscriptionId(), filter, top, skip, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByServiceDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Lists a collection of API Version Sets in the specified service instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br> + * @param top Number of records to return. + * @param skip Number of records to skip. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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<ApiVersionSetContractInner> object if successful. + */ + public PagedList listByService(final String resourceGroupName, final String serviceName, final String filter, final Integer top, final Integer skip) { + ServiceResponse> response = listByServiceSinglePageAsync(resourceGroupName, serviceName, filter, top, skip).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByServiceNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists a collection of API Version Sets in the specified service instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br> + * @param top Number of records to return. + * @param skip Number of records to skip. + * @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> listByServiceAsync(final String resourceGroupName, final String serviceName, final String filter, final Integer top, final Integer skip, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByServiceSinglePageAsync(resourceGroupName, serviceName, filter, top, skip), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByServiceNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists a collection of API Version Sets in the specified service instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br> + * @param top Number of records to return. + * @param skip Number of records to skip. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ApiVersionSetContractInner> object + */ + public Observable> listByServiceAsync(final String resourceGroupName, final String serviceName, final String filter, final Integer top, final Integer skip) { + return listByServiceWithServiceResponseAsync(resourceGroupName, serviceName, filter, top, skip) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists a collection of API Version Sets in the specified service instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br> + * @param top Number of records to return. + * @param skip Number of records to skip. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ApiVersionSetContractInner> object + */ + public Observable>> listByServiceWithServiceResponseAsync(final String resourceGroupName, final String serviceName, final String filter, final Integer top, final Integer skip) { + return listByServiceSinglePageAsync(resourceGroupName, serviceName, filter, top, skip) + .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(listByServiceNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists a collection of API Version Sets in the specified service instance. + * + ServiceResponse> * @param resourceGroupName The name of the resource group. + ServiceResponse> * @param serviceName The name of the API Management service. + ServiceResponse> * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br> + ServiceResponse> * @param top Number of records to return. + ServiceResponse> * @param skip Number of records to skip. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ApiVersionSetContractInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByServiceSinglePageAsync(final String resourceGroupName, final String serviceName, final String filter, final Integer top, final Integer skip) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + 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.listByService(resourceGroupName, serviceName, this.client.subscriptionId(), filter, top, skip, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByServiceDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByServiceDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Gets the entity state (Etag) version of the Api Version Set specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param versionSetId Api Version Set identifier. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void getEntityTag(String resourceGroupName, String serviceName, String versionSetId) { + getEntityTagWithServiceResponseAsync(resourceGroupName, serviceName, versionSetId).toBlocking().single().body(); + } + + /** + * Gets the entity state (Etag) version of the Api Version Set specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param versionSetId Api Version Set identifier. Must be unique in the current API Management service instance. + * @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 getEntityTagAsync(String resourceGroupName, String serviceName, String versionSetId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(getEntityTagWithServiceResponseAsync(resourceGroupName, serviceName, versionSetId), serviceCallback); + } + + /** + * Gets the entity state (Etag) version of the Api Version Set specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param versionSetId Api Version Set identifier. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public Observable getEntityTagAsync(String resourceGroupName, String serviceName, String versionSetId) { + return getEntityTagWithServiceResponseAsync(resourceGroupName, serviceName, versionSetId).map(new Func1, Void>() { + @Override + public Void call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Gets the entity state (Etag) version of the Api Version Set specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param versionSetId Api Version Set identifier. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public Observable> getEntityTagWithServiceResponseAsync(String resourceGroupName, String serviceName, String versionSetId) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (versionSetId == null) { + throw new IllegalArgumentException("Parameter versionSetId is required and cannot be null."); + } + 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.getEntityTag(resourceGroupName, serviceName, versionSetId, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = getEntityTagDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponseWithHeaders getEntityTagDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .buildEmptyWithHeaders(response, ApiVersionSetGetEntityTagHeaders.class); + } + + /** + * Gets the details of the Api Version Set specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param versionSetId Api Version Set identifier. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ApiVersionSetContractInner object if successful. + */ + public ApiVersionSetContractInner get(String resourceGroupName, String serviceName, String versionSetId) { + return getWithServiceResponseAsync(resourceGroupName, serviceName, versionSetId).toBlocking().single().body(); + } + + /** + * Gets the details of the Api Version Set specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param versionSetId Api Version Set identifier. Must be unique in the current API Management service instance. + * @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 getAsync(String resourceGroupName, String serviceName, String versionSetId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(getWithServiceResponseAsync(resourceGroupName, serviceName, versionSetId), serviceCallback); + } + + /** + * Gets the details of the Api Version Set specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param versionSetId Api Version Set identifier. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ApiVersionSetContractInner object + */ + public Observable getAsync(String resourceGroupName, String serviceName, String versionSetId) { + return getWithServiceResponseAsync(resourceGroupName, serviceName, versionSetId).map(new Func1, ApiVersionSetContractInner>() { + @Override + public ApiVersionSetContractInner call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Gets the details of the Api Version Set specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param versionSetId Api Version Set identifier. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ApiVersionSetContractInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String serviceName, String versionSetId) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (versionSetId == null) { + throw new IllegalArgumentException("Parameter versionSetId is required and cannot be null."); + } + 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.get(resourceGroupName, serviceName, versionSetId, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = getDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponseWithHeaders getDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .buildWithHeaders(response, ApiVersionSetGetHeaders.class); + } + + /** + * Creates or Updates a Api Version Set. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param versionSetId Api Version Set identifier. Must be unique in the current API Management service instance. + * @param parameters Create or update parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ApiVersionSetContractInner object if successful. + */ + public ApiVersionSetContractInner createOrUpdate(String resourceGroupName, String serviceName, String versionSetId, ApiVersionSetContractInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serviceName, versionSetId, parameters).toBlocking().single().body(); + } + + /** + * Creates or Updates a Api Version Set. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param versionSetId Api Version Set identifier. Must be unique in the current API Management service instance. + * @param parameters Create or update parameters. + * @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 createOrUpdateAsync(String resourceGroupName, String serviceName, String versionSetId, ApiVersionSetContractInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, serviceName, versionSetId, parameters), serviceCallback); + } + + /** + * Creates or Updates a Api Version Set. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param versionSetId Api Version Set identifier. Must be unique in the current API Management service instance. + * @param parameters Create or update parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ApiVersionSetContractInner object + */ + public Observable createOrUpdateAsync(String resourceGroupName, String serviceName, String versionSetId, ApiVersionSetContractInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serviceName, versionSetId, parameters).map(new Func1, ApiVersionSetContractInner>() { + @Override + public ApiVersionSetContractInner call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Creates or Updates a Api Version Set. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param versionSetId Api Version Set identifier. Must be unique in the current API Management service instance. + * @param parameters Create or update parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ApiVersionSetContractInner object + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String serviceName, String versionSetId, ApiVersionSetContractInner parameters) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (versionSetId == null) { + throw new IllegalArgumentException("Parameter versionSetId is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(parameters); + final String ifMatch = null; + return service.createOrUpdate(resourceGroupName, serviceName, versionSetId, this.client.subscriptionId(), parameters, ifMatch, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = createOrUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Creates or Updates a Api Version Set. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param versionSetId Api Version Set identifier. Must be unique in the current API Management service instance. + * @param parameters Create or update parameters. + * @param ifMatch ETag of the Entity. Not required when creating an entity, but required when updating an entity. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ApiVersionSetContractInner object if successful. + */ + public ApiVersionSetContractInner createOrUpdate(String resourceGroupName, String serviceName, String versionSetId, ApiVersionSetContractInner parameters, String ifMatch) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serviceName, versionSetId, parameters, ifMatch).toBlocking().single().body(); + } + + /** + * Creates or Updates a Api Version Set. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param versionSetId Api Version Set identifier. Must be unique in the current API Management service instance. + * @param parameters Create or update parameters. + * @param ifMatch ETag of the Entity. Not required when creating an entity, but required when updating an entity. + * @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 createOrUpdateAsync(String resourceGroupName, String serviceName, String versionSetId, ApiVersionSetContractInner parameters, String ifMatch, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, serviceName, versionSetId, parameters, ifMatch), serviceCallback); + } + + /** + * Creates or Updates a Api Version Set. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param versionSetId Api Version Set identifier. Must be unique in the current API Management service instance. + * @param parameters Create or update parameters. + * @param ifMatch ETag of the Entity. Not required when creating an entity, but required when updating an entity. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ApiVersionSetContractInner object + */ + public Observable createOrUpdateAsync(String resourceGroupName, String serviceName, String versionSetId, ApiVersionSetContractInner parameters, String ifMatch) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serviceName, versionSetId, parameters, ifMatch).map(new Func1, ApiVersionSetContractInner>() { + @Override + public ApiVersionSetContractInner call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Creates or Updates a Api Version Set. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param versionSetId Api Version Set identifier. Must be unique in the current API Management service instance. + * @param parameters Create or update parameters. + * @param ifMatch ETag of the Entity. Not required when creating an entity, but required when updating an entity. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ApiVersionSetContractInner object + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String serviceName, String versionSetId, ApiVersionSetContractInner parameters, String ifMatch) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (versionSetId == null) { + throw new IllegalArgumentException("Parameter versionSetId is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(parameters); + return service.createOrUpdate(resourceGroupName, serviceName, versionSetId, this.client.subscriptionId(), parameters, ifMatch, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = createOrUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponseWithHeaders createOrUpdateDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(201, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .buildWithHeaders(response, ApiVersionSetCreateOrUpdateHeaders.class); + } + + /** + * Updates the details of the Api VersionSet specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param versionSetId Api Version Set identifier. Must be unique in the current API Management service instance. + * @param parameters Update parameters. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void update(String resourceGroupName, String serviceName, String versionSetId, ApiVersionSetUpdateParameters parameters, String ifMatch) { + updateWithServiceResponseAsync(resourceGroupName, serviceName, versionSetId, parameters, ifMatch).toBlocking().single().body(); + } + + /** + * Updates the details of the Api VersionSet specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param versionSetId Api Version Set identifier. Must be unique in the current API Management service instance. + * @param parameters Update parameters. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @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 serviceName, String versionSetId, ApiVersionSetUpdateParameters parameters, String ifMatch, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateWithServiceResponseAsync(resourceGroupName, serviceName, versionSetId, parameters, ifMatch), serviceCallback); + } + + /** + * Updates the details of the Api VersionSet specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param versionSetId Api Version Set identifier. Must be unique in the current API Management service instance. + * @param parameters Update parameters. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable updateAsync(String resourceGroupName, String serviceName, String versionSetId, ApiVersionSetUpdateParameters parameters, String ifMatch) { + return updateWithServiceResponseAsync(resourceGroupName, serviceName, versionSetId, parameters, ifMatch).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates the details of the Api VersionSet specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param versionSetId Api Version Set identifier. Must be unique in the current API Management service instance. + * @param parameters Update parameters. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> updateWithServiceResponseAsync(String resourceGroupName, String serviceName, String versionSetId, ApiVersionSetUpdateParameters parameters, String ifMatch) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (versionSetId == null) { + throw new IllegalArgumentException("Parameter versionSetId is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + if (ifMatch == null) { + throw new IllegalArgumentException("Parameter ifMatch is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(parameters); + return service.update(resourceGroupName, serviceName, versionSetId, this.client.subscriptionId(), parameters, ifMatch, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = updateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse updateDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(204, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Deletes specific Api Version Set. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param versionSetId Api Version Set identifier. Must be unique in the current API Management service instance. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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 serviceName, String versionSetId, String ifMatch) { + deleteWithServiceResponseAsync(resourceGroupName, serviceName, versionSetId, ifMatch).toBlocking().single().body(); + } + + /** + * Deletes specific Api Version Set. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param versionSetId Api Version Set identifier. Must be unique in the current API Management service instance. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @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 serviceName, String versionSetId, String ifMatch, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, serviceName, versionSetId, ifMatch), serviceCallback); + } + + /** + * Deletes specific Api Version Set. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param versionSetId Api Version Set identifier. Must be unique in the current API Management service instance. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable deleteAsync(String resourceGroupName, String serviceName, String versionSetId, String ifMatch) { + return deleteWithServiceResponseAsync(resourceGroupName, serviceName, versionSetId, ifMatch).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes specific Api Version Set. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param versionSetId Api Version Set identifier. Must be unique in the current API Management service instance. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> deleteWithServiceResponseAsync(String resourceGroupName, String serviceName, String versionSetId, String ifMatch) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (versionSetId == null) { + throw new IllegalArgumentException("Parameter versionSetId is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (ifMatch == null) { + throw new IllegalArgumentException("Parameter ifMatch 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.delete(resourceGroupName, serviceName, versionSetId, this.client.subscriptionId(), ifMatch, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = deleteDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse deleteDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(204, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists a collection of API Version Sets in the specified service instance. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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<ApiVersionSetContractInner> object if successful. + */ + public PagedList listByServiceNext(final String nextPageLink) { + ServiceResponse> response = listByServiceNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByServiceNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists a collection of API Version Sets in the specified service instance. + * + * @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> listByServiceNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByServiceNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByServiceNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists a collection of API Version Sets in the specified service instance. + * + * @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<ApiVersionSetContractInner> object + */ + public Observable> listByServiceNextAsync(final String nextPageLink) { + return listByServiceNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists a collection of API Version Sets in the specified service instance. + * + * @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<ApiVersionSetContractInner> object + */ + public Observable>> listByServiceNextWithServiceResponseAsync(final String nextPageLink) { + return listByServiceNextSinglePageAsync(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(listByServiceNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists a collection of API Version Sets in the specified service instance. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ApiVersionSetContractInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByServiceNextSinglePageAsync(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.listByServiceNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByServiceNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByServiceNextDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ApisImpl.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ApisImpl.java new file mode 100644 index 0000000000000..a3873d561604f --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ApisImpl.java @@ -0,0 +1,106 @@ +/** + * 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. + * jkl + */ + +package com.microsoft.azure.management.apimanagement.v2019_01_01.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.apimanagement.v2019_01_01.Apis; +import rx.Completable; +import rx.functions.Func1; +import rx.Observable; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.apimanagement.v2019_01_01.ApiContract; +import com.microsoft.azure.management.apimanagement.v2019_01_01.TagResourceContract; + +class ApisImpl extends WrapperImpl implements Apis { + private final ApiManagementManager manager; + + ApisImpl(ApiManagementManager manager) { + super(manager.inner().apis()); + this.manager = manager; + } + + public ApiManagementManager manager() { + return this.manager; + } + + @Override + public ApiContractImpl define(String name) { + return wrapModel(name); + } + + private ApiContractImpl wrapModel(ApiContractInner inner) { + return new ApiContractImpl(inner, manager()); + } + + private ApiContractImpl wrapModel(String name) { + return new ApiContractImpl(name, this.manager()); + } + + @Override + public Observable listByServiceAsync(final String resourceGroupName, final String serviceName) { + ApisInner client = this.inner(); + return client.listByServiceAsync(resourceGroupName, serviceName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public ApiContract call(ApiContractInner inner) { + return new ApiContractImpl(inner, manager()); + } + }); + } + + @Override + public Completable getEntityTagAsync(String resourceGroupName, String serviceName, String apiId) { + ApisInner client = this.inner(); + return client.getEntityTagAsync(resourceGroupName, serviceName, apiId).toCompletable(); + } + + @Override + public Observable getAsync(String resourceGroupName, String serviceName, String apiId) { + ApisInner client = this.inner(); + return client.getAsync(resourceGroupName, serviceName, apiId) + .map(new Func1() { + @Override + public ApiContract call(ApiContractInner inner) { + return new ApiContractImpl(inner, manager()); + } + }); + } + + @Override + public Completable deleteAsync(String resourceGroupName, String serviceName, String apiId, String ifMatch) { + ApisInner client = this.inner(); + return client.deleteAsync(resourceGroupName, serviceName, apiId, ifMatch).toCompletable(); + } + + @Override + public Observable listByTagsAsync(final String resourceGroupName, final String serviceName) { + ApisInner client = this.inner(); + return client.listByTagsAsync(resourceGroupName, serviceName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public TagResourceContract call(TagResourceContractInner inner) { + return new TagResourceContractImpl(inner, manager()); + } + }); + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ApisInner.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ApisInner.java new file mode 100644 index 0000000000000..856c6353f5246 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ApisInner.java @@ -0,0 +1,1771 @@ +/** + * 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.apimanagement.v2019_01_01.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.apimanagement.v2019_01_01.ApiCreateOrUpdateHeaders; +import com.microsoft.azure.management.apimanagement.v2019_01_01.ApiCreateOrUpdateParameter; +import com.microsoft.azure.management.apimanagement.v2019_01_01.ApiGetEntityTagHeaders; +import com.microsoft.azure.management.apimanagement.v2019_01_01.ApiGetHeaders; +import com.microsoft.azure.management.apimanagement.v2019_01_01.ApiUpdateContract; +import com.microsoft.azure.management.apimanagement.v2019_01_01.ErrorResponseException; +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.ServiceResponseWithHeaders; +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.HEAD; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.HTTP; +import retrofit2.http.PATCH; +import retrofit2.http.Path; +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 Apis. + */ +public class ApisInner { + /** The Retrofit service to perform REST calls. */ + private ApisService service; + /** The service client containing this operation class. */ + private ApiManagementClientImpl client; + + /** + * Initializes an instance of ApisInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public ApisInner(Retrofit retrofit, ApiManagementClientImpl client) { + this.service = retrofit.create(ApisService.class); + this.client = client; + } + + /** + * The interface defining all the services for Apis to be + * used by Retrofit to perform actually REST calls. + */ + interface ApisService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.apimanagement.v2019_01_01.Apis listByService" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis") + Observable> listByService(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("subscriptionId") String subscriptionId, @Query("$filter") String filter, @Query("$top") Integer top, @Query("$skip") Integer skip, @Query("tags") String tags, @Query("expandApiVersionSet") Boolean expandApiVersionSet, @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.apimanagement.v2019_01_01.Apis getEntityTag" }) + @HEAD("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}") + Observable> getEntityTag(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("apiId") String apiId, @Path("subscriptionId") String subscriptionId, @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.apimanagement.v2019_01_01.Apis get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}") + Observable> get(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("apiId") String apiId, @Path("subscriptionId") String subscriptionId, @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.apimanagement.v2019_01_01.Apis createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}") + Observable> createOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("apiId") String apiId, @Path("subscriptionId") String subscriptionId, @Body ApiCreateOrUpdateParameter parameters, @Header("If-Match") String ifMatch, @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.apimanagement.v2019_01_01.Apis beginCreateOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}") + Observable> beginCreateOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("apiId") String apiId, @Path("subscriptionId") String subscriptionId, @Body ApiCreateOrUpdateParameter parameters, @Header("If-Match") String ifMatch, @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.apimanagement.v2019_01_01.Apis update" }) + @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}") + Observable> update(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("apiId") String apiId, @Path("subscriptionId") String subscriptionId, @Body ApiUpdateContract parameters, @Header("If-Match") String ifMatch, @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.apimanagement.v2019_01_01.Apis delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}", method = "DELETE", hasBody = true) + Observable> delete(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("apiId") String apiId, @Path("subscriptionId") String subscriptionId, @Query("deleteRevisions") Boolean deleteRevisions, @Header("If-Match") String ifMatch, @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.apimanagement.v2019_01_01.Apis listByTags" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apisByTags") + Observable> listByTags(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("subscriptionId") String subscriptionId, @Query("$filter") String filter, @Query("$top") Integer top, @Query("$skip") Integer skip, @Query("includeNotTaggedApis") Boolean includeNotTaggedApis, @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.apimanagement.v2019_01_01.Apis listByServiceNext" }) + @GET + Observable> listByServiceNext(@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.apimanagement.v2019_01_01.Apis listByTagsNext" }) + @GET + Observable> listByTagsNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Lists all APIs of the API Management service instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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<ApiContractInner> object if successful. + */ + public PagedList listByService(final String resourceGroupName, final String serviceName) { + ServiceResponse> response = listByServiceSinglePageAsync(resourceGroupName, serviceName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByServiceNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists all APIs of the API Management service instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @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> listByServiceAsync(final String resourceGroupName, final String serviceName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByServiceSinglePageAsync(resourceGroupName, serviceName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByServiceNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists all APIs of the API Management service instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ApiContractInner> object + */ + public Observable> listByServiceAsync(final String resourceGroupName, final String serviceName) { + return listByServiceWithServiceResponseAsync(resourceGroupName, serviceName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all APIs of the API Management service instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ApiContractInner> object + */ + public Observable>> listByServiceWithServiceResponseAsync(final String resourceGroupName, final String serviceName) { + return listByServiceSinglePageAsync(resourceGroupName, serviceName) + .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(listByServiceNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists all APIs of the API Management service instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ApiContractInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByServiceSinglePageAsync(final String resourceGroupName, final String serviceName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + 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 filter = null; + final Integer top = null; + final Integer skip = null; + final String tags = null; + final Boolean expandApiVersionSet = null; + return service.listByService(resourceGroupName, serviceName, this.client.subscriptionId(), filter, top, skip, tags, expandApiVersionSet, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByServiceDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Lists all APIs of the API Management service instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| serviceUrl | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| path | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br> + * @param top Number of records to return. + * @param skip Number of records to skip. + * @param tags Include tags in the response. + * @param expandApiVersionSet Include full ApiVersionSet resource in response + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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<ApiContractInner> object if successful. + */ + public PagedList listByService(final String resourceGroupName, final String serviceName, final String filter, final Integer top, final Integer skip, final String tags, final Boolean expandApiVersionSet) { + ServiceResponse> response = listByServiceSinglePageAsync(resourceGroupName, serviceName, filter, top, skip, tags, expandApiVersionSet).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByServiceNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists all APIs of the API Management service instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| serviceUrl | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| path | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br> + * @param top Number of records to return. + * @param skip Number of records to skip. + * @param tags Include tags in the response. + * @param expandApiVersionSet Include full ApiVersionSet resource in response + * @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> listByServiceAsync(final String resourceGroupName, final String serviceName, final String filter, final Integer top, final Integer skip, final String tags, final Boolean expandApiVersionSet, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByServiceSinglePageAsync(resourceGroupName, serviceName, filter, top, skip, tags, expandApiVersionSet), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByServiceNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists all APIs of the API Management service instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| serviceUrl | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| path | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br> + * @param top Number of records to return. + * @param skip Number of records to skip. + * @param tags Include tags in the response. + * @param expandApiVersionSet Include full ApiVersionSet resource in response + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ApiContractInner> object + */ + public Observable> listByServiceAsync(final String resourceGroupName, final String serviceName, final String filter, final Integer top, final Integer skip, final String tags, final Boolean expandApiVersionSet) { + return listByServiceWithServiceResponseAsync(resourceGroupName, serviceName, filter, top, skip, tags, expandApiVersionSet) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all APIs of the API Management service instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| serviceUrl | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| path | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br> + * @param top Number of records to return. + * @param skip Number of records to skip. + * @param tags Include tags in the response. + * @param expandApiVersionSet Include full ApiVersionSet resource in response + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ApiContractInner> object + */ + public Observable>> listByServiceWithServiceResponseAsync(final String resourceGroupName, final String serviceName, final String filter, final Integer top, final Integer skip, final String tags, final Boolean expandApiVersionSet) { + return listByServiceSinglePageAsync(resourceGroupName, serviceName, filter, top, skip, tags, expandApiVersionSet) + .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(listByServiceNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists all APIs of the API Management service instance. + * + ServiceResponse> * @param resourceGroupName The name of the resource group. + ServiceResponse> * @param serviceName The name of the API Management service. + ServiceResponse> * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| serviceUrl | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| path | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br> + ServiceResponse> * @param top Number of records to return. + ServiceResponse> * @param skip Number of records to skip. + ServiceResponse> * @param tags Include tags in the response. + ServiceResponse> * @param expandApiVersionSet Include full ApiVersionSet resource in response + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ApiContractInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByServiceSinglePageAsync(final String resourceGroupName, final String serviceName, final String filter, final Integer top, final Integer skip, final String tags, final Boolean expandApiVersionSet) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + 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.listByService(resourceGroupName, serviceName, this.client.subscriptionId(), filter, top, skip, tags, expandApiVersionSet, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByServiceDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByServiceDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Gets the entity state (Etag) version of the API specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void getEntityTag(String resourceGroupName, String serviceName, String apiId) { + getEntityTagWithServiceResponseAsync(resourceGroupName, serviceName, apiId).toBlocking().single().body(); + } + + /** + * Gets the entity state (Etag) version of the API specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @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 getEntityTagAsync(String resourceGroupName, String serviceName, String apiId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(getEntityTagWithServiceResponseAsync(resourceGroupName, serviceName, apiId), serviceCallback); + } + + /** + * Gets the entity state (Etag) version of the API specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public Observable getEntityTagAsync(String resourceGroupName, String serviceName, String apiId) { + return getEntityTagWithServiceResponseAsync(resourceGroupName, serviceName, apiId).map(new Func1, Void>() { + @Override + public Void call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Gets the entity state (Etag) version of the API specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public Observable> getEntityTagWithServiceResponseAsync(String resourceGroupName, String serviceName, String apiId) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (apiId == null) { + throw new IllegalArgumentException("Parameter apiId is required and cannot be null."); + } + 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.getEntityTag(resourceGroupName, serviceName, apiId, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = getEntityTagDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponseWithHeaders getEntityTagDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .buildEmptyWithHeaders(response, ApiGetEntityTagHeaders.class); + } + + /** + * Gets the details of the API specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ApiContractInner object if successful. + */ + public ApiContractInner get(String resourceGroupName, String serviceName, String apiId) { + return getWithServiceResponseAsync(resourceGroupName, serviceName, apiId).toBlocking().single().body(); + } + + /** + * Gets the details of the API specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @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 getAsync(String resourceGroupName, String serviceName, String apiId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(getWithServiceResponseAsync(resourceGroupName, serviceName, apiId), serviceCallback); + } + + /** + * Gets the details of the API specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ApiContractInner object + */ + public Observable getAsync(String resourceGroupName, String serviceName, String apiId) { + return getWithServiceResponseAsync(resourceGroupName, serviceName, apiId).map(new Func1, ApiContractInner>() { + @Override + public ApiContractInner call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Gets the details of the API specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ApiContractInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String serviceName, String apiId) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (apiId == null) { + throw new IllegalArgumentException("Parameter apiId is required and cannot be null."); + } + 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.get(resourceGroupName, serviceName, apiId, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = getDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponseWithHeaders getDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .buildWithHeaders(response, ApiGetHeaders.class); + } + + /** + * Creates new or updates existing specified API of the API Management service instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @param parameters Create or update parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ApiContractInner object if successful. + */ + public ApiContractInner createOrUpdate(String resourceGroupName, String serviceName, String apiId, ApiCreateOrUpdateParameter parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serviceName, apiId, parameters).toBlocking().last().body(); + } + + /** + * Creates new or updates existing specified API of the API Management service instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @param parameters Create or update parameters. + * @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 createOrUpdateAsync(String resourceGroupName, String serviceName, String apiId, ApiCreateOrUpdateParameter parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, serviceName, apiId, parameters), serviceCallback); + } + + /** + * Creates new or updates existing specified API of the API Management service instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @param parameters Create or update parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable createOrUpdateAsync(String resourceGroupName, String serviceName, String apiId, ApiCreateOrUpdateParameter parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serviceName, apiId, parameters).map(new Func1, ApiContractInner>() { + @Override + public ApiContractInner call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Creates new or updates existing specified API of the API Management service instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @param parameters Create or update parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String serviceName, String apiId, ApiCreateOrUpdateParameter parameters) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (apiId == null) { + throw new IllegalArgumentException("Parameter apiId is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(parameters); + final String ifMatch = null; + Observable> observable = service.createOrUpdate(resourceGroupName, serviceName, apiId, this.client.subscriptionId(), parameters, ifMatch, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultWithHeadersAsync(observable, new TypeToken() { }.getType(), ApiCreateOrUpdateHeaders.class); + } + /** + * Creates new or updates existing specified API of the API Management service instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @param parameters Create or update parameters. + * @param ifMatch ETag of the Entity. Not required when creating an entity, but required when updating an entity. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ApiContractInner object if successful. + */ + public ApiContractInner createOrUpdate(String resourceGroupName, String serviceName, String apiId, ApiCreateOrUpdateParameter parameters, String ifMatch) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serviceName, apiId, parameters, ifMatch).toBlocking().last().body(); + } + + /** + * Creates new or updates existing specified API of the API Management service instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @param parameters Create or update parameters. + * @param ifMatch ETag of the Entity. Not required when creating an entity, but required when updating an entity. + * @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 createOrUpdateAsync(String resourceGroupName, String serviceName, String apiId, ApiCreateOrUpdateParameter parameters, String ifMatch, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, serviceName, apiId, parameters, ifMatch), serviceCallback); + } + + /** + * Creates new or updates existing specified API of the API Management service instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @param parameters Create or update parameters. + * @param ifMatch ETag of the Entity. Not required when creating an entity, but required when updating an entity. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable createOrUpdateAsync(String resourceGroupName, String serviceName, String apiId, ApiCreateOrUpdateParameter parameters, String ifMatch) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serviceName, apiId, parameters, ifMatch).map(new Func1, ApiContractInner>() { + @Override + public ApiContractInner call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Creates new or updates existing specified API of the API Management service instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @param parameters Create or update parameters. + * @param ifMatch ETag of the Entity. Not required when creating an entity, but required when updating an entity. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String serviceName, String apiId, ApiCreateOrUpdateParameter parameters, String ifMatch) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (apiId == null) { + throw new IllegalArgumentException("Parameter apiId is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(parameters); + Observable> observable = service.createOrUpdate(resourceGroupName, serviceName, apiId, this.client.subscriptionId(), parameters, ifMatch, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultWithHeadersAsync(observable, new TypeToken() { }.getType(), ApiCreateOrUpdateHeaders.class); + } + + /** + * Creates new or updates existing specified API of the API Management service instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @param parameters Create or update parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ApiContractInner object if successful. + */ + public ApiContractInner beginCreateOrUpdate(String resourceGroupName, String serviceName, String apiId, ApiCreateOrUpdateParameter parameters) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serviceName, apiId, parameters).toBlocking().single().body(); + } + + /** + * Creates new or updates existing specified API of the API Management service instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @param parameters Create or update parameters. + * @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 beginCreateOrUpdateAsync(String resourceGroupName, String serviceName, String apiId, ApiCreateOrUpdateParameter parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serviceName, apiId, parameters), serviceCallback); + } + + /** + * Creates new or updates existing specified API of the API Management service instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @param parameters Create or update parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ApiContractInner object + */ + public Observable beginCreateOrUpdateAsync(String resourceGroupName, String serviceName, String apiId, ApiCreateOrUpdateParameter parameters) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serviceName, apiId, parameters).map(new Func1, ApiContractInner>() { + @Override + public ApiContractInner call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Creates new or updates existing specified API of the API Management service instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @param parameters Create or update parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ApiContractInner object + */ + public Observable> beginCreateOrUpdateWithServiceResponseAsync(String resourceGroupName, String serviceName, String apiId, ApiCreateOrUpdateParameter parameters) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (apiId == null) { + throw new IllegalArgumentException("Parameter apiId is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(parameters); + final String ifMatch = null; + return service.beginCreateOrUpdate(resourceGroupName, serviceName, apiId, this.client.subscriptionId(), parameters, ifMatch, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = beginCreateOrUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Creates new or updates existing specified API of the API Management service instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @param parameters Create or update parameters. + * @param ifMatch ETag of the Entity. Not required when creating an entity, but required when updating an entity. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ApiContractInner object if successful. + */ + public ApiContractInner beginCreateOrUpdate(String resourceGroupName, String serviceName, String apiId, ApiCreateOrUpdateParameter parameters, String ifMatch) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serviceName, apiId, parameters, ifMatch).toBlocking().single().body(); + } + + /** + * Creates new or updates existing specified API of the API Management service instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @param parameters Create or update parameters. + * @param ifMatch ETag of the Entity. Not required when creating an entity, but required when updating an entity. + * @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 beginCreateOrUpdateAsync(String resourceGroupName, String serviceName, String apiId, ApiCreateOrUpdateParameter parameters, String ifMatch, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serviceName, apiId, parameters, ifMatch), serviceCallback); + } + + /** + * Creates new or updates existing specified API of the API Management service instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @param parameters Create or update parameters. + * @param ifMatch ETag of the Entity. Not required when creating an entity, but required when updating an entity. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ApiContractInner object + */ + public Observable beginCreateOrUpdateAsync(String resourceGroupName, String serviceName, String apiId, ApiCreateOrUpdateParameter parameters, String ifMatch) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serviceName, apiId, parameters, ifMatch).map(new Func1, ApiContractInner>() { + @Override + public ApiContractInner call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Creates new or updates existing specified API of the API Management service instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @param parameters Create or update parameters. + * @param ifMatch ETag of the Entity. Not required when creating an entity, but required when updating an entity. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ApiContractInner object + */ + public Observable> beginCreateOrUpdateWithServiceResponseAsync(String resourceGroupName, String serviceName, String apiId, ApiCreateOrUpdateParameter parameters, String ifMatch) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (apiId == null) { + throw new IllegalArgumentException("Parameter apiId is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(parameters); + return service.beginCreateOrUpdate(resourceGroupName, serviceName, apiId, this.client.subscriptionId(), parameters, ifMatch, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = beginCreateOrUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponseWithHeaders beginCreateOrUpdateDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(201, new TypeToken() { }.getType()) + .register(202, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .buildWithHeaders(response, ApiCreateOrUpdateHeaders.class); + } + + /** + * Updates the specified API of the API Management service instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @param parameters API Update Contract parameters. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void update(String resourceGroupName, String serviceName, String apiId, ApiUpdateContract parameters, String ifMatch) { + updateWithServiceResponseAsync(resourceGroupName, serviceName, apiId, parameters, ifMatch).toBlocking().single().body(); + } + + /** + * Updates the specified API of the API Management service instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @param parameters API Update Contract parameters. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @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 serviceName, String apiId, ApiUpdateContract parameters, String ifMatch, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateWithServiceResponseAsync(resourceGroupName, serviceName, apiId, parameters, ifMatch), serviceCallback); + } + + /** + * Updates the specified API of the API Management service instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @param parameters API Update Contract parameters. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable updateAsync(String resourceGroupName, String serviceName, String apiId, ApiUpdateContract parameters, String ifMatch) { + return updateWithServiceResponseAsync(resourceGroupName, serviceName, apiId, parameters, ifMatch).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates the specified API of the API Management service instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @param parameters API Update Contract parameters. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> updateWithServiceResponseAsync(String resourceGroupName, String serviceName, String apiId, ApiUpdateContract parameters, String ifMatch) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (apiId == null) { + throw new IllegalArgumentException("Parameter apiId is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + if (ifMatch == null) { + throw new IllegalArgumentException("Parameter ifMatch is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(parameters); + return service.update(resourceGroupName, serviceName, apiId, this.client.subscriptionId(), parameters, ifMatch, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = updateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse updateDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(204, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Deletes the specified API of the API Management service instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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 serviceName, String apiId, String ifMatch) { + deleteWithServiceResponseAsync(resourceGroupName, serviceName, apiId, ifMatch).toBlocking().single().body(); + } + + /** + * Deletes the specified API of the API Management service instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @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 serviceName, String apiId, String ifMatch, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, serviceName, apiId, ifMatch), serviceCallback); + } + + /** + * Deletes the specified API of the API Management service instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable deleteAsync(String resourceGroupName, String serviceName, String apiId, String ifMatch) { + return deleteWithServiceResponseAsync(resourceGroupName, serviceName, apiId, ifMatch).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes the specified API of the API Management service instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> deleteWithServiceResponseAsync(String resourceGroupName, String serviceName, String apiId, String ifMatch) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (apiId == null) { + throw new IllegalArgumentException("Parameter apiId is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (ifMatch == null) { + throw new IllegalArgumentException("Parameter ifMatch 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 Boolean deleteRevisions = null; + return service.delete(resourceGroupName, serviceName, apiId, this.client.subscriptionId(), deleteRevisions, ifMatch, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = deleteDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Deletes the specified API of the API Management service instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @param deleteRevisions Delete all revisions of the Api. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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 serviceName, String apiId, String ifMatch, Boolean deleteRevisions) { + deleteWithServiceResponseAsync(resourceGroupName, serviceName, apiId, ifMatch, deleteRevisions).toBlocking().single().body(); + } + + /** + * Deletes the specified API of the API Management service instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @param deleteRevisions Delete all revisions of the Api. + * @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 serviceName, String apiId, String ifMatch, Boolean deleteRevisions, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, serviceName, apiId, ifMatch, deleteRevisions), serviceCallback); + } + + /** + * Deletes the specified API of the API Management service instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @param deleteRevisions Delete all revisions of the Api. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable deleteAsync(String resourceGroupName, String serviceName, String apiId, String ifMatch, Boolean deleteRevisions) { + return deleteWithServiceResponseAsync(resourceGroupName, serviceName, apiId, ifMatch, deleteRevisions).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes the specified API of the API Management service instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @param deleteRevisions Delete all revisions of the Api. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> deleteWithServiceResponseAsync(String resourceGroupName, String serviceName, String apiId, String ifMatch, Boolean deleteRevisions) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (apiId == null) { + throw new IllegalArgumentException("Parameter apiId is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (ifMatch == null) { + throw new IllegalArgumentException("Parameter ifMatch 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.delete(resourceGroupName, serviceName, apiId, this.client.subscriptionId(), deleteRevisions, ifMatch, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = deleteDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse deleteDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(204, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists a collection of apis associated with tags. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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<TagResourceContractInner> object if successful. + */ + public PagedList listByTags(final String resourceGroupName, final String serviceName) { + ServiceResponse> response = listByTagsSinglePageAsync(resourceGroupName, serviceName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByTagsNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists a collection of apis associated with tags. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @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> listByTagsAsync(final String resourceGroupName, final String serviceName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByTagsSinglePageAsync(resourceGroupName, serviceName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByTagsNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists a collection of apis associated with tags. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<TagResourceContractInner> object + */ + public Observable> listByTagsAsync(final String resourceGroupName, final String serviceName) { + return listByTagsWithServiceResponseAsync(resourceGroupName, serviceName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists a collection of apis associated with tags. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<TagResourceContractInner> object + */ + public Observable>> listByTagsWithServiceResponseAsync(final String resourceGroupName, final String serviceName) { + return listByTagsSinglePageAsync(resourceGroupName, serviceName) + .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(listByTagsNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists a collection of apis associated with tags. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<TagResourceContractInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByTagsSinglePageAsync(final String resourceGroupName, final String serviceName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + 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 filter = null; + final Integer top = null; + final Integer skip = null; + final Boolean includeNotTaggedApis = null; + return service.listByTags(resourceGroupName, serviceName, this.client.subscriptionId(), filter, top, skip, includeNotTaggedApis, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByTagsDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Lists a collection of apis associated with tags. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param filter | Field | Supported operators | Supported functions | + |-------------|------------------------|-----------------------------------| + |name | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith| + |displayName | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith| + |apiRevision | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith| + |path | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith| + |description | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith| + |serviceUrl | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith| + |isCurrent | eq | | + * @param top Number of records to return. + * @param skip Number of records to skip. + * @param includeNotTaggedApis Include not tagged APIs. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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<TagResourceContractInner> object if successful. + */ + public PagedList listByTags(final String resourceGroupName, final String serviceName, final String filter, final Integer top, final Integer skip, final Boolean includeNotTaggedApis) { + ServiceResponse> response = listByTagsSinglePageAsync(resourceGroupName, serviceName, filter, top, skip, includeNotTaggedApis).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByTagsNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists a collection of apis associated with tags. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param filter | Field | Supported operators | Supported functions | + |-------------|------------------------|-----------------------------------| + |name | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith| + |displayName | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith| + |apiRevision | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith| + |path | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith| + |description | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith| + |serviceUrl | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith| + |isCurrent | eq | | + * @param top Number of records to return. + * @param skip Number of records to skip. + * @param includeNotTaggedApis Include not tagged APIs. + * @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> listByTagsAsync(final String resourceGroupName, final String serviceName, final String filter, final Integer top, final Integer skip, final Boolean includeNotTaggedApis, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByTagsSinglePageAsync(resourceGroupName, serviceName, filter, top, skip, includeNotTaggedApis), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByTagsNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists a collection of apis associated with tags. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param filter | Field | Supported operators | Supported functions | + |-------------|------------------------|-----------------------------------| + |name | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith| + |displayName | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith| + |apiRevision | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith| + |path | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith| + |description | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith| + |serviceUrl | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith| + |isCurrent | eq | | + * @param top Number of records to return. + * @param skip Number of records to skip. + * @param includeNotTaggedApis Include not tagged APIs. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<TagResourceContractInner> object + */ + public Observable> listByTagsAsync(final String resourceGroupName, final String serviceName, final String filter, final Integer top, final Integer skip, final Boolean includeNotTaggedApis) { + return listByTagsWithServiceResponseAsync(resourceGroupName, serviceName, filter, top, skip, includeNotTaggedApis) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists a collection of apis associated with tags. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param filter | Field | Supported operators | Supported functions | + |-------------|------------------------|-----------------------------------| + |name | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith| + |displayName | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith| + |apiRevision | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith| + |path | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith| + |description | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith| + |serviceUrl | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith| + |isCurrent | eq | | + * @param top Number of records to return. + * @param skip Number of records to skip. + * @param includeNotTaggedApis Include not tagged APIs. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<TagResourceContractInner> object + */ + public Observable>> listByTagsWithServiceResponseAsync(final String resourceGroupName, final String serviceName, final String filter, final Integer top, final Integer skip, final Boolean includeNotTaggedApis) { + return listByTagsSinglePageAsync(resourceGroupName, serviceName, filter, top, skip, includeNotTaggedApis) + .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(listByTagsNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists a collection of apis associated with tags. + * + ServiceResponse> * @param resourceGroupName The name of the resource group. + ServiceResponse> * @param serviceName The name of the API Management service. + ServiceResponse> * @param filter | Field | Supported operators | Supported functions | + |-------------|------------------------|-----------------------------------| + |name | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith| + |displayName | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith| + |apiRevision | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith| + |path | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith| + |description | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith| + |serviceUrl | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith| + |isCurrent | eq | | + ServiceResponse> * @param top Number of records to return. + ServiceResponse> * @param skip Number of records to skip. + ServiceResponse> * @param includeNotTaggedApis Include not tagged APIs. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<TagResourceContractInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByTagsSinglePageAsync(final String resourceGroupName, final String serviceName, final String filter, final Integer top, final Integer skip, final Boolean includeNotTaggedApis) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + 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.listByTags(resourceGroupName, serviceName, this.client.subscriptionId(), filter, top, skip, includeNotTaggedApis, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByTagsDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByTagsDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists all APIs of the API Management service instance. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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<ApiContractInner> object if successful. + */ + public PagedList listByServiceNext(final String nextPageLink) { + ServiceResponse> response = listByServiceNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByServiceNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists all APIs of the API Management service instance. + * + * @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> listByServiceNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByServiceNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByServiceNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists all APIs of the API Management service instance. + * + * @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<ApiContractInner> object + */ + public Observable> listByServiceNextAsync(final String nextPageLink) { + return listByServiceNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all APIs of the API Management service instance. + * + * @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<ApiContractInner> object + */ + public Observable>> listByServiceNextWithServiceResponseAsync(final String nextPageLink) { + return listByServiceNextSinglePageAsync(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(listByServiceNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists all APIs of the API Management service instance. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ApiContractInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByServiceNextSinglePageAsync(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.listByServiceNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByServiceNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByServiceNextDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists a collection of apis associated with tags. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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<TagResourceContractInner> object if successful. + */ + public PagedList listByTagsNext(final String nextPageLink) { + ServiceResponse> response = listByTagsNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByTagsNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists a collection of apis associated with tags. + * + * @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> listByTagsNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByTagsNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByTagsNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists a collection of apis associated with tags. + * + * @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<TagResourceContractInner> object + */ + public Observable> listByTagsNextAsync(final String nextPageLink) { + return listByTagsNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists a collection of apis associated with tags. + * + * @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<TagResourceContractInner> object + */ + public Observable>> listByTagsNextWithServiceResponseAsync(final String nextPageLink) { + return listByTagsNextSinglePageAsync(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(listByTagsNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists a collection of apis associated with tags. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<TagResourceContractInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByTagsNextSinglePageAsync(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.listByTagsNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByTagsNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByTagsNextDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/AuthorizationServerContractImpl.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/AuthorizationServerContractImpl.java new file mode 100644 index 0000000000000..309d49a72f387 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/AuthorizationServerContractImpl.java @@ -0,0 +1,294 @@ +/** + * 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.apimanagement.v2019_01_01.implementation; + +import com.microsoft.azure.management.apimanagement.v2019_01_01.AuthorizationServerContract; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import java.util.List; +import com.microsoft.azure.management.apimanagement.v2019_01_01.AuthorizationMethod; +import com.microsoft.azure.management.apimanagement.v2019_01_01.ClientAuthenticationMethod; +import com.microsoft.azure.management.apimanagement.v2019_01_01.TokenBodyParameterContract; +import com.microsoft.azure.management.apimanagement.v2019_01_01.BearerTokenSendingMethod; +import com.microsoft.azure.management.apimanagement.v2019_01_01.GrantType; + +class AuthorizationServerContractImpl extends CreatableUpdatableImpl implements AuthorizationServerContract, AuthorizationServerContract.Definition, AuthorizationServerContract.Update { + private String resourceGroupName; + private String serviceName; + private String authsid; + private String cifMatch; + private String uifMatch; + private final ApiManagementManager manager; + + AuthorizationServerContractImpl(String name, ApiManagementManager manager) { + super(name, new AuthorizationServerContractInner()); + this.manager = manager; + // Set resource name + this.authsid = name; + // + } + + AuthorizationServerContractImpl(AuthorizationServerContractInner inner, ApiManagementManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.authsid = inner.name(); + // set resource ancestor and positional variables + this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourceGroups"); + this.serviceName = IdParsingUtils.getValueFromIdByName(inner.id(), "service"); + this.authsid = IdParsingUtils.getValueFromIdByName(inner.id(), "authorizationServers"); + // set other parameters for create and update + } + + @Override + public ApiManagementManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + AuthorizationServersInner client = this.manager().inner().authorizationServers(); + return client.createOrUpdateAsync(this.resourceGroupName, this.serviceName, this.authsid, this.inner(), this.cifMatch) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + AuthorizationServersInner client = this.manager().inner().authorizationServers(); + return client.createOrUpdateAsync(this.resourceGroupName, this.serviceName, this.authsid, this.inner(), this.uifMatch) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + AuthorizationServersInner client = this.manager().inner().authorizationServers(); + return null; // NOP getInnerAsync implementation as get is not supported + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + + @Override + public String authorizationEndpoint() { + return this.inner().authorizationEndpoint(); + } + + @Override + public List authorizationMethods() { + return this.inner().authorizationMethods(); + } + + @Override + public List bearerTokenSendingMethods() { + return this.inner().bearerTokenSendingMethods(); + } + + @Override + public List clientAuthenticationMethod() { + return this.inner().clientAuthenticationMethod(); + } + + @Override + public String clientId() { + return this.inner().clientId(); + } + + @Override + public String clientRegistrationEndpoint() { + return this.inner().clientRegistrationEndpoint(); + } + + @Override + public String clientSecret() { + return this.inner().clientSecret(); + } + + @Override + public String defaultScope() { + return this.inner().defaultScope(); + } + + @Override + public String description() { + return this.inner().description(); + } + + @Override + public String displayName() { + return this.inner().displayName(); + } + + @Override + public List grantTypes() { + return this.inner().grantTypes(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public String resourceOwnerPassword() { + return this.inner().resourceOwnerPassword(); + } + + @Override + public String resourceOwnerUsername() { + return this.inner().resourceOwnerUsername(); + } + + @Override + public Boolean supportState() { + return this.inner().supportState(); + } + + @Override + public List tokenBodyParameters() { + return this.inner().tokenBodyParameters(); + } + + @Override + public String tokenEndpoint() { + return this.inner().tokenEndpoint(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public AuthorizationServerContractImpl withResourceGroupName(String resourceGroupName) { + this.resourceGroupName = resourceGroupName; + return this; + } + + @Override + public AuthorizationServerContractImpl withServiceName(String serviceName) { + this.serviceName = serviceName; + return this; + } + + @Override + public AuthorizationServerContractImpl withAuthorizationEndpoint(String authorizationEndpoint) { + this.inner().withAuthorizationEndpoint(authorizationEndpoint); + return this; + } + + @Override + public AuthorizationServerContractImpl withClientId(String clientId) { + this.inner().withClientId(clientId); + return this; + } + + @Override + public AuthorizationServerContractImpl withClientRegistrationEndpoint(String clientRegistrationEndpoint) { + this.inner().withClientRegistrationEndpoint(clientRegistrationEndpoint); + return this; + } + + @Override + public AuthorizationServerContractImpl withDisplayName(String displayName) { + this.inner().withDisplayName(displayName); + return this; + } + + @Override + public AuthorizationServerContractImpl withGrantTypes(List grantTypes) { + this.inner().withGrantTypes(grantTypes); + return this; + } + + @Override + public AuthorizationServerContractImpl withIfMatch(String ifMatch) { + if (isInCreateMode()) { + this.cifMatch = ifMatch; + } else { + this.uifMatch = ifMatch; + } + return this; + } + + @Override + public AuthorizationServerContractImpl withAuthorizationMethods(List authorizationMethods) { + this.inner().withAuthorizationMethods(authorizationMethods); + return this; + } + + @Override + public AuthorizationServerContractImpl withBearerTokenSendingMethods(List bearerTokenSendingMethods) { + this.inner().withBearerTokenSendingMethods(bearerTokenSendingMethods); + return this; + } + + @Override + public AuthorizationServerContractImpl withClientAuthenticationMethod(List clientAuthenticationMethod) { + this.inner().withClientAuthenticationMethod(clientAuthenticationMethod); + return this; + } + + @Override + public AuthorizationServerContractImpl withClientSecret(String clientSecret) { + this.inner().withClientSecret(clientSecret); + return this; + } + + @Override + public AuthorizationServerContractImpl withDefaultScope(String defaultScope) { + this.inner().withDefaultScope(defaultScope); + return this; + } + + @Override + public AuthorizationServerContractImpl withDescription(String description) { + this.inner().withDescription(description); + return this; + } + + @Override + public AuthorizationServerContractImpl withResourceOwnerPassword(String resourceOwnerPassword) { + this.inner().withResourceOwnerPassword(resourceOwnerPassword); + return this; + } + + @Override + public AuthorizationServerContractImpl withResourceOwnerUsername(String resourceOwnerUsername) { + this.inner().withResourceOwnerUsername(resourceOwnerUsername); + return this; + } + + @Override + public AuthorizationServerContractImpl withSupportState(Boolean supportState) { + this.inner().withSupportState(supportState); + return this; + } + + @Override + public AuthorizationServerContractImpl withTokenBodyParameters(List tokenBodyParameters) { + this.inner().withTokenBodyParameters(tokenBodyParameters); + return this; + } + + @Override + public AuthorizationServerContractImpl withTokenEndpoint(String tokenEndpoint) { + this.inner().withTokenEndpoint(tokenEndpoint); + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/AuthorizationServerContractInner.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/AuthorizationServerContractInner.java new file mode 100644 index 0000000000000..04f0384709027 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/AuthorizationServerContractInner.java @@ -0,0 +1,460 @@ +/** + * 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.apimanagement.v2019_01_01.implementation; + +import java.util.List; +import com.microsoft.azure.management.apimanagement.v2019_01_01.AuthorizationMethod; +import com.microsoft.azure.management.apimanagement.v2019_01_01.ClientAuthenticationMethod; +import com.microsoft.azure.management.apimanagement.v2019_01_01.TokenBodyParameterContract; +import com.microsoft.azure.management.apimanagement.v2019_01_01.BearerTokenSendingMethod; +import com.microsoft.azure.management.apimanagement.v2019_01_01.GrantType; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * External OAuth authorization server settings. + */ +@JsonFlatten +public class AuthorizationServerContractInner extends ProxyResource { + /** + * Description of the authorization server. Can contain HTML formatting + * tags. + */ + @JsonProperty(value = "properties.description") + private String description; + + /** + * HTTP verbs supported by the authorization endpoint. GET must be always + * present. POST is optional. + */ + @JsonProperty(value = "properties.authorizationMethods") + private List authorizationMethods; + + /** + * Method of authentication supported by the token endpoint of this + * authorization server. Possible values are Basic and/or Body. When Body + * is specified, client credentials and other parameters are passed within + * the request body in the application/x-www-form-urlencoded format. + */ + @JsonProperty(value = "properties.clientAuthenticationMethod") + private List clientAuthenticationMethod; + + /** + * Additional parameters required by the token endpoint of this + * authorization server represented as an array of JSON objects with name + * and value string properties, i.e. {"name" : "name value", "value": "a + * value"}. + */ + @JsonProperty(value = "properties.tokenBodyParameters") + private List tokenBodyParameters; + + /** + * OAuth token endpoint. Contains absolute URI to entity being referenced. + */ + @JsonProperty(value = "properties.tokenEndpoint") + private String tokenEndpoint; + + /** + * If true, authorization server will include state parameter from the + * authorization request to its response. Client may use state parameter to + * raise protocol security. + */ + @JsonProperty(value = "properties.supportState") + private Boolean supportState; + + /** + * Access token scope that is going to be requested by default. Can be + * overridden at the API level. Should be provided in the form of a string + * containing space-delimited values. + */ + @JsonProperty(value = "properties.defaultScope") + private String defaultScope; + + /** + * Specifies the mechanism by which access token is passed to the API. + */ + @JsonProperty(value = "properties.bearerTokenSendingMethods") + private List bearerTokenSendingMethods; + + /** + * Client or app secret registered with this authorization server. + */ + @JsonProperty(value = "properties.clientSecret") + private String clientSecret; + + /** + * Can be optionally specified when resource owner password grant type is + * supported by this authorization server. Default resource owner username. + */ + @JsonProperty(value = "properties.resourceOwnerUsername") + private String resourceOwnerUsername; + + /** + * Can be optionally specified when resource owner password grant type is + * supported by this authorization server. Default resource owner password. + */ + @JsonProperty(value = "properties.resourceOwnerPassword") + private String resourceOwnerPassword; + + /** + * User-friendly authorization server name. + */ + @JsonProperty(value = "properties.displayName", required = true) + private String displayName; + + /** + * Optional reference to a page where client or app registration for this + * authorization server is performed. Contains absolute URL to entity being + * referenced. + */ + @JsonProperty(value = "properties.clientRegistrationEndpoint", required = true) + private String clientRegistrationEndpoint; + + /** + * OAuth authorization endpoint. See + * http://tools.ietf.org/html/rfc6749#section-3.2. + */ + @JsonProperty(value = "properties.authorizationEndpoint", required = true) + private String authorizationEndpoint; + + /** + * Form of an authorization grant, which the client uses to request the + * access token. + */ + @JsonProperty(value = "properties.grantTypes", required = true) + private List grantTypes; + + /** + * Client or app id registered with this authorization server. + */ + @JsonProperty(value = "properties.clientId", required = true) + private String clientId; + + /** + * Get description of the authorization server. Can contain HTML formatting tags. + * + * @return the description value + */ + public String description() { + return this.description; + } + + /** + * Set description of the authorization server. Can contain HTML formatting tags. + * + * @param description the description value to set + * @return the AuthorizationServerContractInner object itself. + */ + public AuthorizationServerContractInner withDescription(String description) { + this.description = description; + return this; + } + + /** + * Get hTTP verbs supported by the authorization endpoint. GET must be always present. POST is optional. + * + * @return the authorizationMethods value + */ + public List authorizationMethods() { + return this.authorizationMethods; + } + + /** + * Set hTTP verbs supported by the authorization endpoint. GET must be always present. POST is optional. + * + * @param authorizationMethods the authorizationMethods value to set + * @return the AuthorizationServerContractInner object itself. + */ + public AuthorizationServerContractInner withAuthorizationMethods(List authorizationMethods) { + this.authorizationMethods = authorizationMethods; + return this; + } + + /** + * Get method of authentication supported by the token endpoint of this authorization server. Possible values are Basic and/or Body. When Body is specified, client credentials and other parameters are passed within the request body in the application/x-www-form-urlencoded format. + * + * @return the clientAuthenticationMethod value + */ + public List clientAuthenticationMethod() { + return this.clientAuthenticationMethod; + } + + /** + * Set method of authentication supported by the token endpoint of this authorization server. Possible values are Basic and/or Body. When Body is specified, client credentials and other parameters are passed within the request body in the application/x-www-form-urlencoded format. + * + * @param clientAuthenticationMethod the clientAuthenticationMethod value to set + * @return the AuthorizationServerContractInner object itself. + */ + public AuthorizationServerContractInner withClientAuthenticationMethod(List clientAuthenticationMethod) { + this.clientAuthenticationMethod = clientAuthenticationMethod; + return this; + } + + /** + * Get additional parameters required by the token endpoint of this authorization server represented as an array of JSON objects with name and value string properties, i.e. {"name" : "name value", "value": "a value"}. + * + * @return the tokenBodyParameters value + */ + public List tokenBodyParameters() { + return this.tokenBodyParameters; + } + + /** + * Set additional parameters required by the token endpoint of this authorization server represented as an array of JSON objects with name and value string properties, i.e. {"name" : "name value", "value": "a value"}. + * + * @param tokenBodyParameters the tokenBodyParameters value to set + * @return the AuthorizationServerContractInner object itself. + */ + public AuthorizationServerContractInner withTokenBodyParameters(List tokenBodyParameters) { + this.tokenBodyParameters = tokenBodyParameters; + return this; + } + + /** + * Get oAuth token endpoint. Contains absolute URI to entity being referenced. + * + * @return the tokenEndpoint value + */ + public String tokenEndpoint() { + return this.tokenEndpoint; + } + + /** + * Set oAuth token endpoint. Contains absolute URI to entity being referenced. + * + * @param tokenEndpoint the tokenEndpoint value to set + * @return the AuthorizationServerContractInner object itself. + */ + public AuthorizationServerContractInner withTokenEndpoint(String tokenEndpoint) { + this.tokenEndpoint = tokenEndpoint; + return this; + } + + /** + * Get if true, authorization server will include state parameter from the authorization request to its response. Client may use state parameter to raise protocol security. + * + * @return the supportState value + */ + public Boolean supportState() { + return this.supportState; + } + + /** + * Set if true, authorization server will include state parameter from the authorization request to its response. Client may use state parameter to raise protocol security. + * + * @param supportState the supportState value to set + * @return the AuthorizationServerContractInner object itself. + */ + public AuthorizationServerContractInner withSupportState(Boolean supportState) { + this.supportState = supportState; + return this; + } + + /** + * Get access token scope that is going to be requested by default. Can be overridden at the API level. Should be provided in the form of a string containing space-delimited values. + * + * @return the defaultScope value + */ + public String defaultScope() { + return this.defaultScope; + } + + /** + * Set access token scope that is going to be requested by default. Can be overridden at the API level. Should be provided in the form of a string containing space-delimited values. + * + * @param defaultScope the defaultScope value to set + * @return the AuthorizationServerContractInner object itself. + */ + public AuthorizationServerContractInner withDefaultScope(String defaultScope) { + this.defaultScope = defaultScope; + return this; + } + + /** + * Get specifies the mechanism by which access token is passed to the API. + * + * @return the bearerTokenSendingMethods value + */ + public List bearerTokenSendingMethods() { + return this.bearerTokenSendingMethods; + } + + /** + * Set specifies the mechanism by which access token is passed to the API. + * + * @param bearerTokenSendingMethods the bearerTokenSendingMethods value to set + * @return the AuthorizationServerContractInner object itself. + */ + public AuthorizationServerContractInner withBearerTokenSendingMethods(List bearerTokenSendingMethods) { + this.bearerTokenSendingMethods = bearerTokenSendingMethods; + return this; + } + + /** + * Get client or app secret registered with this authorization server. + * + * @return the clientSecret value + */ + public String clientSecret() { + return this.clientSecret; + } + + /** + * Set client or app secret registered with this authorization server. + * + * @param clientSecret the clientSecret value to set + * @return the AuthorizationServerContractInner object itself. + */ + public AuthorizationServerContractInner withClientSecret(String clientSecret) { + this.clientSecret = clientSecret; + return this; + } + + /** + * Get can be optionally specified when resource owner password grant type is supported by this authorization server. Default resource owner username. + * + * @return the resourceOwnerUsername value + */ + public String resourceOwnerUsername() { + return this.resourceOwnerUsername; + } + + /** + * Set can be optionally specified when resource owner password grant type is supported by this authorization server. Default resource owner username. + * + * @param resourceOwnerUsername the resourceOwnerUsername value to set + * @return the AuthorizationServerContractInner object itself. + */ + public AuthorizationServerContractInner withResourceOwnerUsername(String resourceOwnerUsername) { + this.resourceOwnerUsername = resourceOwnerUsername; + return this; + } + + /** + * Get can be optionally specified when resource owner password grant type is supported by this authorization server. Default resource owner password. + * + * @return the resourceOwnerPassword value + */ + public String resourceOwnerPassword() { + return this.resourceOwnerPassword; + } + + /** + * Set can be optionally specified when resource owner password grant type is supported by this authorization server. Default resource owner password. + * + * @param resourceOwnerPassword the resourceOwnerPassword value to set + * @return the AuthorizationServerContractInner object itself. + */ + public AuthorizationServerContractInner withResourceOwnerPassword(String resourceOwnerPassword) { + this.resourceOwnerPassword = resourceOwnerPassword; + return this; + } + + /** + * Get user-friendly authorization server name. + * + * @return the displayName value + */ + public String displayName() { + return this.displayName; + } + + /** + * Set user-friendly authorization server name. + * + * @param displayName the displayName value to set + * @return the AuthorizationServerContractInner object itself. + */ + public AuthorizationServerContractInner withDisplayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Get optional reference to a page where client or app registration for this authorization server is performed. Contains absolute URL to entity being referenced. + * + * @return the clientRegistrationEndpoint value + */ + public String clientRegistrationEndpoint() { + return this.clientRegistrationEndpoint; + } + + /** + * Set optional reference to a page where client or app registration for this authorization server is performed. Contains absolute URL to entity being referenced. + * + * @param clientRegistrationEndpoint the clientRegistrationEndpoint value to set + * @return the AuthorizationServerContractInner object itself. + */ + public AuthorizationServerContractInner withClientRegistrationEndpoint(String clientRegistrationEndpoint) { + this.clientRegistrationEndpoint = clientRegistrationEndpoint; + return this; + } + + /** + * Get oAuth authorization endpoint. See http://tools.ietf.org/html/rfc6749#section-3.2. + * + * @return the authorizationEndpoint value + */ + public String authorizationEndpoint() { + return this.authorizationEndpoint; + } + + /** + * Set oAuth authorization endpoint. See http://tools.ietf.org/html/rfc6749#section-3.2. + * + * @param authorizationEndpoint the authorizationEndpoint value to set + * @return the AuthorizationServerContractInner object itself. + */ + public AuthorizationServerContractInner withAuthorizationEndpoint(String authorizationEndpoint) { + this.authorizationEndpoint = authorizationEndpoint; + return this; + } + + /** + * Get form of an authorization grant, which the client uses to request the access token. + * + * @return the grantTypes value + */ + public List grantTypes() { + return this.grantTypes; + } + + /** + * Set form of an authorization grant, which the client uses to request the access token. + * + * @param grantTypes the grantTypes value to set + * @return the AuthorizationServerContractInner object itself. + */ + public AuthorizationServerContractInner withGrantTypes(List grantTypes) { + this.grantTypes = grantTypes; + return this; + } + + /** + * Get client or app id registered with this authorization server. + * + * @return the clientId value + */ + public String clientId() { + return this.clientId; + } + + /** + * Set client or app id registered with this authorization server. + * + * @param clientId the clientId value to set + * @return the AuthorizationServerContractInner object itself. + */ + public AuthorizationServerContractInner withClientId(String clientId) { + this.clientId = clientId; + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/AuthorizationServersImpl.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/AuthorizationServersImpl.java new file mode 100644 index 0000000000000..94da2f2c8d01c --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/AuthorizationServersImpl.java @@ -0,0 +1,87 @@ +/** + * 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. + * jkl + */ + +package com.microsoft.azure.management.apimanagement.v2019_01_01.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.apimanagement.v2019_01_01.AuthorizationServers; +import rx.Completable; +import rx.functions.Func1; +import rx.Observable; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.apimanagement.v2019_01_01.AuthorizationServerContract; + +class AuthorizationServersImpl extends WrapperImpl implements AuthorizationServers { + private final ApiManagementManager manager; + + AuthorizationServersImpl(ApiManagementManager manager) { + super(manager.inner().authorizationServers()); + this.manager = manager; + } + + public ApiManagementManager manager() { + return this.manager; + } + + @Override + public AuthorizationServerContractImpl define(String name) { + return wrapModel(name); + } + + private AuthorizationServerContractImpl wrapModel(AuthorizationServerContractInner inner) { + return new AuthorizationServerContractImpl(inner, manager()); + } + + private AuthorizationServerContractImpl wrapModel(String name) { + return new AuthorizationServerContractImpl(name, this.manager()); + } + + @Override + public Observable listByServiceAsync(final String resourceGroupName, final String serviceName) { + AuthorizationServersInner client = this.inner(); + return client.listByServiceAsync(resourceGroupName, serviceName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public AuthorizationServerContract call(AuthorizationServerContractInner inner) { + return new AuthorizationServerContractImpl(inner, manager()); + } + }); + } + + @Override + public Completable getEntityTagAsync(String resourceGroupName, String serviceName, String authsid) { + AuthorizationServersInner client = this.inner(); + return client.getEntityTagAsync(resourceGroupName, serviceName, authsid).toCompletable(); + } + + @Override + public Observable getAsync(String resourceGroupName, String serviceName, String authsid) { + AuthorizationServersInner client = this.inner(); + return client.getAsync(resourceGroupName, serviceName, authsid) + .map(new Func1() { + @Override + public AuthorizationServerContract call(AuthorizationServerContractInner inner) { + return new AuthorizationServerContractImpl(inner, manager()); + } + }); + } + + @Override + public Completable deleteAsync(String resourceGroupName, String serviceName, String authsid, String ifMatch) { + AuthorizationServersInner client = this.inner(); + return client.deleteAsync(resourceGroupName, serviceName, authsid, ifMatch).toCompletable(); + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/AuthorizationServersInner.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/AuthorizationServersInner.java new file mode 100644 index 0000000000000..07003ef5f9668 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/AuthorizationServersInner.java @@ -0,0 +1,1062 @@ +/** + * 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.apimanagement.v2019_01_01.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.apimanagement.v2019_01_01.AuthorizationServerCreateOrUpdateHeaders; +import com.microsoft.azure.management.apimanagement.v2019_01_01.AuthorizationServerGetEntityTagHeaders; +import com.microsoft.azure.management.apimanagement.v2019_01_01.AuthorizationServerGetHeaders; +import com.microsoft.azure.management.apimanagement.v2019_01_01.AuthorizationServerUpdateContract; +import com.microsoft.azure.management.apimanagement.v2019_01_01.ErrorResponseException; +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.ServiceResponseWithHeaders; +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.HEAD; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.HTTP; +import retrofit2.http.PATCH; +import retrofit2.http.Path; +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 AuthorizationServers. + */ +public class AuthorizationServersInner { + /** The Retrofit service to perform REST calls. */ + private AuthorizationServersService service; + /** The service client containing this operation class. */ + private ApiManagementClientImpl client; + + /** + * Initializes an instance of AuthorizationServersInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public AuthorizationServersInner(Retrofit retrofit, ApiManagementClientImpl client) { + this.service = retrofit.create(AuthorizationServersService.class); + this.client = client; + } + + /** + * The interface defining all the services for AuthorizationServers to be + * used by Retrofit to perform actually REST calls. + */ + interface AuthorizationServersService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.apimanagement.v2019_01_01.AuthorizationServers listByService" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationServers") + Observable> listByService(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("subscriptionId") String subscriptionId, @Query("$filter") String filter, @Query("$top") Integer top, @Query("$skip") Integer skip, @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.apimanagement.v2019_01_01.AuthorizationServers getEntityTag" }) + @HEAD("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationServers/{authsid}") + Observable> getEntityTag(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("authsid") String authsid, @Path("subscriptionId") String subscriptionId, @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.apimanagement.v2019_01_01.AuthorizationServers get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationServers/{authsid}") + Observable> get(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("authsid") String authsid, @Path("subscriptionId") String subscriptionId, @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.apimanagement.v2019_01_01.AuthorizationServers createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationServers/{authsid}") + Observable> createOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("authsid") String authsid, @Path("subscriptionId") String subscriptionId, @Body AuthorizationServerContractInner parameters, @Header("If-Match") String ifMatch, @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.apimanagement.v2019_01_01.AuthorizationServers update" }) + @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationServers/{authsid}") + Observable> update(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("authsid") String authsid, @Path("subscriptionId") String subscriptionId, @Body AuthorizationServerUpdateContract parameters, @Header("If-Match") String ifMatch, @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.apimanagement.v2019_01_01.AuthorizationServers delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationServers/{authsid}", method = "DELETE", hasBody = true) + Observable> delete(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("authsid") String authsid, @Path("subscriptionId") String subscriptionId, @Header("If-Match") String ifMatch, @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.apimanagement.v2019_01_01.AuthorizationServers listByServiceNext" }) + @GET + Observable> listByServiceNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Lists a collection of authorization servers defined within a service instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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<AuthorizationServerContractInner> object if successful. + */ + public PagedList listByService(final String resourceGroupName, final String serviceName) { + ServiceResponse> response = listByServiceSinglePageAsync(resourceGroupName, serviceName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByServiceNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists a collection of authorization servers defined within a service instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @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> listByServiceAsync(final String resourceGroupName, final String serviceName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByServiceSinglePageAsync(resourceGroupName, serviceName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByServiceNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists a collection of authorization servers defined within a service instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<AuthorizationServerContractInner> object + */ + public Observable> listByServiceAsync(final String resourceGroupName, final String serviceName) { + return listByServiceWithServiceResponseAsync(resourceGroupName, serviceName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists a collection of authorization servers defined within a service instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<AuthorizationServerContractInner> object + */ + public Observable>> listByServiceWithServiceResponseAsync(final String resourceGroupName, final String serviceName) { + return listByServiceSinglePageAsync(resourceGroupName, serviceName) + .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(listByServiceNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists a collection of authorization servers defined within a service instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<AuthorizationServerContractInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByServiceSinglePageAsync(final String resourceGroupName, final String serviceName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + 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 filter = null; + final Integer top = null; + final Integer skip = null; + return service.listByService(resourceGroupName, serviceName, this.client.subscriptionId(), filter, top, skip, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByServiceDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Lists a collection of authorization servers defined within a service instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br> + * @param top Number of records to return. + * @param skip Number of records to skip. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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<AuthorizationServerContractInner> object if successful. + */ + public PagedList listByService(final String resourceGroupName, final String serviceName, final String filter, final Integer top, final Integer skip) { + ServiceResponse> response = listByServiceSinglePageAsync(resourceGroupName, serviceName, filter, top, skip).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByServiceNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists a collection of authorization servers defined within a service instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br> + * @param top Number of records to return. + * @param skip Number of records to skip. + * @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> listByServiceAsync(final String resourceGroupName, final String serviceName, final String filter, final Integer top, final Integer skip, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByServiceSinglePageAsync(resourceGroupName, serviceName, filter, top, skip), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByServiceNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists a collection of authorization servers defined within a service instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br> + * @param top Number of records to return. + * @param skip Number of records to skip. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<AuthorizationServerContractInner> object + */ + public Observable> listByServiceAsync(final String resourceGroupName, final String serviceName, final String filter, final Integer top, final Integer skip) { + return listByServiceWithServiceResponseAsync(resourceGroupName, serviceName, filter, top, skip) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists a collection of authorization servers defined within a service instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br> + * @param top Number of records to return. + * @param skip Number of records to skip. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<AuthorizationServerContractInner> object + */ + public Observable>> listByServiceWithServiceResponseAsync(final String resourceGroupName, final String serviceName, final String filter, final Integer top, final Integer skip) { + return listByServiceSinglePageAsync(resourceGroupName, serviceName, filter, top, skip) + .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(listByServiceNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists a collection of authorization servers defined within a service instance. + * + ServiceResponse> * @param resourceGroupName The name of the resource group. + ServiceResponse> * @param serviceName The name of the API Management service. + ServiceResponse> * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br> + ServiceResponse> * @param top Number of records to return. + ServiceResponse> * @param skip Number of records to skip. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<AuthorizationServerContractInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByServiceSinglePageAsync(final String resourceGroupName, final String serviceName, final String filter, final Integer top, final Integer skip) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + 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.listByService(resourceGroupName, serviceName, this.client.subscriptionId(), filter, top, skip, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByServiceDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByServiceDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Gets the entity state (Etag) version of the authorizationServer specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param authsid Identifier of the authorization server. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void getEntityTag(String resourceGroupName, String serviceName, String authsid) { + getEntityTagWithServiceResponseAsync(resourceGroupName, serviceName, authsid).toBlocking().single().body(); + } + + /** + * Gets the entity state (Etag) version of the authorizationServer specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param authsid Identifier of the authorization server. + * @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 getEntityTagAsync(String resourceGroupName, String serviceName, String authsid, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(getEntityTagWithServiceResponseAsync(resourceGroupName, serviceName, authsid), serviceCallback); + } + + /** + * Gets the entity state (Etag) version of the authorizationServer specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param authsid Identifier of the authorization server. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public Observable getEntityTagAsync(String resourceGroupName, String serviceName, String authsid) { + return getEntityTagWithServiceResponseAsync(resourceGroupName, serviceName, authsid).map(new Func1, Void>() { + @Override + public Void call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Gets the entity state (Etag) version of the authorizationServer specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param authsid Identifier of the authorization server. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public Observable> getEntityTagWithServiceResponseAsync(String resourceGroupName, String serviceName, String authsid) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (authsid == null) { + throw new IllegalArgumentException("Parameter authsid is required and cannot be null."); + } + 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.getEntityTag(resourceGroupName, serviceName, authsid, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = getEntityTagDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponseWithHeaders getEntityTagDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .buildEmptyWithHeaders(response, AuthorizationServerGetEntityTagHeaders.class); + } + + /** + * Gets the details of the authorization server specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param authsid Identifier of the authorization server. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the AuthorizationServerContractInner object if successful. + */ + public AuthorizationServerContractInner get(String resourceGroupName, String serviceName, String authsid) { + return getWithServiceResponseAsync(resourceGroupName, serviceName, authsid).toBlocking().single().body(); + } + + /** + * Gets the details of the authorization server specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param authsid Identifier of the authorization server. + * @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 getAsync(String resourceGroupName, String serviceName, String authsid, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(getWithServiceResponseAsync(resourceGroupName, serviceName, authsid), serviceCallback); + } + + /** + * Gets the details of the authorization server specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param authsid Identifier of the authorization server. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the AuthorizationServerContractInner object + */ + public Observable getAsync(String resourceGroupName, String serviceName, String authsid) { + return getWithServiceResponseAsync(resourceGroupName, serviceName, authsid).map(new Func1, AuthorizationServerContractInner>() { + @Override + public AuthorizationServerContractInner call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Gets the details of the authorization server specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param authsid Identifier of the authorization server. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the AuthorizationServerContractInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String serviceName, String authsid) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (authsid == null) { + throw new IllegalArgumentException("Parameter authsid is required and cannot be null."); + } + 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.get(resourceGroupName, serviceName, authsid, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = getDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponseWithHeaders getDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .buildWithHeaders(response, AuthorizationServerGetHeaders.class); + } + + /** + * Creates new authorization server or updates an existing authorization server. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param authsid Identifier of the authorization server. + * @param parameters Create or update parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the AuthorizationServerContractInner object if successful. + */ + public AuthorizationServerContractInner createOrUpdate(String resourceGroupName, String serviceName, String authsid, AuthorizationServerContractInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serviceName, authsid, parameters).toBlocking().single().body(); + } + + /** + * Creates new authorization server or updates an existing authorization server. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param authsid Identifier of the authorization server. + * @param parameters Create or update parameters. + * @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 createOrUpdateAsync(String resourceGroupName, String serviceName, String authsid, AuthorizationServerContractInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, serviceName, authsid, parameters), serviceCallback); + } + + /** + * Creates new authorization server or updates an existing authorization server. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param authsid Identifier of the authorization server. + * @param parameters Create or update parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the AuthorizationServerContractInner object + */ + public Observable createOrUpdateAsync(String resourceGroupName, String serviceName, String authsid, AuthorizationServerContractInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serviceName, authsid, parameters).map(new Func1, AuthorizationServerContractInner>() { + @Override + public AuthorizationServerContractInner call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Creates new authorization server or updates an existing authorization server. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param authsid Identifier of the authorization server. + * @param parameters Create or update parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the AuthorizationServerContractInner object + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String serviceName, String authsid, AuthorizationServerContractInner parameters) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (authsid == null) { + throw new IllegalArgumentException("Parameter authsid is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(parameters); + final String ifMatch = null; + return service.createOrUpdate(resourceGroupName, serviceName, authsid, this.client.subscriptionId(), parameters, ifMatch, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = createOrUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Creates new authorization server or updates an existing authorization server. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param authsid Identifier of the authorization server. + * @param parameters Create or update parameters. + * @param ifMatch ETag of the Entity. Not required when creating an entity, but required when updating an entity. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the AuthorizationServerContractInner object if successful. + */ + public AuthorizationServerContractInner createOrUpdate(String resourceGroupName, String serviceName, String authsid, AuthorizationServerContractInner parameters, String ifMatch) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serviceName, authsid, parameters, ifMatch).toBlocking().single().body(); + } + + /** + * Creates new authorization server or updates an existing authorization server. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param authsid Identifier of the authorization server. + * @param parameters Create or update parameters. + * @param ifMatch ETag of the Entity. Not required when creating an entity, but required when updating an entity. + * @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 createOrUpdateAsync(String resourceGroupName, String serviceName, String authsid, AuthorizationServerContractInner parameters, String ifMatch, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, serviceName, authsid, parameters, ifMatch), serviceCallback); + } + + /** + * Creates new authorization server or updates an existing authorization server. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param authsid Identifier of the authorization server. + * @param parameters Create or update parameters. + * @param ifMatch ETag of the Entity. Not required when creating an entity, but required when updating an entity. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the AuthorizationServerContractInner object + */ + public Observable createOrUpdateAsync(String resourceGroupName, String serviceName, String authsid, AuthorizationServerContractInner parameters, String ifMatch) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serviceName, authsid, parameters, ifMatch).map(new Func1, AuthorizationServerContractInner>() { + @Override + public AuthorizationServerContractInner call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Creates new authorization server or updates an existing authorization server. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param authsid Identifier of the authorization server. + * @param parameters Create or update parameters. + * @param ifMatch ETag of the Entity. Not required when creating an entity, but required when updating an entity. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the AuthorizationServerContractInner object + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String serviceName, String authsid, AuthorizationServerContractInner parameters, String ifMatch) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (authsid == null) { + throw new IllegalArgumentException("Parameter authsid is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(parameters); + return service.createOrUpdate(resourceGroupName, serviceName, authsid, this.client.subscriptionId(), parameters, ifMatch, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = createOrUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponseWithHeaders createOrUpdateDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(201, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .buildWithHeaders(response, AuthorizationServerCreateOrUpdateHeaders.class); + } + + /** + * Updates the details of the authorization server specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param authsid Identifier of the authorization server. + * @param parameters OAuth2 Server settings Update parameters. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void update(String resourceGroupName, String serviceName, String authsid, AuthorizationServerUpdateContract parameters, String ifMatch) { + updateWithServiceResponseAsync(resourceGroupName, serviceName, authsid, parameters, ifMatch).toBlocking().single().body(); + } + + /** + * Updates the details of the authorization server specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param authsid Identifier of the authorization server. + * @param parameters OAuth2 Server settings Update parameters. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @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 serviceName, String authsid, AuthorizationServerUpdateContract parameters, String ifMatch, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateWithServiceResponseAsync(resourceGroupName, serviceName, authsid, parameters, ifMatch), serviceCallback); + } + + /** + * Updates the details of the authorization server specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param authsid Identifier of the authorization server. + * @param parameters OAuth2 Server settings Update parameters. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable updateAsync(String resourceGroupName, String serviceName, String authsid, AuthorizationServerUpdateContract parameters, String ifMatch) { + return updateWithServiceResponseAsync(resourceGroupName, serviceName, authsid, parameters, ifMatch).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates the details of the authorization server specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param authsid Identifier of the authorization server. + * @param parameters OAuth2 Server settings Update parameters. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> updateWithServiceResponseAsync(String resourceGroupName, String serviceName, String authsid, AuthorizationServerUpdateContract parameters, String ifMatch) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (authsid == null) { + throw new IllegalArgumentException("Parameter authsid is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + if (ifMatch == null) { + throw new IllegalArgumentException("Parameter ifMatch is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(parameters); + return service.update(resourceGroupName, serviceName, authsid, this.client.subscriptionId(), parameters, ifMatch, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = updateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse updateDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(204, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Deletes specific authorization server instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param authsid Identifier of the authorization server. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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 serviceName, String authsid, String ifMatch) { + deleteWithServiceResponseAsync(resourceGroupName, serviceName, authsid, ifMatch).toBlocking().single().body(); + } + + /** + * Deletes specific authorization server instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param authsid Identifier of the authorization server. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @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 serviceName, String authsid, String ifMatch, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, serviceName, authsid, ifMatch), serviceCallback); + } + + /** + * Deletes specific authorization server instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param authsid Identifier of the authorization server. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable deleteAsync(String resourceGroupName, String serviceName, String authsid, String ifMatch) { + return deleteWithServiceResponseAsync(resourceGroupName, serviceName, authsid, ifMatch).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes specific authorization server instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param authsid Identifier of the authorization server. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> deleteWithServiceResponseAsync(String resourceGroupName, String serviceName, String authsid, String ifMatch) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (authsid == null) { + throw new IllegalArgumentException("Parameter authsid is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (ifMatch == null) { + throw new IllegalArgumentException("Parameter ifMatch 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.delete(resourceGroupName, serviceName, authsid, this.client.subscriptionId(), ifMatch, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = deleteDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse deleteDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(204, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists a collection of authorization servers defined within a service instance. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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<AuthorizationServerContractInner> object if successful. + */ + public PagedList listByServiceNext(final String nextPageLink) { + ServiceResponse> response = listByServiceNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByServiceNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists a collection of authorization servers defined within a service instance. + * + * @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> listByServiceNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByServiceNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByServiceNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists a collection of authorization servers defined within a service instance. + * + * @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<AuthorizationServerContractInner> object + */ + public Observable> listByServiceNextAsync(final String nextPageLink) { + return listByServiceNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists a collection of authorization servers defined within a service instance. + * + * @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<AuthorizationServerContractInner> object + */ + public Observable>> listByServiceNextWithServiceResponseAsync(final String nextPageLink) { + return listByServiceNextSinglePageAsync(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(listByServiceNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists a collection of authorization servers defined within a service instance. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<AuthorizationServerContractInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByServiceNextSinglePageAsync(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.listByServiceNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByServiceNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByServiceNextDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/BackendContractImpl.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/BackendContractImpl.java new file mode 100644 index 0000000000000..b495c692cd473 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/BackendContractImpl.java @@ -0,0 +1,216 @@ +/** + * 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.apimanagement.v2019_01_01.implementation; + +import com.microsoft.azure.management.apimanagement.v2019_01_01.BackendContract; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import com.microsoft.azure.management.apimanagement.v2019_01_01.BackendProperties; +import com.microsoft.azure.management.apimanagement.v2019_01_01.BackendCredentialsContract; +import com.microsoft.azure.management.apimanagement.v2019_01_01.BackendProxyContract; +import com.microsoft.azure.management.apimanagement.v2019_01_01.BackendTlsProperties; +import com.microsoft.azure.management.apimanagement.v2019_01_01.BackendProtocol; + +class BackendContractImpl extends CreatableUpdatableImpl implements BackendContract, BackendContract.Definition, BackendContract.Update { + private String resourceGroupName; + private String serviceName; + private String backendId; + private String cifMatch; + private String uifMatch; + private final ApiManagementManager manager; + + BackendContractImpl(String name, ApiManagementManager manager) { + super(name, new BackendContractInner()); + this.manager = manager; + // Set resource name + this.backendId = name; + // + } + + BackendContractImpl(BackendContractInner inner, ApiManagementManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.backendId = inner.name(); + // set resource ancestor and positional variables + this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourceGroups"); + this.serviceName = IdParsingUtils.getValueFromIdByName(inner.id(), "service"); + this.backendId = IdParsingUtils.getValueFromIdByName(inner.id(), "backends"); + // set other parameters for create and update + } + + @Override + public ApiManagementManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + BackendsInner client = this.manager().inner().backends(); + return client.createOrUpdateAsync(this.resourceGroupName, this.serviceName, this.backendId, this.inner(), this.cifMatch) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + BackendsInner client = this.manager().inner().backends(); + return client.createOrUpdateAsync(this.resourceGroupName, this.serviceName, this.backendId, this.inner(), this.uifMatch) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + BackendsInner client = this.manager().inner().backends(); + return null; // NOP getInnerAsync implementation as get is not supported + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + + @Override + public BackendCredentialsContract credentials() { + return this.inner().credentials(); + } + + @Override + public String description() { + return this.inner().description(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public BackendProperties properties() { + return this.inner().properties(); + } + + @Override + public BackendProtocol protocol() { + return this.inner().protocol(); + } + + @Override + public BackendProxyContract proxy() { + return this.inner().proxy(); + } + + @Override + public String resourceId() { + return this.inner().resourceId(); + } + + @Override + public String title() { + return this.inner().title(); + } + + @Override + public BackendTlsProperties tls() { + return this.inner().tls(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public String url() { + return this.inner().url(); + } + + @Override + public BackendContractImpl withResourceGroupName(String resourceGroupName) { + this.resourceGroupName = resourceGroupName; + return this; + } + + @Override + public BackendContractImpl withServiceName(String serviceName) { + this.serviceName = serviceName; + return this; + } + + @Override + public BackendContractImpl withProtocol(BackendProtocol protocol) { + this.inner().withProtocol(protocol); + return this; + } + + @Override + public BackendContractImpl withUrl(String url) { + this.inner().withUrl(url); + return this; + } + + @Override + public BackendContractImpl withIfMatch(String ifMatch) { + if (isInCreateMode()) { + this.cifMatch = ifMatch; + } else { + this.uifMatch = ifMatch; + } + return this; + } + + @Override + public BackendContractImpl withCredentials(BackendCredentialsContract credentials) { + this.inner().withCredentials(credentials); + return this; + } + + @Override + public BackendContractImpl withDescription(String description) { + this.inner().withDescription(description); + return this; + } + + @Override + public BackendContractImpl withProperties(BackendProperties properties) { + this.inner().withProperties(properties); + return this; + } + + @Override + public BackendContractImpl withProxy(BackendProxyContract proxy) { + this.inner().withProxy(proxy); + return this; + } + + @Override + public BackendContractImpl withResourceId(String resourceId) { + this.inner().withResourceId(resourceId); + return this; + } + + @Override + public BackendContractImpl withTitle(String title) { + this.inner().withTitle(title); + return this; + } + + @Override + public BackendContractImpl withTls(BackendTlsProperties tls) { + this.inner().withTls(tls); + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/BackendContractInner.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/BackendContractInner.java new file mode 100644 index 0000000000000..620e1f01be9a8 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/BackendContractInner.java @@ -0,0 +1,260 @@ +/** + * 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.apimanagement.v2019_01_01.implementation; + +import com.microsoft.azure.management.apimanagement.v2019_01_01.BackendProperties; +import com.microsoft.azure.management.apimanagement.v2019_01_01.BackendCredentialsContract; +import com.microsoft.azure.management.apimanagement.v2019_01_01.BackendProxyContract; +import com.microsoft.azure.management.apimanagement.v2019_01_01.BackendTlsProperties; +import com.microsoft.azure.management.apimanagement.v2019_01_01.BackendProtocol; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * Backend details. + */ +@JsonFlatten +public class BackendContractInner extends ProxyResource { + /** + * Backend Title. + */ + @JsonProperty(value = "properties.title") + private String title; + + /** + * Backend Description. + */ + @JsonProperty(value = "properties.description") + private String description; + + /** + * Management Uri of the Resource in External System. This url can be the + * Arm Resource Id of Logic Apps, Function Apps or Api Apps. + */ + @JsonProperty(value = "properties.resourceId") + private String resourceId; + + /** + * Backend Properties contract. + */ + @JsonProperty(value = "properties.properties") + private BackendProperties properties; + + /** + * Backend Credentials Contract Properties. + */ + @JsonProperty(value = "properties.credentials") + private BackendCredentialsContract credentials; + + /** + * Backend Proxy Contract Properties. + */ + @JsonProperty(value = "properties.proxy") + private BackendProxyContract proxy; + + /** + * Backend TLS Properties. + */ + @JsonProperty(value = "properties.tls") + private BackendTlsProperties tls; + + /** + * Runtime Url of the Backend. + */ + @JsonProperty(value = "properties.url", required = true) + private String url; + + /** + * Backend communication protocol. Possible values include: 'http', 'soap'. + */ + @JsonProperty(value = "properties.protocol", required = true) + private BackendProtocol protocol; + + /** + * Get backend Title. + * + * @return the title value + */ + public String title() { + return this.title; + } + + /** + * Set backend Title. + * + * @param title the title value to set + * @return the BackendContractInner object itself. + */ + public BackendContractInner withTitle(String title) { + this.title = title; + return this; + } + + /** + * Get backend Description. + * + * @return the description value + */ + public String description() { + return this.description; + } + + /** + * Set backend Description. + * + * @param description the description value to set + * @return the BackendContractInner object itself. + */ + public BackendContractInner withDescription(String description) { + this.description = description; + return this; + } + + /** + * Get management Uri of the Resource in External System. This url can be the Arm Resource Id of Logic Apps, Function Apps or Api Apps. + * + * @return the resourceId value + */ + public String resourceId() { + return this.resourceId; + } + + /** + * Set management Uri of the Resource in External System. This url can be the Arm Resource Id of Logic Apps, Function Apps or Api Apps. + * + * @param resourceId the resourceId value to set + * @return the BackendContractInner object itself. + */ + public BackendContractInner withResourceId(String resourceId) { + this.resourceId = resourceId; + return this; + } + + /** + * Get backend Properties contract. + * + * @return the properties value + */ + public BackendProperties properties() { + return this.properties; + } + + /** + * Set backend Properties contract. + * + * @param properties the properties value to set + * @return the BackendContractInner object itself. + */ + public BackendContractInner withProperties(BackendProperties properties) { + this.properties = properties; + return this; + } + + /** + * Get backend Credentials Contract Properties. + * + * @return the credentials value + */ + public BackendCredentialsContract credentials() { + return this.credentials; + } + + /** + * Set backend Credentials Contract Properties. + * + * @param credentials the credentials value to set + * @return the BackendContractInner object itself. + */ + public BackendContractInner withCredentials(BackendCredentialsContract credentials) { + this.credentials = credentials; + return this; + } + + /** + * Get backend Proxy Contract Properties. + * + * @return the proxy value + */ + public BackendProxyContract proxy() { + return this.proxy; + } + + /** + * Set backend Proxy Contract Properties. + * + * @param proxy the proxy value to set + * @return the BackendContractInner object itself. + */ + public BackendContractInner withProxy(BackendProxyContract proxy) { + this.proxy = proxy; + return this; + } + + /** + * Get backend TLS Properties. + * + * @return the tls value + */ + public BackendTlsProperties tls() { + return this.tls; + } + + /** + * Set backend TLS Properties. + * + * @param tls the tls value to set + * @return the BackendContractInner object itself. + */ + public BackendContractInner withTls(BackendTlsProperties tls) { + this.tls = tls; + return this; + } + + /** + * Get runtime Url of the Backend. + * + * @return the url value + */ + public String url() { + return this.url; + } + + /** + * Set runtime Url of the Backend. + * + * @param url the url value to set + * @return the BackendContractInner object itself. + */ + public BackendContractInner withUrl(String url) { + this.url = url; + return this; + } + + /** + * Get backend communication protocol. Possible values include: 'http', 'soap'. + * + * @return the protocol value + */ + public BackendProtocol protocol() { + return this.protocol; + } + + /** + * Set backend communication protocol. Possible values include: 'http', 'soap'. + * + * @param protocol the protocol value to set + * @return the BackendContractInner object itself. + */ + public BackendContractInner withProtocol(BackendProtocol protocol) { + this.protocol = protocol; + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/BackendsImpl.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/BackendsImpl.java new file mode 100644 index 0000000000000..8eeea170f6a0f --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/BackendsImpl.java @@ -0,0 +1,93 @@ +/** + * 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. + * jkl + */ + +package com.microsoft.azure.management.apimanagement.v2019_01_01.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.apimanagement.v2019_01_01.Backends; +import rx.Completable; +import rx.functions.Func1; +import rx.Observable; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.apimanagement.v2019_01_01.BackendContract; + +class BackendsImpl extends WrapperImpl implements Backends { + private final ApiManagementManager manager; + + BackendsImpl(ApiManagementManager manager) { + super(manager.inner().backends()); + this.manager = manager; + } + + public ApiManagementManager manager() { + return this.manager; + } + + @Override + public BackendContractImpl define(String name) { + return wrapModel(name); + } + + private BackendContractImpl wrapModel(BackendContractInner inner) { + return new BackendContractImpl(inner, manager()); + } + + private BackendContractImpl wrapModel(String name) { + return new BackendContractImpl(name, this.manager()); + } + + @Override + public Observable listByServiceAsync(final String resourceGroupName, final String serviceName) { + BackendsInner client = this.inner(); + return client.listByServiceAsync(resourceGroupName, serviceName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public BackendContract call(BackendContractInner inner) { + return new BackendContractImpl(inner, manager()); + } + }); + } + + @Override + public Completable getEntityTagAsync(String resourceGroupName, String serviceName, String backendId) { + BackendsInner client = this.inner(); + return client.getEntityTagAsync(resourceGroupName, serviceName, backendId).toCompletable(); + } + + @Override + public Observable getAsync(String resourceGroupName, String serviceName, String backendId) { + BackendsInner client = this.inner(); + return client.getAsync(resourceGroupName, serviceName, backendId) + .map(new Func1() { + @Override + public BackendContract call(BackendContractInner inner) { + return new BackendContractImpl(inner, manager()); + } + }); + } + + @Override + public Completable deleteAsync(String resourceGroupName, String serviceName, String backendId, String ifMatch) { + BackendsInner client = this.inner(); + return client.deleteAsync(resourceGroupName, serviceName, backendId, ifMatch).toCompletable(); + } + + @Override + public Completable reconnectAsync(String resourceGroupName, String serviceName, String backendId) { + BackendsInner client = this.inner(); + return client.reconnectAsync(resourceGroupName, serviceName, backendId).toCompletable(); + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/BackendsInner.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/BackendsInner.java new file mode 100644 index 0000000000000..32440b7b5403a --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/BackendsInner.java @@ -0,0 +1,1258 @@ +/** + * 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.apimanagement.v2019_01_01.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.apimanagement.v2019_01_01.BackendCreateOrUpdateHeaders; +import com.microsoft.azure.management.apimanagement.v2019_01_01.BackendGetEntityTagHeaders; +import com.microsoft.azure.management.apimanagement.v2019_01_01.BackendGetHeaders; +import com.microsoft.azure.management.apimanagement.v2019_01_01.BackendReconnectContract; +import com.microsoft.azure.management.apimanagement.v2019_01_01.BackendUpdateParameters; +import com.microsoft.azure.management.apimanagement.v2019_01_01.ErrorResponseException; +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.ServiceResponseWithHeaders; +import com.microsoft.rest.Validator; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import org.joda.time.Period; +import retrofit2.http.Body; +import retrofit2.http.GET; +import retrofit2.http.HEAD; +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 Backends. + */ +public class BackendsInner { + /** The Retrofit service to perform REST calls. */ + private BackendsService service; + /** The service client containing this operation class. */ + private ApiManagementClientImpl client; + + /** + * Initializes an instance of BackendsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public BackendsInner(Retrofit retrofit, ApiManagementClientImpl client) { + this.service = retrofit.create(BackendsService.class); + this.client = client; + } + + /** + * The interface defining all the services for Backends to be + * used by Retrofit to perform actually REST calls. + */ + interface BackendsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.apimanagement.v2019_01_01.Backends listByService" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/backends") + Observable> listByService(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("subscriptionId") String subscriptionId, @Query("$filter") String filter, @Query("$top") Integer top, @Query("$skip") Integer skip, @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.apimanagement.v2019_01_01.Backends getEntityTag" }) + @HEAD("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/backends/{backendId}") + Observable> getEntityTag(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("backendId") String backendId, @Path("subscriptionId") String subscriptionId, @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.apimanagement.v2019_01_01.Backends get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/backends/{backendId}") + Observable> get(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("backendId") String backendId, @Path("subscriptionId") String subscriptionId, @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.apimanagement.v2019_01_01.Backends createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/backends/{backendId}") + Observable> createOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("backendId") String backendId, @Path("subscriptionId") String subscriptionId, @Body BackendContractInner parameters, @Header("If-Match") String ifMatch, @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.apimanagement.v2019_01_01.Backends update" }) + @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/backends/{backendId}") + Observable> update(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("backendId") String backendId, @Path("subscriptionId") String subscriptionId, @Body BackendUpdateParameters parameters, @Header("If-Match") String ifMatch, @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.apimanagement.v2019_01_01.Backends delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/backends/{backendId}", method = "DELETE", hasBody = true) + Observable> delete(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("backendId") String backendId, @Path("subscriptionId") String subscriptionId, @Header("If-Match") String ifMatch, @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.apimanagement.v2019_01_01.Backends reconnect" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/backends/{backendId}/reconnect") + Observable> reconnect(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("backendId") String backendId, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body BackendReconnectContract parameters, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.apimanagement.v2019_01_01.Backends listByServiceNext" }) + @GET + Observable> listByServiceNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Lists a collection of backends in the specified service instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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<BackendContractInner> object if successful. + */ + public PagedList listByService(final String resourceGroupName, final String serviceName) { + ServiceResponse> response = listByServiceSinglePageAsync(resourceGroupName, serviceName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByServiceNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists a collection of backends in the specified service instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @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> listByServiceAsync(final String resourceGroupName, final String serviceName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByServiceSinglePageAsync(resourceGroupName, serviceName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByServiceNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists a collection of backends in the specified service instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<BackendContractInner> object + */ + public Observable> listByServiceAsync(final String resourceGroupName, final String serviceName) { + return listByServiceWithServiceResponseAsync(resourceGroupName, serviceName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists a collection of backends in the specified service instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<BackendContractInner> object + */ + public Observable>> listByServiceWithServiceResponseAsync(final String resourceGroupName, final String serviceName) { + return listByServiceSinglePageAsync(resourceGroupName, serviceName) + .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(listByServiceNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists a collection of backends in the specified service instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<BackendContractInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByServiceSinglePageAsync(final String resourceGroupName, final String serviceName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + 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 filter = null; + final Integer top = null; + final Integer skip = null; + return service.listByService(resourceGroupName, serviceName, this.client.subscriptionId(), filter, top, skip, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByServiceDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Lists a collection of backends in the specified service instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| title | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| url | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br> + * @param top Number of records to return. + * @param skip Number of records to skip. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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<BackendContractInner> object if successful. + */ + public PagedList listByService(final String resourceGroupName, final String serviceName, final String filter, final Integer top, final Integer skip) { + ServiceResponse> response = listByServiceSinglePageAsync(resourceGroupName, serviceName, filter, top, skip).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByServiceNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists a collection of backends in the specified service instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| title | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| url | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br> + * @param top Number of records to return. + * @param skip Number of records to skip. + * @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> listByServiceAsync(final String resourceGroupName, final String serviceName, final String filter, final Integer top, final Integer skip, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByServiceSinglePageAsync(resourceGroupName, serviceName, filter, top, skip), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByServiceNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists a collection of backends in the specified service instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| title | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| url | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br> + * @param top Number of records to return. + * @param skip Number of records to skip. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<BackendContractInner> object + */ + public Observable> listByServiceAsync(final String resourceGroupName, final String serviceName, final String filter, final Integer top, final Integer skip) { + return listByServiceWithServiceResponseAsync(resourceGroupName, serviceName, filter, top, skip) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists a collection of backends in the specified service instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| title | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| url | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br> + * @param top Number of records to return. + * @param skip Number of records to skip. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<BackendContractInner> object + */ + public Observable>> listByServiceWithServiceResponseAsync(final String resourceGroupName, final String serviceName, final String filter, final Integer top, final Integer skip) { + return listByServiceSinglePageAsync(resourceGroupName, serviceName, filter, top, skip) + .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(listByServiceNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists a collection of backends in the specified service instance. + * + ServiceResponse> * @param resourceGroupName The name of the resource group. + ServiceResponse> * @param serviceName The name of the API Management service. + ServiceResponse> * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| title | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| url | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br> + ServiceResponse> * @param top Number of records to return. + ServiceResponse> * @param skip Number of records to skip. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<BackendContractInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByServiceSinglePageAsync(final String resourceGroupName, final String serviceName, final String filter, final Integer top, final Integer skip) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + 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.listByService(resourceGroupName, serviceName, this.client.subscriptionId(), filter, top, skip, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByServiceDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByServiceDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Gets the entity state (Etag) version of the backend specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param backendId Identifier of the Backend entity. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void getEntityTag(String resourceGroupName, String serviceName, String backendId) { + getEntityTagWithServiceResponseAsync(resourceGroupName, serviceName, backendId).toBlocking().single().body(); + } + + /** + * Gets the entity state (Etag) version of the backend specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param backendId Identifier of the Backend entity. Must be unique in the current API Management service instance. + * @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 getEntityTagAsync(String resourceGroupName, String serviceName, String backendId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(getEntityTagWithServiceResponseAsync(resourceGroupName, serviceName, backendId), serviceCallback); + } + + /** + * Gets the entity state (Etag) version of the backend specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param backendId Identifier of the Backend entity. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public Observable getEntityTagAsync(String resourceGroupName, String serviceName, String backendId) { + return getEntityTagWithServiceResponseAsync(resourceGroupName, serviceName, backendId).map(new Func1, Void>() { + @Override + public Void call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Gets the entity state (Etag) version of the backend specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param backendId Identifier of the Backend entity. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public Observable> getEntityTagWithServiceResponseAsync(String resourceGroupName, String serviceName, String backendId) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (backendId == null) { + throw new IllegalArgumentException("Parameter backendId is required and cannot be null."); + } + 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.getEntityTag(resourceGroupName, serviceName, backendId, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = getEntityTagDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponseWithHeaders getEntityTagDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .buildEmptyWithHeaders(response, BackendGetEntityTagHeaders.class); + } + + /** + * Gets the details of the backend specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param backendId Identifier of the Backend entity. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the BackendContractInner object if successful. + */ + public BackendContractInner get(String resourceGroupName, String serviceName, String backendId) { + return getWithServiceResponseAsync(resourceGroupName, serviceName, backendId).toBlocking().single().body(); + } + + /** + * Gets the details of the backend specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param backendId Identifier of the Backend entity. Must be unique in the current API Management service instance. + * @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 getAsync(String resourceGroupName, String serviceName, String backendId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(getWithServiceResponseAsync(resourceGroupName, serviceName, backendId), serviceCallback); + } + + /** + * Gets the details of the backend specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param backendId Identifier of the Backend entity. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BackendContractInner object + */ + public Observable getAsync(String resourceGroupName, String serviceName, String backendId) { + return getWithServiceResponseAsync(resourceGroupName, serviceName, backendId).map(new Func1, BackendContractInner>() { + @Override + public BackendContractInner call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Gets the details of the backend specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param backendId Identifier of the Backend entity. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BackendContractInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String serviceName, String backendId) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (backendId == null) { + throw new IllegalArgumentException("Parameter backendId is required and cannot be null."); + } + 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.get(resourceGroupName, serviceName, backendId, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = getDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponseWithHeaders getDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .buildWithHeaders(response, BackendGetHeaders.class); + } + + /** + * Creates or Updates a backend. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param backendId Identifier of the Backend entity. Must be unique in the current API Management service instance. + * @param parameters Create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the BackendContractInner object if successful. + */ + public BackendContractInner createOrUpdate(String resourceGroupName, String serviceName, String backendId, BackendContractInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serviceName, backendId, parameters).toBlocking().single().body(); + } + + /** + * Creates or Updates a backend. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param backendId Identifier of the Backend entity. Must be unique in the current API Management service instance. + * @param parameters Create parameters. + * @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 createOrUpdateAsync(String resourceGroupName, String serviceName, String backendId, BackendContractInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, serviceName, backendId, parameters), serviceCallback); + } + + /** + * Creates or Updates a backend. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param backendId Identifier of the Backend entity. Must be unique in the current API Management service instance. + * @param parameters Create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BackendContractInner object + */ + public Observable createOrUpdateAsync(String resourceGroupName, String serviceName, String backendId, BackendContractInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serviceName, backendId, parameters).map(new Func1, BackendContractInner>() { + @Override + public BackendContractInner call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Creates or Updates a backend. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param backendId Identifier of the Backend entity. Must be unique in the current API Management service instance. + * @param parameters Create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BackendContractInner object + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String serviceName, String backendId, BackendContractInner parameters) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (backendId == null) { + throw new IllegalArgumentException("Parameter backendId is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(parameters); + final String ifMatch = null; + return service.createOrUpdate(resourceGroupName, serviceName, backendId, this.client.subscriptionId(), parameters, ifMatch, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = createOrUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Creates or Updates a backend. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param backendId Identifier of the Backend entity. Must be unique in the current API Management service instance. + * @param parameters Create parameters. + * @param ifMatch ETag of the Entity. Not required when creating an entity, but required when updating an entity. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the BackendContractInner object if successful. + */ + public BackendContractInner createOrUpdate(String resourceGroupName, String serviceName, String backendId, BackendContractInner parameters, String ifMatch) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serviceName, backendId, parameters, ifMatch).toBlocking().single().body(); + } + + /** + * Creates or Updates a backend. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param backendId Identifier of the Backend entity. Must be unique in the current API Management service instance. + * @param parameters Create parameters. + * @param ifMatch ETag of the Entity. Not required when creating an entity, but required when updating an entity. + * @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 createOrUpdateAsync(String resourceGroupName, String serviceName, String backendId, BackendContractInner parameters, String ifMatch, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, serviceName, backendId, parameters, ifMatch), serviceCallback); + } + + /** + * Creates or Updates a backend. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param backendId Identifier of the Backend entity. Must be unique in the current API Management service instance. + * @param parameters Create parameters. + * @param ifMatch ETag of the Entity. Not required when creating an entity, but required when updating an entity. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BackendContractInner object + */ + public Observable createOrUpdateAsync(String resourceGroupName, String serviceName, String backendId, BackendContractInner parameters, String ifMatch) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serviceName, backendId, parameters, ifMatch).map(new Func1, BackendContractInner>() { + @Override + public BackendContractInner call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Creates or Updates a backend. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param backendId Identifier of the Backend entity. Must be unique in the current API Management service instance. + * @param parameters Create parameters. + * @param ifMatch ETag of the Entity. Not required when creating an entity, but required when updating an entity. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BackendContractInner object + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String serviceName, String backendId, BackendContractInner parameters, String ifMatch) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (backendId == null) { + throw new IllegalArgumentException("Parameter backendId is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(parameters); + return service.createOrUpdate(resourceGroupName, serviceName, backendId, this.client.subscriptionId(), parameters, ifMatch, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = createOrUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponseWithHeaders createOrUpdateDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(201, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .buildWithHeaders(response, BackendCreateOrUpdateHeaders.class); + } + + /** + * Updates an existing backend. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param backendId Identifier of the Backend entity. Must be unique in the current API Management service instance. + * @param parameters Update parameters. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void update(String resourceGroupName, String serviceName, String backendId, BackendUpdateParameters parameters, String ifMatch) { + updateWithServiceResponseAsync(resourceGroupName, serviceName, backendId, parameters, ifMatch).toBlocking().single().body(); + } + + /** + * Updates an existing backend. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param backendId Identifier of the Backend entity. Must be unique in the current API Management service instance. + * @param parameters Update parameters. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @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 serviceName, String backendId, BackendUpdateParameters parameters, String ifMatch, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateWithServiceResponseAsync(resourceGroupName, serviceName, backendId, parameters, ifMatch), serviceCallback); + } + + /** + * Updates an existing backend. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param backendId Identifier of the Backend entity. Must be unique in the current API Management service instance. + * @param parameters Update parameters. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable updateAsync(String resourceGroupName, String serviceName, String backendId, BackendUpdateParameters parameters, String ifMatch) { + return updateWithServiceResponseAsync(resourceGroupName, serviceName, backendId, parameters, ifMatch).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates an existing backend. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param backendId Identifier of the Backend entity. Must be unique in the current API Management service instance. + * @param parameters Update parameters. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> updateWithServiceResponseAsync(String resourceGroupName, String serviceName, String backendId, BackendUpdateParameters parameters, String ifMatch) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (backendId == null) { + throw new IllegalArgumentException("Parameter backendId is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + if (ifMatch == null) { + throw new IllegalArgumentException("Parameter ifMatch is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(parameters); + return service.update(resourceGroupName, serviceName, backendId, this.client.subscriptionId(), parameters, ifMatch, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = updateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse updateDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(204, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Deletes the specified backend. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param backendId Identifier of the Backend entity. Must be unique in the current API Management service instance. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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 serviceName, String backendId, String ifMatch) { + deleteWithServiceResponseAsync(resourceGroupName, serviceName, backendId, ifMatch).toBlocking().single().body(); + } + + /** + * Deletes the specified backend. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param backendId Identifier of the Backend entity. Must be unique in the current API Management service instance. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @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 serviceName, String backendId, String ifMatch, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, serviceName, backendId, ifMatch), serviceCallback); + } + + /** + * Deletes the specified backend. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param backendId Identifier of the Backend entity. Must be unique in the current API Management service instance. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable deleteAsync(String resourceGroupName, String serviceName, String backendId, String ifMatch) { + return deleteWithServiceResponseAsync(resourceGroupName, serviceName, backendId, ifMatch).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes the specified backend. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param backendId Identifier of the Backend entity. Must be unique in the current API Management service instance. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> deleteWithServiceResponseAsync(String resourceGroupName, String serviceName, String backendId, String ifMatch) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (backendId == null) { + throw new IllegalArgumentException("Parameter backendId is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (ifMatch == null) { + throw new IllegalArgumentException("Parameter ifMatch 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.delete(resourceGroupName, serviceName, backendId, this.client.subscriptionId(), ifMatch, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = deleteDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse deleteDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(204, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Notifies the APIM proxy to create a new connection to the backend after the specified timeout. If no timeout was specified, timeout of 2 minutes is used. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param backendId Identifier of the Backend entity. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void reconnect(String resourceGroupName, String serviceName, String backendId) { + reconnectWithServiceResponseAsync(resourceGroupName, serviceName, backendId).toBlocking().single().body(); + } + + /** + * Notifies the APIM proxy to create a new connection to the backend after the specified timeout. If no timeout was specified, timeout of 2 minutes is used. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param backendId Identifier of the Backend entity. Must be unique in the current API Management service instance. + * @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 reconnectAsync(String resourceGroupName, String serviceName, String backendId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(reconnectWithServiceResponseAsync(resourceGroupName, serviceName, backendId), serviceCallback); + } + + /** + * Notifies the APIM proxy to create a new connection to the backend after the specified timeout. If no timeout was specified, timeout of 2 minutes is used. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param backendId Identifier of the Backend entity. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable reconnectAsync(String resourceGroupName, String serviceName, String backendId) { + return reconnectWithServiceResponseAsync(resourceGroupName, serviceName, backendId).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Notifies the APIM proxy to create a new connection to the backend after the specified timeout. If no timeout was specified, timeout of 2 minutes is used. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param backendId Identifier of the Backend entity. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> reconnectWithServiceResponseAsync(String resourceGroupName, String serviceName, String backendId) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (backendId == null) { + throw new IllegalArgumentException("Parameter backendId is required and cannot be null."); + } + 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 Period after = null; + BackendReconnectContract parameters = new BackendReconnectContract(); + parameters.withAfter(null); + return service.reconnect(resourceGroupName, serviceName, backendId, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), parameters, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = reconnectDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Notifies the APIM proxy to create a new connection to the backend after the specified timeout. If no timeout was specified, timeout of 2 minutes is used. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param backendId Identifier of the Backend entity. Must be unique in the current API Management service instance. + * @param after Duration in ISO8601 format after which reconnect will be initiated. Minimum duration of the Reconnect is PT2M. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void reconnect(String resourceGroupName, String serviceName, String backendId, Period after) { + reconnectWithServiceResponseAsync(resourceGroupName, serviceName, backendId, after).toBlocking().single().body(); + } + + /** + * Notifies the APIM proxy to create a new connection to the backend after the specified timeout. If no timeout was specified, timeout of 2 minutes is used. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param backendId Identifier of the Backend entity. Must be unique in the current API Management service instance. + * @param after Duration in ISO8601 format after which reconnect will be initiated. Minimum duration of the Reconnect is PT2M. + * @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 reconnectAsync(String resourceGroupName, String serviceName, String backendId, Period after, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(reconnectWithServiceResponseAsync(resourceGroupName, serviceName, backendId, after), serviceCallback); + } + + /** + * Notifies the APIM proxy to create a new connection to the backend after the specified timeout. If no timeout was specified, timeout of 2 minutes is used. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param backendId Identifier of the Backend entity. Must be unique in the current API Management service instance. + * @param after Duration in ISO8601 format after which reconnect will be initiated. Minimum duration of the Reconnect is PT2M. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable reconnectAsync(String resourceGroupName, String serviceName, String backendId, Period after) { + return reconnectWithServiceResponseAsync(resourceGroupName, serviceName, backendId, after).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Notifies the APIM proxy to create a new connection to the backend after the specified timeout. If no timeout was specified, timeout of 2 minutes is used. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param backendId Identifier of the Backend entity. Must be unique in the current API Management service instance. + * @param after Duration in ISO8601 format after which reconnect will be initiated. Minimum duration of the Reconnect is PT2M. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> reconnectWithServiceResponseAsync(String resourceGroupName, String serviceName, String backendId, Period after) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (backendId == null) { + throw new IllegalArgumentException("Parameter backendId is required and cannot be null."); + } + 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."); + } + BackendReconnectContract parameters = null; + if (after != null) { + parameters = new BackendReconnectContract(); + parameters.withAfter(after); + } + return service.reconnect(resourceGroupName, serviceName, backendId, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), parameters, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = reconnectDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse reconnectDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(202, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists a collection of backends in the specified service instance. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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<BackendContractInner> object if successful. + */ + public PagedList listByServiceNext(final String nextPageLink) { + ServiceResponse> response = listByServiceNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByServiceNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists a collection of backends in the specified service instance. + * + * @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> listByServiceNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByServiceNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByServiceNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists a collection of backends in the specified service instance. + * + * @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<BackendContractInner> object + */ + public Observable> listByServiceNextAsync(final String nextPageLink) { + return listByServiceNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists a collection of backends in the specified service instance. + * + * @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<BackendContractInner> object + */ + public Observable>> listByServiceNextWithServiceResponseAsync(final String nextPageLink) { + return listByServiceNextSinglePageAsync(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(listByServiceNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists a collection of backends in the specified service instance. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<BackendContractInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByServiceNextSinglePageAsync(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.listByServiceNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByServiceNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByServiceNextDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/CacheContractImpl.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/CacheContractImpl.java new file mode 100644 index 0000000000000..9f359e9c1bfc5 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/CacheContractImpl.java @@ -0,0 +1,145 @@ +/** + * 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.apimanagement.v2019_01_01.implementation; + +import com.microsoft.azure.management.apimanagement.v2019_01_01.CacheContract; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; + +class CacheContractImpl extends CreatableUpdatableImpl implements CacheContract, CacheContract.Definition, CacheContract.Update { + private String resourceGroupName; + private String serviceName; + private String cacheId; + private String cifMatch; + private String uifMatch; + private final ApiManagementManager manager; + + CacheContractImpl(String name, ApiManagementManager manager) { + super(name, new CacheContractInner()); + this.manager = manager; + // Set resource name + this.cacheId = name; + // + } + + CacheContractImpl(CacheContractInner inner, ApiManagementManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.cacheId = inner.name(); + // set resource ancestor and positional variables + this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourceGroups"); + this.serviceName = IdParsingUtils.getValueFromIdByName(inner.id(), "service"); + this.cacheId = IdParsingUtils.getValueFromIdByName(inner.id(), "caches"); + // set other parameters for create and update + } + + @Override + public ApiManagementManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + CachesInner client = this.manager().inner().caches(); + return client.createOrUpdateAsync(this.resourceGroupName, this.serviceName, this.cacheId, this.inner(), this.cifMatch) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + CachesInner client = this.manager().inner().caches(); + return client.createOrUpdateAsync(this.resourceGroupName, this.serviceName, this.cacheId, this.inner(), this.uifMatch) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + CachesInner client = this.manager().inner().caches(); + return null; // NOP getInnerAsync implementation as get is not supported + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + + @Override + public String connectionString() { + return this.inner().connectionString(); + } + + @Override + public String description() { + return this.inner().description(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public String resourceId() { + return this.inner().resourceId(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public CacheContractImpl withResourceGroupName(String resourceGroupName) { + this.resourceGroupName = resourceGroupName; + return this; + } + + @Override + public CacheContractImpl withServiceName(String serviceName) { + this.serviceName = serviceName; + return this; + } + + @Override + public CacheContractImpl withConnectionString(String connectionString) { + this.inner().withConnectionString(connectionString); + return this; + } + + @Override + public CacheContractImpl withIfMatch(String ifMatch) { + if (isInCreateMode()) { + this.cifMatch = ifMatch; + } else { + this.uifMatch = ifMatch; + } + return this; + } + + @Override + public CacheContractImpl withDescription(String description) { + this.inner().withDescription(description); + return this; + } + + @Override + public CacheContractImpl withResourceId(String resourceId) { + this.inner().withResourceId(resourceId); + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/CacheContractInner.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/CacheContractInner.java new file mode 100644 index 0000000000000..a747142e05b6a --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/CacheContractInner.java @@ -0,0 +1,98 @@ +/** + * 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.apimanagement.v2019_01_01.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * Cache details. + */ +@JsonFlatten +public class CacheContractInner extends ProxyResource { + /** + * Cache description. + */ + @JsonProperty(value = "properties.description") + private String description; + + /** + * Runtime connection string to cache. + */ + @JsonProperty(value = "properties.connectionString", required = true) + private String connectionString; + + /** + * Original uri of entity in external system cache points to. + */ + @JsonProperty(value = "properties.resourceId") + private String resourceId; + + /** + * Get cache description. + * + * @return the description value + */ + public String description() { + return this.description; + } + + /** + * Set cache description. + * + * @param description the description value to set + * @return the CacheContractInner object itself. + */ + public CacheContractInner withDescription(String description) { + this.description = description; + return this; + } + + /** + * Get runtime connection string to cache. + * + * @return the connectionString value + */ + public String connectionString() { + return this.connectionString; + } + + /** + * Set runtime connection string to cache. + * + * @param connectionString the connectionString value to set + * @return the CacheContractInner object itself. + */ + public CacheContractInner withConnectionString(String connectionString) { + this.connectionString = connectionString; + return this; + } + + /** + * Get original uri of entity in external system cache points to. + * + * @return the resourceId value + */ + public String resourceId() { + return this.resourceId; + } + + /** + * Set original uri of entity in external system cache points to. + * + * @param resourceId the resourceId value to set + * @return the CacheContractInner object itself. + */ + public CacheContractInner withResourceId(String resourceId) { + this.resourceId = resourceId; + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/CachesImpl.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/CachesImpl.java new file mode 100644 index 0000000000000..4317979eecee6 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/CachesImpl.java @@ -0,0 +1,87 @@ +/** + * 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. + * jkl + */ + +package com.microsoft.azure.management.apimanagement.v2019_01_01.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.apimanagement.v2019_01_01.Caches; +import rx.Completable; +import rx.functions.Func1; +import rx.Observable; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.apimanagement.v2019_01_01.CacheContract; + +class CachesImpl extends WrapperImpl implements Caches { + private final ApiManagementManager manager; + + CachesImpl(ApiManagementManager manager) { + super(manager.inner().caches()); + this.manager = manager; + } + + public ApiManagementManager manager() { + return this.manager; + } + + @Override + public CacheContractImpl define(String name) { + return wrapModel(name); + } + + private CacheContractImpl wrapModel(CacheContractInner inner) { + return new CacheContractImpl(inner, manager()); + } + + private CacheContractImpl wrapModel(String name) { + return new CacheContractImpl(name, this.manager()); + } + + @Override + public Observable listByServiceAsync(final String resourceGroupName, final String serviceName) { + CachesInner client = this.inner(); + return client.listByServiceAsync(resourceGroupName, serviceName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public CacheContract call(CacheContractInner inner) { + return new CacheContractImpl(inner, manager()); + } + }); + } + + @Override + public Completable getEntityTagAsync(String resourceGroupName, String serviceName, String cacheId) { + CachesInner client = this.inner(); + return client.getEntityTagAsync(resourceGroupName, serviceName, cacheId).toCompletable(); + } + + @Override + public Observable getAsync(String resourceGroupName, String serviceName, String cacheId) { + CachesInner client = this.inner(); + return client.getAsync(resourceGroupName, serviceName, cacheId) + .map(new Func1() { + @Override + public CacheContract call(CacheContractInner inner) { + return new CacheContractImpl(inner, manager()); + } + }); + } + + @Override + public Completable deleteAsync(String resourceGroupName, String serviceName, String cacheId, String ifMatch) { + CachesInner client = this.inner(); + return client.deleteAsync(resourceGroupName, serviceName, cacheId, ifMatch).toCompletable(); + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/CachesInner.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/CachesInner.java new file mode 100644 index 0000000000000..527444d0a3783 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/CachesInner.java @@ -0,0 +1,1056 @@ +/** + * 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.apimanagement.v2019_01_01.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.apimanagement.v2019_01_01.CacheCreateOrUpdateHeaders; +import com.microsoft.azure.management.apimanagement.v2019_01_01.CacheGetEntityTagHeaders; +import com.microsoft.azure.management.apimanagement.v2019_01_01.CacheGetHeaders; +import com.microsoft.azure.management.apimanagement.v2019_01_01.CacheUpdateParameters; +import com.microsoft.azure.management.apimanagement.v2019_01_01.ErrorResponseException; +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.ServiceResponseWithHeaders; +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.HEAD; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.HTTP; +import retrofit2.http.PATCH; +import retrofit2.http.Path; +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 Caches. + */ +public class CachesInner { + /** The Retrofit service to perform REST calls. */ + private CachesService service; + /** The service client containing this operation class. */ + private ApiManagementClientImpl client; + + /** + * Initializes an instance of CachesInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public CachesInner(Retrofit retrofit, ApiManagementClientImpl client) { + this.service = retrofit.create(CachesService.class); + this.client = client; + } + + /** + * The interface defining all the services for Caches to be + * used by Retrofit to perform actually REST calls. + */ + interface CachesService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.apimanagement.v2019_01_01.Caches listByService" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/caches") + Observable> listByService(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("subscriptionId") String subscriptionId, @Query("$top") Integer top, @Query("$skip") Integer skip, @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.apimanagement.v2019_01_01.Caches getEntityTag" }) + @HEAD("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/caches/{cacheId}") + Observable> getEntityTag(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("cacheId") String cacheId, @Path("subscriptionId") String subscriptionId, @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.apimanagement.v2019_01_01.Caches get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/caches/{cacheId}") + Observable> get(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("cacheId") String cacheId, @Path("subscriptionId") String subscriptionId, @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.apimanagement.v2019_01_01.Caches createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/caches/{cacheId}") + Observable> createOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("cacheId") String cacheId, @Path("subscriptionId") String subscriptionId, @Body CacheContractInner parameters, @Header("If-Match") String ifMatch, @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.apimanagement.v2019_01_01.Caches update" }) + @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/caches/{cacheId}") + Observable> update(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("cacheId") String cacheId, @Path("subscriptionId") String subscriptionId, @Body CacheUpdateParameters parameters, @Header("If-Match") String ifMatch, @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.apimanagement.v2019_01_01.Caches delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/caches/{cacheId}", method = "DELETE", hasBody = true) + Observable> delete(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("cacheId") String cacheId, @Path("subscriptionId") String subscriptionId, @Header("If-Match") String ifMatch, @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.apimanagement.v2019_01_01.Caches listByServiceNext" }) + @GET + Observable> listByServiceNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Lists a collection of all external Caches in the specified service instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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<CacheContractInner> object if successful. + */ + public PagedList listByService(final String resourceGroupName, final String serviceName) { + ServiceResponse> response = listByServiceSinglePageAsync(resourceGroupName, serviceName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByServiceNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists a collection of all external Caches in the specified service instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @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> listByServiceAsync(final String resourceGroupName, final String serviceName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByServiceSinglePageAsync(resourceGroupName, serviceName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByServiceNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists a collection of all external Caches in the specified service instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<CacheContractInner> object + */ + public Observable> listByServiceAsync(final String resourceGroupName, final String serviceName) { + return listByServiceWithServiceResponseAsync(resourceGroupName, serviceName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists a collection of all external Caches in the specified service instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<CacheContractInner> object + */ + public Observable>> listByServiceWithServiceResponseAsync(final String resourceGroupName, final String serviceName) { + return listByServiceSinglePageAsync(resourceGroupName, serviceName) + .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(listByServiceNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists a collection of all external Caches in the specified service instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<CacheContractInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByServiceSinglePageAsync(final String resourceGroupName, final String serviceName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + 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 Integer top = null; + final Integer skip = null; + return service.listByService(resourceGroupName, serviceName, this.client.subscriptionId(), top, skip, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByServiceDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Lists a collection of all external Caches in the specified service instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param top Number of records to return. + * @param skip Number of records to skip. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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<CacheContractInner> object if successful. + */ + public PagedList listByService(final String resourceGroupName, final String serviceName, final Integer top, final Integer skip) { + ServiceResponse> response = listByServiceSinglePageAsync(resourceGroupName, serviceName, top, skip).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByServiceNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists a collection of all external Caches in the specified service instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param top Number of records to return. + * @param skip Number of records to skip. + * @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> listByServiceAsync(final String resourceGroupName, final String serviceName, final Integer top, final Integer skip, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByServiceSinglePageAsync(resourceGroupName, serviceName, top, skip), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByServiceNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists a collection of all external Caches in the specified service instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param top Number of records to return. + * @param skip Number of records to skip. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<CacheContractInner> object + */ + public Observable> listByServiceAsync(final String resourceGroupName, final String serviceName, final Integer top, final Integer skip) { + return listByServiceWithServiceResponseAsync(resourceGroupName, serviceName, top, skip) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists a collection of all external Caches in the specified service instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param top Number of records to return. + * @param skip Number of records to skip. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<CacheContractInner> object + */ + public Observable>> listByServiceWithServiceResponseAsync(final String resourceGroupName, final String serviceName, final Integer top, final Integer skip) { + return listByServiceSinglePageAsync(resourceGroupName, serviceName, top, skip) + .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(listByServiceNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists a collection of all external Caches in the specified service instance. + * + ServiceResponse> * @param resourceGroupName The name of the resource group. + ServiceResponse> * @param serviceName The name of the API Management service. + ServiceResponse> * @param top Number of records to return. + ServiceResponse> * @param skip Number of records to skip. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<CacheContractInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByServiceSinglePageAsync(final String resourceGroupName, final String serviceName, final Integer top, final Integer skip) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + 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.listByService(resourceGroupName, serviceName, this.client.subscriptionId(), top, skip, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByServiceDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByServiceDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Gets the entity state (Etag) version of the Cache specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param cacheId Identifier of the Cache entity. Cache identifier (should be either 'default' or valid Azure region identifier). + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void getEntityTag(String resourceGroupName, String serviceName, String cacheId) { + getEntityTagWithServiceResponseAsync(resourceGroupName, serviceName, cacheId).toBlocking().single().body(); + } + + /** + * Gets the entity state (Etag) version of the Cache specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param cacheId Identifier of the Cache entity. Cache identifier (should be either 'default' or valid Azure region identifier). + * @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 getEntityTagAsync(String resourceGroupName, String serviceName, String cacheId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(getEntityTagWithServiceResponseAsync(resourceGroupName, serviceName, cacheId), serviceCallback); + } + + /** + * Gets the entity state (Etag) version of the Cache specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param cacheId Identifier of the Cache entity. Cache identifier (should be either 'default' or valid Azure region identifier). + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public Observable getEntityTagAsync(String resourceGroupName, String serviceName, String cacheId) { + return getEntityTagWithServiceResponseAsync(resourceGroupName, serviceName, cacheId).map(new Func1, Void>() { + @Override + public Void call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Gets the entity state (Etag) version of the Cache specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param cacheId Identifier of the Cache entity. Cache identifier (should be either 'default' or valid Azure region identifier). + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public Observable> getEntityTagWithServiceResponseAsync(String resourceGroupName, String serviceName, String cacheId) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (cacheId == null) { + throw new IllegalArgumentException("Parameter cacheId is required and cannot be null."); + } + 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.getEntityTag(resourceGroupName, serviceName, cacheId, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = getEntityTagDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponseWithHeaders getEntityTagDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .buildEmptyWithHeaders(response, CacheGetEntityTagHeaders.class); + } + + /** + * Gets the details of the Cache specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param cacheId Identifier of the Cache entity. Cache identifier (should be either 'default' or valid Azure region identifier). + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the CacheContractInner object if successful. + */ + public CacheContractInner get(String resourceGroupName, String serviceName, String cacheId) { + return getWithServiceResponseAsync(resourceGroupName, serviceName, cacheId).toBlocking().single().body(); + } + + /** + * Gets the details of the Cache specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param cacheId Identifier of the Cache entity. Cache identifier (should be either 'default' or valid Azure region identifier). + * @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 getAsync(String resourceGroupName, String serviceName, String cacheId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(getWithServiceResponseAsync(resourceGroupName, serviceName, cacheId), serviceCallback); + } + + /** + * Gets the details of the Cache specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param cacheId Identifier of the Cache entity. Cache identifier (should be either 'default' or valid Azure region identifier). + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the CacheContractInner object + */ + public Observable getAsync(String resourceGroupName, String serviceName, String cacheId) { + return getWithServiceResponseAsync(resourceGroupName, serviceName, cacheId).map(new Func1, CacheContractInner>() { + @Override + public CacheContractInner call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Gets the details of the Cache specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param cacheId Identifier of the Cache entity. Cache identifier (should be either 'default' or valid Azure region identifier). + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the CacheContractInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String serviceName, String cacheId) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (cacheId == null) { + throw new IllegalArgumentException("Parameter cacheId is required and cannot be null."); + } + 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.get(resourceGroupName, serviceName, cacheId, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = getDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponseWithHeaders getDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .buildWithHeaders(response, CacheGetHeaders.class); + } + + /** + * Creates or updates an External Cache to be used in Api Management instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param cacheId Identifier of the Cache entity. Cache identifier (should be either 'default' or valid Azure region identifier). + * @param parameters Create or Update parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the CacheContractInner object if successful. + */ + public CacheContractInner createOrUpdate(String resourceGroupName, String serviceName, String cacheId, CacheContractInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serviceName, cacheId, parameters).toBlocking().single().body(); + } + + /** + * Creates or updates an External Cache to be used in Api Management instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param cacheId Identifier of the Cache entity. Cache identifier (should be either 'default' or valid Azure region identifier). + * @param parameters Create or Update parameters. + * @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 createOrUpdateAsync(String resourceGroupName, String serviceName, String cacheId, CacheContractInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, serviceName, cacheId, parameters), serviceCallback); + } + + /** + * Creates or updates an External Cache to be used in Api Management instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param cacheId Identifier of the Cache entity. Cache identifier (should be either 'default' or valid Azure region identifier). + * @param parameters Create or Update parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the CacheContractInner object + */ + public Observable createOrUpdateAsync(String resourceGroupName, String serviceName, String cacheId, CacheContractInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serviceName, cacheId, parameters).map(new Func1, CacheContractInner>() { + @Override + public CacheContractInner call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Creates or updates an External Cache to be used in Api Management instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param cacheId Identifier of the Cache entity. Cache identifier (should be either 'default' or valid Azure region identifier). + * @param parameters Create or Update parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the CacheContractInner object + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String serviceName, String cacheId, CacheContractInner parameters) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (cacheId == null) { + throw new IllegalArgumentException("Parameter cacheId is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(parameters); + final String ifMatch = null; + return service.createOrUpdate(resourceGroupName, serviceName, cacheId, this.client.subscriptionId(), parameters, ifMatch, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = createOrUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Creates or updates an External Cache to be used in Api Management instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param cacheId Identifier of the Cache entity. Cache identifier (should be either 'default' or valid Azure region identifier). + * @param parameters Create or Update parameters. + * @param ifMatch ETag of the Entity. Not required when creating an entity, but required when updating an entity. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the CacheContractInner object if successful. + */ + public CacheContractInner createOrUpdate(String resourceGroupName, String serviceName, String cacheId, CacheContractInner parameters, String ifMatch) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serviceName, cacheId, parameters, ifMatch).toBlocking().single().body(); + } + + /** + * Creates or updates an External Cache to be used in Api Management instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param cacheId Identifier of the Cache entity. Cache identifier (should be either 'default' or valid Azure region identifier). + * @param parameters Create or Update parameters. + * @param ifMatch ETag of the Entity. Not required when creating an entity, but required when updating an entity. + * @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 createOrUpdateAsync(String resourceGroupName, String serviceName, String cacheId, CacheContractInner parameters, String ifMatch, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, serviceName, cacheId, parameters, ifMatch), serviceCallback); + } + + /** + * Creates or updates an External Cache to be used in Api Management instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param cacheId Identifier of the Cache entity. Cache identifier (should be either 'default' or valid Azure region identifier). + * @param parameters Create or Update parameters. + * @param ifMatch ETag of the Entity. Not required when creating an entity, but required when updating an entity. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the CacheContractInner object + */ + public Observable createOrUpdateAsync(String resourceGroupName, String serviceName, String cacheId, CacheContractInner parameters, String ifMatch) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serviceName, cacheId, parameters, ifMatch).map(new Func1, CacheContractInner>() { + @Override + public CacheContractInner call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Creates or updates an External Cache to be used in Api Management instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param cacheId Identifier of the Cache entity. Cache identifier (should be either 'default' or valid Azure region identifier). + * @param parameters Create or Update parameters. + * @param ifMatch ETag of the Entity. Not required when creating an entity, but required when updating an entity. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the CacheContractInner object + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String serviceName, String cacheId, CacheContractInner parameters, String ifMatch) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (cacheId == null) { + throw new IllegalArgumentException("Parameter cacheId is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(parameters); + return service.createOrUpdate(resourceGroupName, serviceName, cacheId, this.client.subscriptionId(), parameters, ifMatch, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = createOrUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponseWithHeaders createOrUpdateDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(201, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .buildWithHeaders(response, CacheCreateOrUpdateHeaders.class); + } + + /** + * Updates the details of the cache specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param cacheId Identifier of the Cache entity. Cache identifier (should be either 'default' or valid Azure region identifier). + * @param parameters Update parameters. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void update(String resourceGroupName, String serviceName, String cacheId, CacheUpdateParameters parameters, String ifMatch) { + updateWithServiceResponseAsync(resourceGroupName, serviceName, cacheId, parameters, ifMatch).toBlocking().single().body(); + } + + /** + * Updates the details of the cache specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param cacheId Identifier of the Cache entity. Cache identifier (should be either 'default' or valid Azure region identifier). + * @param parameters Update parameters. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @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 serviceName, String cacheId, CacheUpdateParameters parameters, String ifMatch, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateWithServiceResponseAsync(resourceGroupName, serviceName, cacheId, parameters, ifMatch), serviceCallback); + } + + /** + * Updates the details of the cache specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param cacheId Identifier of the Cache entity. Cache identifier (should be either 'default' or valid Azure region identifier). + * @param parameters Update parameters. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable updateAsync(String resourceGroupName, String serviceName, String cacheId, CacheUpdateParameters parameters, String ifMatch) { + return updateWithServiceResponseAsync(resourceGroupName, serviceName, cacheId, parameters, ifMatch).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates the details of the cache specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param cacheId Identifier of the Cache entity. Cache identifier (should be either 'default' or valid Azure region identifier). + * @param parameters Update parameters. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> updateWithServiceResponseAsync(String resourceGroupName, String serviceName, String cacheId, CacheUpdateParameters parameters, String ifMatch) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (cacheId == null) { + throw new IllegalArgumentException("Parameter cacheId is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + if (ifMatch == null) { + throw new IllegalArgumentException("Parameter ifMatch is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(parameters); + return service.update(resourceGroupName, serviceName, cacheId, this.client.subscriptionId(), parameters, ifMatch, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = updateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse updateDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(204, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Deletes specific Cache. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param cacheId Identifier of the Cache entity. Cache identifier (should be either 'default' or valid Azure region identifier). + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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 serviceName, String cacheId, String ifMatch) { + deleteWithServiceResponseAsync(resourceGroupName, serviceName, cacheId, ifMatch).toBlocking().single().body(); + } + + /** + * Deletes specific Cache. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param cacheId Identifier of the Cache entity. Cache identifier (should be either 'default' or valid Azure region identifier). + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @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 serviceName, String cacheId, String ifMatch, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, serviceName, cacheId, ifMatch), serviceCallback); + } + + /** + * Deletes specific Cache. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param cacheId Identifier of the Cache entity. Cache identifier (should be either 'default' or valid Azure region identifier). + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable deleteAsync(String resourceGroupName, String serviceName, String cacheId, String ifMatch) { + return deleteWithServiceResponseAsync(resourceGroupName, serviceName, cacheId, ifMatch).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes specific Cache. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param cacheId Identifier of the Cache entity. Cache identifier (should be either 'default' or valid Azure region identifier). + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> deleteWithServiceResponseAsync(String resourceGroupName, String serviceName, String cacheId, String ifMatch) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (cacheId == null) { + throw new IllegalArgumentException("Parameter cacheId is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (ifMatch == null) { + throw new IllegalArgumentException("Parameter ifMatch 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.delete(resourceGroupName, serviceName, cacheId, this.client.subscriptionId(), ifMatch, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = deleteDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse deleteDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(204, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists a collection of all external Caches in the specified service instance. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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<CacheContractInner> object if successful. + */ + public PagedList listByServiceNext(final String nextPageLink) { + ServiceResponse> response = listByServiceNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByServiceNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists a collection of all external Caches in the specified service instance. + * + * @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> listByServiceNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByServiceNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByServiceNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists a collection of all external Caches in the specified service instance. + * + * @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<CacheContractInner> object + */ + public Observable> listByServiceNextAsync(final String nextPageLink) { + return listByServiceNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists a collection of all external Caches in the specified service instance. + * + * @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<CacheContractInner> object + */ + public Observable>> listByServiceNextWithServiceResponseAsync(final String nextPageLink) { + return listByServiceNextSinglePageAsync(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(listByServiceNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists a collection of all external Caches in the specified service instance. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<CacheContractInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByServiceNextSinglePageAsync(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.listByServiceNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByServiceNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByServiceNextDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/CertificateContractImpl.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/CertificateContractImpl.java new file mode 100644 index 0000000000000..81225fa61b3f1 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/CertificateContractImpl.java @@ -0,0 +1,162 @@ +/** + * 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.apimanagement.v2019_01_01.implementation; + +import com.microsoft.azure.management.apimanagement.v2019_01_01.CertificateContract; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import com.microsoft.azure.management.apimanagement.v2019_01_01.CertificateCreateOrUpdateParameters; +import org.joda.time.DateTime; +import rx.functions.Func1; + +class CertificateContractImpl extends CreatableUpdatableImpl implements CertificateContract, CertificateContract.Definition, CertificateContract.Update { + private String resourceGroupName; + private String serviceName; + private String certificateId; + private String cifMatch; + private String uifMatch; + private CertificateCreateOrUpdateParameters createOrUpdateParameter; + private final ApiManagementManager manager; + + CertificateContractImpl(String name, ApiManagementManager manager) { + super(name, new CertificateContractInner()); + this.manager = manager; + // Set resource name + this.certificateId = name; + // + this.createOrUpdateParameter = new CertificateCreateOrUpdateParameters(); + } + + CertificateContractImpl(CertificateContractInner inner, ApiManagementManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.certificateId = inner.name(); + // set resource ancestor and positional variables + this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourceGroups"); + this.serviceName = IdParsingUtils.getValueFromIdByName(inner.id(), "service"); + this.certificateId = IdParsingUtils.getValueFromIdByName(inner.id(), "certificates"); + // set other parameters for create and update + this.createOrUpdateParameter = new CertificateCreateOrUpdateParameters(); + } + + @Override + public ApiManagementManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + CertificatesInner client = this.manager().inner().certificates(); + return client.createOrUpdateAsync(this.resourceGroupName, this.serviceName, this.certificateId, this.createOrUpdateParameter, this.cifMatch) + .map(new Func1() { + @Override + public CertificateContractInner call(CertificateContractInner resource) { + resetCreateUpdateParameters(); + return resource; + } + }) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + CertificatesInner client = this.manager().inner().certificates(); + return client.createOrUpdateAsync(this.resourceGroupName, this.serviceName, this.certificateId, this.createOrUpdateParameter, this.uifMatch) + .map(new Func1() { + @Override + public CertificateContractInner call(CertificateContractInner resource) { + resetCreateUpdateParameters(); + return resource; + } + }) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + CertificatesInner client = this.manager().inner().certificates(); + return null; // NOP getInnerAsync implementation as get is not supported + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + private void resetCreateUpdateParameters() { + this.createOrUpdateParameter = new CertificateCreateOrUpdateParameters(); + } + + @Override + public DateTime expirationDate() { + return this.inner().expirationDate(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public String subject() { + return this.inner().subject(); + } + + @Override + public String thumbprint() { + return this.inner().thumbprint(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public CertificateContractImpl withResourceGroupName(String resourceGroupName) { + this.resourceGroupName = resourceGroupName; + return this; + } + + @Override + public CertificateContractImpl withServiceName(String serviceName) { + this.serviceName = serviceName; + return this; + } + + @Override + public CertificateContractImpl withData(String data) { + this.createOrUpdateParameter.withData(data); + return this; + } + + @Override + public CertificateContractImpl withPassword(String password) { + this.createOrUpdateParameter.withPassword(password); + return this; + } + + @Override + public CertificateContractImpl withIfMatch(String ifMatch) { + if (isInCreateMode()) { + this.cifMatch = ifMatch; + } else { + this.uifMatch = ifMatch; + } + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/CertificateContractInner.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/CertificateContractInner.java new file mode 100644 index 0000000000000..346c61f9057dd --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/CertificateContractInner.java @@ -0,0 +1,100 @@ +/** + * 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.apimanagement.v2019_01_01.implementation; + +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * Certificate details. + */ +@JsonFlatten +public class CertificateContractInner extends ProxyResource { + /** + * Subject attribute of the certificate. + */ + @JsonProperty(value = "properties.subject", required = true) + private String subject; + + /** + * Thumbprint of the certificate. + */ + @JsonProperty(value = "properties.thumbprint", required = true) + private String thumbprint; + + /** + * Expiration date of the certificate. The date conforms to the following + * format: `yyyy-MM-ddTHH:mm:ssZ` as specified by the ISO 8601 standard. + */ + @JsonProperty(value = "properties.expirationDate", required = true) + private DateTime expirationDate; + + /** + * Get subject attribute of the certificate. + * + * @return the subject value + */ + public String subject() { + return this.subject; + } + + /** + * Set subject attribute of the certificate. + * + * @param subject the subject value to set + * @return the CertificateContractInner object itself. + */ + public CertificateContractInner withSubject(String subject) { + this.subject = subject; + return this; + } + + /** + * Get thumbprint of the certificate. + * + * @return the thumbprint value + */ + public String thumbprint() { + return this.thumbprint; + } + + /** + * Set thumbprint of the certificate. + * + * @param thumbprint the thumbprint value to set + * @return the CertificateContractInner object itself. + */ + public CertificateContractInner withThumbprint(String thumbprint) { + this.thumbprint = thumbprint; + return this; + } + + /** + * Get expiration date of the certificate. The date conforms to the following format: `yyyy-MM-ddTHH:mm:ssZ` as specified by the ISO 8601 standard. + * + * @return the expirationDate value + */ + public DateTime expirationDate() { + return this.expirationDate; + } + + /** + * Set expiration date of the certificate. The date conforms to the following format: `yyyy-MM-ddTHH:mm:ssZ` as specified by the ISO 8601 standard. + * + * @param expirationDate the expirationDate value to set + * @return the CertificateContractInner object itself. + */ + public CertificateContractInner withExpirationDate(DateTime expirationDate) { + this.expirationDate = expirationDate; + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/CertificatesImpl.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/CertificatesImpl.java new file mode 100644 index 0000000000000..31c33b6094743 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/CertificatesImpl.java @@ -0,0 +1,87 @@ +/** + * 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. + * jkl + */ + +package com.microsoft.azure.management.apimanagement.v2019_01_01.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.apimanagement.v2019_01_01.Certificates; +import rx.Completable; +import rx.functions.Func1; +import rx.Observable; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.apimanagement.v2019_01_01.CertificateContract; + +class CertificatesImpl extends WrapperImpl implements Certificates { + private final ApiManagementManager manager; + + CertificatesImpl(ApiManagementManager manager) { + super(manager.inner().certificates()); + this.manager = manager; + } + + public ApiManagementManager manager() { + return this.manager; + } + + @Override + public CertificateContractImpl define(String name) { + return wrapModel(name); + } + + private CertificateContractImpl wrapModel(CertificateContractInner inner) { + return new CertificateContractImpl(inner, manager()); + } + + private CertificateContractImpl wrapModel(String name) { + return new CertificateContractImpl(name, this.manager()); + } + + @Override + public Observable listByServiceAsync(final String resourceGroupName, final String serviceName) { + CertificatesInner client = this.inner(); + return client.listByServiceAsync(resourceGroupName, serviceName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public CertificateContract call(CertificateContractInner inner) { + return new CertificateContractImpl(inner, manager()); + } + }); + } + + @Override + public Completable getEntityTagAsync(String resourceGroupName, String serviceName, String certificateId) { + CertificatesInner client = this.inner(); + return client.getEntityTagAsync(resourceGroupName, serviceName, certificateId).toCompletable(); + } + + @Override + public Observable getAsync(String resourceGroupName, String serviceName, String certificateId) { + CertificatesInner client = this.inner(); + return client.getAsync(resourceGroupName, serviceName, certificateId) + .map(new Func1() { + @Override + public CertificateContract call(CertificateContractInner inner) { + return new CertificateContractImpl(inner, manager()); + } + }); + } + + @Override + public Completable deleteAsync(String resourceGroupName, String serviceName, String certificateId, String ifMatch) { + CertificatesInner client = this.inner(); + return client.deleteAsync(resourceGroupName, serviceName, certificateId, ifMatch).toCompletable(); + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/CertificatesInner.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/CertificatesInner.java new file mode 100644 index 0000000000000..115aad22ad98a --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/CertificatesInner.java @@ -0,0 +1,950 @@ +/** + * 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.apimanagement.v2019_01_01.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.apimanagement.v2019_01_01.CertificateCreateOrUpdateHeaders; +import com.microsoft.azure.management.apimanagement.v2019_01_01.CertificateCreateOrUpdateParameters; +import com.microsoft.azure.management.apimanagement.v2019_01_01.CertificateGetEntityTagHeaders; +import com.microsoft.azure.management.apimanagement.v2019_01_01.CertificateGetHeaders; +import com.microsoft.azure.management.apimanagement.v2019_01_01.ErrorResponseException; +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.ServiceResponseWithHeaders; +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.HEAD; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.HTTP; +import retrofit2.http.Path; +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 Certificates. + */ +public class CertificatesInner { + /** The Retrofit service to perform REST calls. */ + private CertificatesService service; + /** The service client containing this operation class. */ + private ApiManagementClientImpl client; + + /** + * Initializes an instance of CertificatesInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public CertificatesInner(Retrofit retrofit, ApiManagementClientImpl client) { + this.service = retrofit.create(CertificatesService.class); + this.client = client; + } + + /** + * The interface defining all the services for Certificates to be + * used by Retrofit to perform actually REST calls. + */ + interface CertificatesService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.apimanagement.v2019_01_01.Certificates listByService" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/certificates") + Observable> listByService(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("subscriptionId") String subscriptionId, @Query("$filter") String filter, @Query("$top") Integer top, @Query("$skip") Integer skip, @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.apimanagement.v2019_01_01.Certificates getEntityTag" }) + @HEAD("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/certificates/{certificateId}") + Observable> getEntityTag(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("certificateId") String certificateId, @Path("subscriptionId") String subscriptionId, @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.apimanagement.v2019_01_01.Certificates get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/certificates/{certificateId}") + Observable> get(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("certificateId") String certificateId, @Path("subscriptionId") String subscriptionId, @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.apimanagement.v2019_01_01.Certificates createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/certificates/{certificateId}") + Observable> createOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("certificateId") String certificateId, @Path("subscriptionId") String subscriptionId, @Body CertificateCreateOrUpdateParameters parameters, @Header("If-Match") String ifMatch, @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.apimanagement.v2019_01_01.Certificates delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/certificates/{certificateId}", method = "DELETE", hasBody = true) + Observable> delete(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("certificateId") String certificateId, @Path("subscriptionId") String subscriptionId, @Header("If-Match") String ifMatch, @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.apimanagement.v2019_01_01.Certificates listByServiceNext" }) + @GET + Observable> listByServiceNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Lists a collection of all certificates in the specified service instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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<CertificateContractInner> object if successful. + */ + public PagedList listByService(final String resourceGroupName, final String serviceName) { + ServiceResponse> response = listByServiceSinglePageAsync(resourceGroupName, serviceName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByServiceNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists a collection of all certificates in the specified service instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @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> listByServiceAsync(final String resourceGroupName, final String serviceName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByServiceSinglePageAsync(resourceGroupName, serviceName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByServiceNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists a collection of all certificates in the specified service instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<CertificateContractInner> object + */ + public Observable> listByServiceAsync(final String resourceGroupName, final String serviceName) { + return listByServiceWithServiceResponseAsync(resourceGroupName, serviceName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists a collection of all certificates in the specified service instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<CertificateContractInner> object + */ + public Observable>> listByServiceWithServiceResponseAsync(final String resourceGroupName, final String serviceName) { + return listByServiceSinglePageAsync(resourceGroupName, serviceName) + .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(listByServiceNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists a collection of all certificates in the specified service instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<CertificateContractInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByServiceSinglePageAsync(final String resourceGroupName, final String serviceName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + 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 filter = null; + final Integer top = null; + final Integer skip = null; + return service.listByService(resourceGroupName, serviceName, this.client.subscriptionId(), filter, top, skip, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByServiceDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Lists a collection of all certificates in the specified service instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| subject | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| thumbprint | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| expirationDate | filter | ge, le, eq, ne, gt, lt | | </br> + * @param top Number of records to return. + * @param skip Number of records to skip. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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<CertificateContractInner> object if successful. + */ + public PagedList listByService(final String resourceGroupName, final String serviceName, final String filter, final Integer top, final Integer skip) { + ServiceResponse> response = listByServiceSinglePageAsync(resourceGroupName, serviceName, filter, top, skip).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByServiceNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists a collection of all certificates in the specified service instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| subject | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| thumbprint | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| expirationDate | filter | ge, le, eq, ne, gt, lt | | </br> + * @param top Number of records to return. + * @param skip Number of records to skip. + * @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> listByServiceAsync(final String resourceGroupName, final String serviceName, final String filter, final Integer top, final Integer skip, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByServiceSinglePageAsync(resourceGroupName, serviceName, filter, top, skip), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByServiceNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists a collection of all certificates in the specified service instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| subject | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| thumbprint | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| expirationDate | filter | ge, le, eq, ne, gt, lt | | </br> + * @param top Number of records to return. + * @param skip Number of records to skip. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<CertificateContractInner> object + */ + public Observable> listByServiceAsync(final String resourceGroupName, final String serviceName, final String filter, final Integer top, final Integer skip) { + return listByServiceWithServiceResponseAsync(resourceGroupName, serviceName, filter, top, skip) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists a collection of all certificates in the specified service instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| subject | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| thumbprint | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| expirationDate | filter | ge, le, eq, ne, gt, lt | | </br> + * @param top Number of records to return. + * @param skip Number of records to skip. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<CertificateContractInner> object + */ + public Observable>> listByServiceWithServiceResponseAsync(final String resourceGroupName, final String serviceName, final String filter, final Integer top, final Integer skip) { + return listByServiceSinglePageAsync(resourceGroupName, serviceName, filter, top, skip) + .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(listByServiceNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists a collection of all certificates in the specified service instance. + * + ServiceResponse> * @param resourceGroupName The name of the resource group. + ServiceResponse> * @param serviceName The name of the API Management service. + ServiceResponse> * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| subject | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| thumbprint | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| expirationDate | filter | ge, le, eq, ne, gt, lt | | </br> + ServiceResponse> * @param top Number of records to return. + ServiceResponse> * @param skip Number of records to skip. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<CertificateContractInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByServiceSinglePageAsync(final String resourceGroupName, final String serviceName, final String filter, final Integer top, final Integer skip) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + 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.listByService(resourceGroupName, serviceName, this.client.subscriptionId(), filter, top, skip, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByServiceDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByServiceDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Gets the entity state (Etag) version of the certificate specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param certificateId Identifier of the certificate entity. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void getEntityTag(String resourceGroupName, String serviceName, String certificateId) { + getEntityTagWithServiceResponseAsync(resourceGroupName, serviceName, certificateId).toBlocking().single().body(); + } + + /** + * Gets the entity state (Etag) version of the certificate specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param certificateId Identifier of the certificate entity. Must be unique in the current API Management service instance. + * @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 getEntityTagAsync(String resourceGroupName, String serviceName, String certificateId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(getEntityTagWithServiceResponseAsync(resourceGroupName, serviceName, certificateId), serviceCallback); + } + + /** + * Gets the entity state (Etag) version of the certificate specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param certificateId Identifier of the certificate entity. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public Observable getEntityTagAsync(String resourceGroupName, String serviceName, String certificateId) { + return getEntityTagWithServiceResponseAsync(resourceGroupName, serviceName, certificateId).map(new Func1, Void>() { + @Override + public Void call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Gets the entity state (Etag) version of the certificate specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param certificateId Identifier of the certificate entity. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public Observable> getEntityTagWithServiceResponseAsync(String resourceGroupName, String serviceName, String certificateId) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (certificateId == null) { + throw new IllegalArgumentException("Parameter certificateId is required and cannot be null."); + } + 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.getEntityTag(resourceGroupName, serviceName, certificateId, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = getEntityTagDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponseWithHeaders getEntityTagDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .buildEmptyWithHeaders(response, CertificateGetEntityTagHeaders.class); + } + + /** + * Gets the details of the certificate specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param certificateId Identifier of the certificate entity. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the CertificateContractInner object if successful. + */ + public CertificateContractInner get(String resourceGroupName, String serviceName, String certificateId) { + return getWithServiceResponseAsync(resourceGroupName, serviceName, certificateId).toBlocking().single().body(); + } + + /** + * Gets the details of the certificate specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param certificateId Identifier of the certificate entity. Must be unique in the current API Management service instance. + * @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 getAsync(String resourceGroupName, String serviceName, String certificateId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(getWithServiceResponseAsync(resourceGroupName, serviceName, certificateId), serviceCallback); + } + + /** + * Gets the details of the certificate specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param certificateId Identifier of the certificate entity. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the CertificateContractInner object + */ + public Observable getAsync(String resourceGroupName, String serviceName, String certificateId) { + return getWithServiceResponseAsync(resourceGroupName, serviceName, certificateId).map(new Func1, CertificateContractInner>() { + @Override + public CertificateContractInner call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Gets the details of the certificate specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param certificateId Identifier of the certificate entity. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the CertificateContractInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String serviceName, String certificateId) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (certificateId == null) { + throw new IllegalArgumentException("Parameter certificateId is required and cannot be null."); + } + 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.get(resourceGroupName, serviceName, certificateId, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = getDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponseWithHeaders getDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .buildWithHeaders(response, CertificateGetHeaders.class); + } + + /** + * Creates or updates the certificate being used for authentication with the backend. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param certificateId Identifier of the certificate entity. Must be unique in the current API Management service instance. + * @param parameters Create or Update parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the CertificateContractInner object if successful. + */ + public CertificateContractInner createOrUpdate(String resourceGroupName, String serviceName, String certificateId, CertificateCreateOrUpdateParameters parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serviceName, certificateId, parameters).toBlocking().single().body(); + } + + /** + * Creates or updates the certificate being used for authentication with the backend. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param certificateId Identifier of the certificate entity. Must be unique in the current API Management service instance. + * @param parameters Create or Update parameters. + * @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 createOrUpdateAsync(String resourceGroupName, String serviceName, String certificateId, CertificateCreateOrUpdateParameters parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, serviceName, certificateId, parameters), serviceCallback); + } + + /** + * Creates or updates the certificate being used for authentication with the backend. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param certificateId Identifier of the certificate entity. Must be unique in the current API Management service instance. + * @param parameters Create or Update parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the CertificateContractInner object + */ + public Observable createOrUpdateAsync(String resourceGroupName, String serviceName, String certificateId, CertificateCreateOrUpdateParameters parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serviceName, certificateId, parameters).map(new Func1, CertificateContractInner>() { + @Override + public CertificateContractInner call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Creates or updates the certificate being used for authentication with the backend. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param certificateId Identifier of the certificate entity. Must be unique in the current API Management service instance. + * @param parameters Create or Update parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the CertificateContractInner object + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String serviceName, String certificateId, CertificateCreateOrUpdateParameters parameters) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (certificateId == null) { + throw new IllegalArgumentException("Parameter certificateId is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(parameters); + final String ifMatch = null; + return service.createOrUpdate(resourceGroupName, serviceName, certificateId, this.client.subscriptionId(), parameters, ifMatch, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = createOrUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Creates or updates the certificate being used for authentication with the backend. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param certificateId Identifier of the certificate entity. Must be unique in the current API Management service instance. + * @param parameters Create or Update parameters. + * @param ifMatch ETag of the Entity. Not required when creating an entity, but required when updating an entity. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the CertificateContractInner object if successful. + */ + public CertificateContractInner createOrUpdate(String resourceGroupName, String serviceName, String certificateId, CertificateCreateOrUpdateParameters parameters, String ifMatch) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serviceName, certificateId, parameters, ifMatch).toBlocking().single().body(); + } + + /** + * Creates or updates the certificate being used for authentication with the backend. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param certificateId Identifier of the certificate entity. Must be unique in the current API Management service instance. + * @param parameters Create or Update parameters. + * @param ifMatch ETag of the Entity. Not required when creating an entity, but required when updating an entity. + * @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 createOrUpdateAsync(String resourceGroupName, String serviceName, String certificateId, CertificateCreateOrUpdateParameters parameters, String ifMatch, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, serviceName, certificateId, parameters, ifMatch), serviceCallback); + } + + /** + * Creates or updates the certificate being used for authentication with the backend. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param certificateId Identifier of the certificate entity. Must be unique in the current API Management service instance. + * @param parameters Create or Update parameters. + * @param ifMatch ETag of the Entity. Not required when creating an entity, but required when updating an entity. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the CertificateContractInner object + */ + public Observable createOrUpdateAsync(String resourceGroupName, String serviceName, String certificateId, CertificateCreateOrUpdateParameters parameters, String ifMatch) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serviceName, certificateId, parameters, ifMatch).map(new Func1, CertificateContractInner>() { + @Override + public CertificateContractInner call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Creates or updates the certificate being used for authentication with the backend. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param certificateId Identifier of the certificate entity. Must be unique in the current API Management service instance. + * @param parameters Create or Update parameters. + * @param ifMatch ETag of the Entity. Not required when creating an entity, but required when updating an entity. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the CertificateContractInner object + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String serviceName, String certificateId, CertificateCreateOrUpdateParameters parameters, String ifMatch) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (certificateId == null) { + throw new IllegalArgumentException("Parameter certificateId is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(parameters); + return service.createOrUpdate(resourceGroupName, serviceName, certificateId, this.client.subscriptionId(), parameters, ifMatch, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = createOrUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponseWithHeaders createOrUpdateDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(201, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .buildWithHeaders(response, CertificateCreateOrUpdateHeaders.class); + } + + /** + * Deletes specific certificate. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param certificateId Identifier of the certificate entity. Must be unique in the current API Management service instance. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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 serviceName, String certificateId, String ifMatch) { + deleteWithServiceResponseAsync(resourceGroupName, serviceName, certificateId, ifMatch).toBlocking().single().body(); + } + + /** + * Deletes specific certificate. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param certificateId Identifier of the certificate entity. Must be unique in the current API Management service instance. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @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 serviceName, String certificateId, String ifMatch, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, serviceName, certificateId, ifMatch), serviceCallback); + } + + /** + * Deletes specific certificate. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param certificateId Identifier of the certificate entity. Must be unique in the current API Management service instance. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable deleteAsync(String resourceGroupName, String serviceName, String certificateId, String ifMatch) { + return deleteWithServiceResponseAsync(resourceGroupName, serviceName, certificateId, ifMatch).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes specific certificate. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param certificateId Identifier of the certificate entity. Must be unique in the current API Management service instance. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> deleteWithServiceResponseAsync(String resourceGroupName, String serviceName, String certificateId, String ifMatch) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (certificateId == null) { + throw new IllegalArgumentException("Parameter certificateId is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (ifMatch == null) { + throw new IllegalArgumentException("Parameter ifMatch 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.delete(resourceGroupName, serviceName, certificateId, this.client.subscriptionId(), ifMatch, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = deleteDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse deleteDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(204, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists a collection of all certificates in the specified service instance. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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<CertificateContractInner> object if successful. + */ + public PagedList listByServiceNext(final String nextPageLink) { + ServiceResponse> response = listByServiceNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByServiceNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists a collection of all certificates in the specified service instance. + * + * @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> listByServiceNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByServiceNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByServiceNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists a collection of all certificates in the specified service instance. + * + * @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<CertificateContractInner> object + */ + public Observable> listByServiceNextAsync(final String nextPageLink) { + return listByServiceNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists a collection of all certificates in the specified service instance. + * + * @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<CertificateContractInner> object + */ + public Observable>> listByServiceNextWithServiceResponseAsync(final String nextPageLink) { + return listByServiceNextSinglePageAsync(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(listByServiceNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists a collection of all certificates in the specified service instance. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<CertificateContractInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByServiceNextSinglePageAsync(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.listByServiceNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByServiceNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByServiceNextDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/DelegationSettingsImpl.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/DelegationSettingsImpl.java new file mode 100644 index 0000000000000..d22ac21ef4d18 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/DelegationSettingsImpl.java @@ -0,0 +1,67 @@ +/** + * 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. + * abc + */ + +package com.microsoft.azure.management.apimanagement.v2019_01_01.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.apimanagement.v2019_01_01.DelegationSettings; +import rx.Completable; +import rx.functions.Func1; +import rx.Observable; +import com.microsoft.azure.management.apimanagement.v2019_01_01.PortalDelegationSettings; + +class DelegationSettingsImpl extends WrapperImpl implements DelegationSettings { + private final ApiManagementManager manager; + + DelegationSettingsImpl(ApiManagementManager manager) { + super(manager.inner().delegationSettings()); + this.manager = manager; + } + + public ApiManagementManager manager() { + return this.manager; + } + + @Override + public Completable getEntityTagAsync(String resourceGroupName, String serviceName) { + DelegationSettingsInner client = this.inner(); + return client.getEntityTagAsync(resourceGroupName, serviceName).toCompletable(); + } + + @Override + public Observable getAsync(String resourceGroupName, String serviceName) { + DelegationSettingsInner client = this.inner(); + return client.getAsync(resourceGroupName, serviceName) + .map(new Func1() { + @Override + public PortalDelegationSettings call(PortalDelegationSettingsInner inner) { + return new PortalDelegationSettingsImpl(inner, manager()); + } + }); + } + + @Override + public Completable updateAsync(String resourceGroupName, String serviceName, PortalDelegationSettingsInner parameters, String ifMatch) { + DelegationSettingsInner client = this.inner(); + return client.updateAsync(resourceGroupName, serviceName, parameters, ifMatch).toCompletable(); + } + + @Override + public Observable createOrUpdateAsync(String resourceGroupName, String serviceName, PortalDelegationSettingsInner parameters) { + DelegationSettingsInner client = this.inner(); + return client.createOrUpdateAsync(resourceGroupName, serviceName, parameters) + .map(new Func1() { + @Override + public PortalDelegationSettings call(PortalDelegationSettingsInner inner) { + return new PortalDelegationSettingsImpl(inner, manager()); + } + }); + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/DelegationSettingsInner.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/DelegationSettingsInner.java new file mode 100644 index 0000000000000..aec70c490e296 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/DelegationSettingsInner.java @@ -0,0 +1,537 @@ +/** + * 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.apimanagement.v2019_01_01.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.management.apimanagement.v2019_01_01.DelegationSettingsGetEntityTagHeaders; +import com.microsoft.azure.management.apimanagement.v2019_01_01.DelegationSettingsGetHeaders; +import com.microsoft.azure.management.apimanagement.v2019_01_01.ErrorResponseException; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import com.microsoft.rest.ServiceResponseWithHeaders; +import com.microsoft.rest.Validator; +import java.io.IOException; +import okhttp3.ResponseBody; +import retrofit2.http.Body; +import retrofit2.http.GET; +import retrofit2.http.HEAD; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.PATCH; +import retrofit2.http.Path; +import retrofit2.http.PUT; +import retrofit2.http.Query; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in DelegationSettings. + */ +public class DelegationSettingsInner { + /** The Retrofit service to perform REST calls. */ + private DelegationSettingsService service; + /** The service client containing this operation class. */ + private ApiManagementClientImpl client; + + /** + * Initializes an instance of DelegationSettingsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public DelegationSettingsInner(Retrofit retrofit, ApiManagementClientImpl client) { + this.service = retrofit.create(DelegationSettingsService.class); + this.client = client; + } + + /** + * The interface defining all the services for DelegationSettings to be + * used by Retrofit to perform actually REST calls. + */ + interface DelegationSettingsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.apimanagement.v2019_01_01.DelegationSettings getEntityTag" }) + @HEAD("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalsettings/delegation") + Observable> getEntityTag(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("subscriptionId") String subscriptionId, @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.apimanagement.v2019_01_01.DelegationSettings get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalsettings/delegation") + Observable> get(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("subscriptionId") String subscriptionId, @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.apimanagement.v2019_01_01.DelegationSettings update" }) + @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalsettings/delegation") + Observable> update(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("subscriptionId") String subscriptionId, @Body PortalDelegationSettingsInner parameters, @Header("If-Match") String ifMatch, @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.apimanagement.v2019_01_01.DelegationSettings createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalsettings/delegation") + Observable> createOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("subscriptionId") String subscriptionId, @Body PortalDelegationSettingsInner parameters, @Header("If-Match") String ifMatch, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Gets the entity state (Etag) version of the DelegationSettings. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void getEntityTag(String resourceGroupName, String serviceName) { + getEntityTagWithServiceResponseAsync(resourceGroupName, serviceName).toBlocking().single().body(); + } + + /** + * Gets the entity state (Etag) version of the DelegationSettings. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @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 getEntityTagAsync(String resourceGroupName, String serviceName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(getEntityTagWithServiceResponseAsync(resourceGroupName, serviceName), serviceCallback); + } + + /** + * Gets the entity state (Etag) version of the DelegationSettings. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public Observable getEntityTagAsync(String resourceGroupName, String serviceName) { + return getEntityTagWithServiceResponseAsync(resourceGroupName, serviceName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Gets the entity state (Etag) version of the DelegationSettings. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public Observable> getEntityTagWithServiceResponseAsync(String resourceGroupName, String serviceName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + 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.getEntityTag(resourceGroupName, serviceName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = getEntityTagDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponseWithHeaders getEntityTagDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .buildEmptyWithHeaders(response, DelegationSettingsGetEntityTagHeaders.class); + } + + /** + * Get Delegation Settings for the Portal. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PortalDelegationSettingsInner object if successful. + */ + public PortalDelegationSettingsInner get(String resourceGroupName, String serviceName) { + return getWithServiceResponseAsync(resourceGroupName, serviceName).toBlocking().single().body(); + } + + /** + * Get Delegation Settings for the Portal. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @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 getAsync(String resourceGroupName, String serviceName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(getWithServiceResponseAsync(resourceGroupName, serviceName), serviceCallback); + } + + /** + * Get Delegation Settings for the Portal. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PortalDelegationSettingsInner object + */ + public Observable getAsync(String resourceGroupName, String serviceName) { + return getWithServiceResponseAsync(resourceGroupName, serviceName).map(new Func1, PortalDelegationSettingsInner>() { + @Override + public PortalDelegationSettingsInner call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Get Delegation Settings for the Portal. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PortalDelegationSettingsInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String serviceName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + 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.get(resourceGroupName, serviceName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = getDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponseWithHeaders getDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .buildWithHeaders(response, DelegationSettingsGetHeaders.class); + } + + /** + * Update Delegation settings. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param parameters Update Delegation settings. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void update(String resourceGroupName, String serviceName, PortalDelegationSettingsInner parameters, String ifMatch) { + updateWithServiceResponseAsync(resourceGroupName, serviceName, parameters, ifMatch).toBlocking().single().body(); + } + + /** + * Update Delegation settings. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param parameters Update Delegation settings. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @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 serviceName, PortalDelegationSettingsInner parameters, String ifMatch, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateWithServiceResponseAsync(resourceGroupName, serviceName, parameters, ifMatch), serviceCallback); + } + + /** + * Update Delegation settings. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param parameters Update Delegation settings. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable updateAsync(String resourceGroupName, String serviceName, PortalDelegationSettingsInner parameters, String ifMatch) { + return updateWithServiceResponseAsync(resourceGroupName, serviceName, parameters, ifMatch).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Update Delegation settings. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param parameters Update Delegation settings. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> updateWithServiceResponseAsync(String resourceGroupName, String serviceName, PortalDelegationSettingsInner parameters, String ifMatch) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + if (ifMatch == null) { + throw new IllegalArgumentException("Parameter ifMatch is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(parameters); + return service.update(resourceGroupName, serviceName, this.client.subscriptionId(), parameters, ifMatch, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = updateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse updateDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(204, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Create or Update Delegation settings. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param parameters Create or update parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PortalDelegationSettingsInner object if successful. + */ + public PortalDelegationSettingsInner createOrUpdate(String resourceGroupName, String serviceName, PortalDelegationSettingsInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serviceName, parameters).toBlocking().single().body(); + } + + /** + * Create or Update Delegation settings. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param parameters Create or update parameters. + * @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 createOrUpdateAsync(String resourceGroupName, String serviceName, PortalDelegationSettingsInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, serviceName, parameters), serviceCallback); + } + + /** + * Create or Update Delegation settings. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param parameters Create or update parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PortalDelegationSettingsInner object + */ + public Observable createOrUpdateAsync(String resourceGroupName, String serviceName, PortalDelegationSettingsInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serviceName, parameters).map(new Func1, PortalDelegationSettingsInner>() { + @Override + public PortalDelegationSettingsInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Create or Update Delegation settings. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param parameters Create or update parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PortalDelegationSettingsInner object + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String serviceName, PortalDelegationSettingsInner parameters) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(parameters); + final String ifMatch = null; + return service.createOrUpdate(resourceGroupName, serviceName, this.client.subscriptionId(), parameters, ifMatch, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = createOrUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Create or Update Delegation settings. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param parameters Create or update parameters. + * @param ifMatch ETag of the Entity. Not required when creating an entity, but required when updating an entity. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PortalDelegationSettingsInner object if successful. + */ + public PortalDelegationSettingsInner createOrUpdate(String resourceGroupName, String serviceName, PortalDelegationSettingsInner parameters, String ifMatch) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serviceName, parameters, ifMatch).toBlocking().single().body(); + } + + /** + * Create or Update Delegation settings. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param parameters Create or update parameters. + * @param ifMatch ETag of the Entity. Not required when creating an entity, but required when updating an entity. + * @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 createOrUpdateAsync(String resourceGroupName, String serviceName, PortalDelegationSettingsInner parameters, String ifMatch, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, serviceName, parameters, ifMatch), serviceCallback); + } + + /** + * Create or Update Delegation settings. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param parameters Create or update parameters. + * @param ifMatch ETag of the Entity. Not required when creating an entity, but required when updating an entity. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PortalDelegationSettingsInner object + */ + public Observable createOrUpdateAsync(String resourceGroupName, String serviceName, PortalDelegationSettingsInner parameters, String ifMatch) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serviceName, parameters, ifMatch).map(new Func1, PortalDelegationSettingsInner>() { + @Override + public PortalDelegationSettingsInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Create or Update Delegation settings. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param parameters Create or update parameters. + * @param ifMatch ETag of the Entity. Not required when creating an entity, but required when updating an entity. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PortalDelegationSettingsInner object + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String serviceName, PortalDelegationSettingsInner parameters, String ifMatch) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(parameters); + return service.createOrUpdate(resourceGroupName, serviceName, this.client.subscriptionId(), parameters, ifMatch, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = createOrUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse createOrUpdateDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/DiagnosticContractImpl.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/DiagnosticContractImpl.java new file mode 100644 index 0000000000000..12343ca0bbb85 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/DiagnosticContractImpl.java @@ -0,0 +1,181 @@ +/** + * 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.apimanagement.v2019_01_01.implementation; + +import com.microsoft.azure.management.apimanagement.v2019_01_01.DiagnosticContract; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import com.microsoft.azure.management.apimanagement.v2019_01_01.AlwaysLog; +import com.microsoft.azure.management.apimanagement.v2019_01_01.SamplingSettings; +import com.microsoft.azure.management.apimanagement.v2019_01_01.PipelineDiagnosticSettings; + +class DiagnosticContractImpl extends CreatableUpdatableImpl implements DiagnosticContract, DiagnosticContract.Definition, DiagnosticContract.Update { + private String resourceGroupName; + private String serviceName; + private String diagnosticId; + private String cifMatch; + private String uifMatch; + private final ApiManagementManager manager; + + DiagnosticContractImpl(String name, ApiManagementManager manager) { + super(name, new DiagnosticContractInner()); + this.manager = manager; + // Set resource name + this.diagnosticId = name; + // + } + + DiagnosticContractImpl(DiagnosticContractInner inner, ApiManagementManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.diagnosticId = inner.name(); + // set resource ancestor and positional variables + this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourceGroups"); + this.serviceName = IdParsingUtils.getValueFromIdByName(inner.id(), "service"); + this.diagnosticId = IdParsingUtils.getValueFromIdByName(inner.id(), "diagnostics"); + // set other parameters for create and update + } + + @Override + public ApiManagementManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + DiagnosticsInner client = this.manager().inner().diagnostics(); + return client.createOrUpdateAsync(this.resourceGroupName, this.serviceName, this.diagnosticId, this.inner(), this.cifMatch) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + DiagnosticsInner client = this.manager().inner().diagnostics(); + return client.createOrUpdateAsync(this.resourceGroupName, this.serviceName, this.diagnosticId, this.inner(), this.uifMatch) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + DiagnosticsInner client = this.manager().inner().diagnostics(); + return null; // NOP getInnerAsync implementation as get is not supported + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + + @Override + public AlwaysLog alwaysLog() { + return this.inner().alwaysLog(); + } + + @Override + public PipelineDiagnosticSettings backend() { + return this.inner().backend(); + } + + @Override + public Boolean enableHttpCorrelationHeaders() { + return this.inner().enableHttpCorrelationHeaders(); + } + + @Override + public PipelineDiagnosticSettings frontend() { + return this.inner().frontend(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String loggerId() { + return this.inner().loggerId(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public SamplingSettings sampling() { + return this.inner().sampling(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public DiagnosticContractImpl withResourceGroupName(String resourceGroupName) { + this.resourceGroupName = resourceGroupName; + return this; + } + + @Override + public DiagnosticContractImpl withServiceName(String serviceName) { + this.serviceName = serviceName; + return this; + } + + @Override + public DiagnosticContractImpl withLoggerId(String loggerId) { + this.inner().withLoggerId(loggerId); + return this; + } + + @Override + public DiagnosticContractImpl withIfMatch(String ifMatch) { + if (isInCreateMode()) { + this.cifMatch = ifMatch; + } else { + this.uifMatch = ifMatch; + } + return this; + } + + @Override + public DiagnosticContractImpl withAlwaysLog(AlwaysLog alwaysLog) { + this.inner().withAlwaysLog(alwaysLog); + return this; + } + + @Override + public DiagnosticContractImpl withBackend(PipelineDiagnosticSettings backend) { + this.inner().withBackend(backend); + return this; + } + + @Override + public DiagnosticContractImpl withEnableHttpCorrelationHeaders(Boolean enableHttpCorrelationHeaders) { + this.inner().withEnableHttpCorrelationHeaders(enableHttpCorrelationHeaders); + return this; + } + + @Override + public DiagnosticContractImpl withFrontend(PipelineDiagnosticSettings frontend) { + this.inner().withFrontend(frontend); + return this; + } + + @Override + public DiagnosticContractImpl withSampling(SamplingSettings sampling) { + this.inner().withSampling(sampling); + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/DiagnosticContractInner.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/DiagnosticContractInner.java new file mode 100644 index 0000000000000..c242a36e9f51a --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/DiagnosticContractInner.java @@ -0,0 +1,181 @@ +/** + * 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.apimanagement.v2019_01_01.implementation; + +import com.microsoft.azure.management.apimanagement.v2019_01_01.AlwaysLog; +import com.microsoft.azure.management.apimanagement.v2019_01_01.SamplingSettings; +import com.microsoft.azure.management.apimanagement.v2019_01_01.PipelineDiagnosticSettings; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * Diagnostic details. + */ +@JsonFlatten +public class DiagnosticContractInner extends ProxyResource { + /** + * Specifies for what type of messages sampling settings should not apply. + * Possible values include: 'allErrors'. + */ + @JsonProperty(value = "properties.alwaysLog") + private AlwaysLog alwaysLog; + + /** + * Resource Id of a target logger. + */ + @JsonProperty(value = "properties.loggerId", required = true) + private String loggerId; + + /** + * Sampling settings for Diagnostic. + */ + @JsonProperty(value = "properties.sampling") + private SamplingSettings sampling; + + /** + * Diagnostic settings for incoming/outgoing HTTP messages to the Gateway. + */ + @JsonProperty(value = "properties.frontend") + private PipelineDiagnosticSettings frontend; + + /** + * Diagnostic settings for incoming/outgoing HTTP messages to the Backend. + */ + @JsonProperty(value = "properties.backend") + private PipelineDiagnosticSettings backend; + + /** + * Whether to process Correlation Headers coming to Api Management Service. + * Only applicable to Application Insights diagnostics. Default is true. + */ + @JsonProperty(value = "properties.enableHttpCorrelationHeaders") + private Boolean enableHttpCorrelationHeaders; + + /** + * Get specifies for what type of messages sampling settings should not apply. Possible values include: 'allErrors'. + * + * @return the alwaysLog value + */ + public AlwaysLog alwaysLog() { + return this.alwaysLog; + } + + /** + * Set specifies for what type of messages sampling settings should not apply. Possible values include: 'allErrors'. + * + * @param alwaysLog the alwaysLog value to set + * @return the DiagnosticContractInner object itself. + */ + public DiagnosticContractInner withAlwaysLog(AlwaysLog alwaysLog) { + this.alwaysLog = alwaysLog; + return this; + } + + /** + * Get resource Id of a target logger. + * + * @return the loggerId value + */ + public String loggerId() { + return this.loggerId; + } + + /** + * Set resource Id of a target logger. + * + * @param loggerId the loggerId value to set + * @return the DiagnosticContractInner object itself. + */ + public DiagnosticContractInner withLoggerId(String loggerId) { + this.loggerId = loggerId; + return this; + } + + /** + * Get sampling settings for Diagnostic. + * + * @return the sampling value + */ + public SamplingSettings sampling() { + return this.sampling; + } + + /** + * Set sampling settings for Diagnostic. + * + * @param sampling the sampling value to set + * @return the DiagnosticContractInner object itself. + */ + public DiagnosticContractInner withSampling(SamplingSettings sampling) { + this.sampling = sampling; + return this; + } + + /** + * Get diagnostic settings for incoming/outgoing HTTP messages to the Gateway. + * + * @return the frontend value + */ + public PipelineDiagnosticSettings frontend() { + return this.frontend; + } + + /** + * Set diagnostic settings for incoming/outgoing HTTP messages to the Gateway. + * + * @param frontend the frontend value to set + * @return the DiagnosticContractInner object itself. + */ + public DiagnosticContractInner withFrontend(PipelineDiagnosticSettings frontend) { + this.frontend = frontend; + return this; + } + + /** + * Get diagnostic settings for incoming/outgoing HTTP messages to the Backend. + * + * @return the backend value + */ + public PipelineDiagnosticSettings backend() { + return this.backend; + } + + /** + * Set diagnostic settings for incoming/outgoing HTTP messages to the Backend. + * + * @param backend the backend value to set + * @return the DiagnosticContractInner object itself. + */ + public DiagnosticContractInner withBackend(PipelineDiagnosticSettings backend) { + this.backend = backend; + return this; + } + + /** + * Get whether to process Correlation Headers coming to Api Management Service. Only applicable to Application Insights diagnostics. Default is true. + * + * @return the enableHttpCorrelationHeaders value + */ + public Boolean enableHttpCorrelationHeaders() { + return this.enableHttpCorrelationHeaders; + } + + /** + * Set whether to process Correlation Headers coming to Api Management Service. Only applicable to Application Insights diagnostics. Default is true. + * + * @param enableHttpCorrelationHeaders the enableHttpCorrelationHeaders value to set + * @return the DiagnosticContractInner object itself. + */ + public DiagnosticContractInner withEnableHttpCorrelationHeaders(Boolean enableHttpCorrelationHeaders) { + this.enableHttpCorrelationHeaders = enableHttpCorrelationHeaders; + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/DiagnosticsImpl.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/DiagnosticsImpl.java new file mode 100644 index 0000000000000..a981df1d749ab --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/DiagnosticsImpl.java @@ -0,0 +1,87 @@ +/** + * 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. + * jkl + */ + +package com.microsoft.azure.management.apimanagement.v2019_01_01.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.apimanagement.v2019_01_01.Diagnostics; +import rx.Completable; +import rx.functions.Func1; +import rx.Observable; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.apimanagement.v2019_01_01.ApiDiagnosticContract; + +class DiagnosticsImpl extends WrapperImpl implements Diagnostics { + private final ApiManagementManager manager; + + DiagnosticsImpl(ApiManagementManager manager) { + super(manager.inner().diagnostics()); + this.manager = manager; + } + + public ApiManagementManager manager() { + return this.manager; + } + + @Override + public DiagnosticContractImpl define(String name) { + return wrapModel(name); + } + + private DiagnosticContractImpl wrapModel(DiagnosticContractInner inner) { + return new DiagnosticContractImpl(inner, manager()); + } + + private DiagnosticContractImpl wrapModel(String name) { + return new DiagnosticContractImpl(name, this.manager()); + } + + @Override + public Observable listByServiceAsync(final String resourceGroupName, final String serviceName) { + DiagnosticsInner client = this.inner(); + return client.listByServiceAsync(resourceGroupName, serviceName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public ApiDiagnosticContract call(DiagnosticContractInner inner) { + return new ApiDiagnosticContractImpl(inner, manager()); + } + }); + } + + @Override + public Completable getEntityTagAsync(String resourceGroupName, String serviceName, String diagnosticId) { + DiagnosticsInner client = this.inner(); + return client.getEntityTagAsync(resourceGroupName, serviceName, diagnosticId).toCompletable(); + } + + @Override + public Observable getAsync(String resourceGroupName, String serviceName, String diagnosticId) { + DiagnosticsInner client = this.inner(); + return client.getAsync(resourceGroupName, serviceName, diagnosticId) + .map(new Func1() { + @Override + public ApiDiagnosticContract call(DiagnosticContractInner inner) { + return new ApiDiagnosticContractImpl(inner, manager()); + } + }); + } + + @Override + public Completable deleteAsync(String resourceGroupName, String serviceName, String diagnosticId, String ifMatch) { + DiagnosticsInner client = this.inner(); + return client.deleteAsync(resourceGroupName, serviceName, diagnosticId, ifMatch).toCompletable(); + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/DiagnosticsInner.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/DiagnosticsInner.java new file mode 100644 index 0000000000000..69573bee84b18 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/DiagnosticsInner.java @@ -0,0 +1,1061 @@ +/** + * 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.apimanagement.v2019_01_01.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.apimanagement.v2019_01_01.DiagnosticCreateOrUpdateHeaders; +import com.microsoft.azure.management.apimanagement.v2019_01_01.DiagnosticGetEntityTagHeaders; +import com.microsoft.azure.management.apimanagement.v2019_01_01.DiagnosticGetHeaders; +import com.microsoft.azure.management.apimanagement.v2019_01_01.ErrorResponseException; +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.ServiceResponseWithHeaders; +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.HEAD; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.HTTP; +import retrofit2.http.PATCH; +import retrofit2.http.Path; +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 Diagnostics. + */ +public class DiagnosticsInner { + /** The Retrofit service to perform REST calls. */ + private DiagnosticsService service; + /** The service client containing this operation class. */ + private ApiManagementClientImpl client; + + /** + * Initializes an instance of DiagnosticsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public DiagnosticsInner(Retrofit retrofit, ApiManagementClientImpl client) { + this.service = retrofit.create(DiagnosticsService.class); + this.client = client; + } + + /** + * The interface defining all the services for Diagnostics to be + * used by Retrofit to perform actually REST calls. + */ + interface DiagnosticsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.apimanagement.v2019_01_01.Diagnostics listByService" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/diagnostics") + Observable> listByService(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("subscriptionId") String subscriptionId, @Query("$filter") String filter, @Query("$top") Integer top, @Query("$skip") Integer skip, @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.apimanagement.v2019_01_01.Diagnostics getEntityTag" }) + @HEAD("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/diagnostics/{diagnosticId}") + Observable> getEntityTag(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("diagnosticId") String diagnosticId, @Path("subscriptionId") String subscriptionId, @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.apimanagement.v2019_01_01.Diagnostics get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/diagnostics/{diagnosticId}") + Observable> get(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("diagnosticId") String diagnosticId, @Path("subscriptionId") String subscriptionId, @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.apimanagement.v2019_01_01.Diagnostics createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/diagnostics/{diagnosticId}") + Observable> createOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("diagnosticId") String diagnosticId, @Path("subscriptionId") String subscriptionId, @Body DiagnosticContractInner parameters, @Header("If-Match") String ifMatch, @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.apimanagement.v2019_01_01.Diagnostics update" }) + @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/diagnostics/{diagnosticId}") + Observable> update(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("diagnosticId") String diagnosticId, @Path("subscriptionId") String subscriptionId, @Body DiagnosticContractInner parameters, @Header("If-Match") String ifMatch, @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.apimanagement.v2019_01_01.Diagnostics delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/diagnostics/{diagnosticId}", method = "DELETE", hasBody = true) + Observable> delete(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("diagnosticId") String diagnosticId, @Path("subscriptionId") String subscriptionId, @Header("If-Match") String ifMatch, @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.apimanagement.v2019_01_01.Diagnostics listByServiceNext" }) + @GET + Observable> listByServiceNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Lists all diagnostics of the API Management service instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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<DiagnosticContractInner> object if successful. + */ + public PagedList listByService(final String resourceGroupName, final String serviceName) { + ServiceResponse> response = listByServiceSinglePageAsync(resourceGroupName, serviceName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByServiceNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists all diagnostics of the API Management service instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @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> listByServiceAsync(final String resourceGroupName, final String serviceName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByServiceSinglePageAsync(resourceGroupName, serviceName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByServiceNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists all diagnostics of the API Management service instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<DiagnosticContractInner> object + */ + public Observable> listByServiceAsync(final String resourceGroupName, final String serviceName) { + return listByServiceWithServiceResponseAsync(resourceGroupName, serviceName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all diagnostics of the API Management service instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<DiagnosticContractInner> object + */ + public Observable>> listByServiceWithServiceResponseAsync(final String resourceGroupName, final String serviceName) { + return listByServiceSinglePageAsync(resourceGroupName, serviceName) + .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(listByServiceNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists all diagnostics of the API Management service instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<DiagnosticContractInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByServiceSinglePageAsync(final String resourceGroupName, final String serviceName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + 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 filter = null; + final Integer top = null; + final Integer skip = null; + return service.listByService(resourceGroupName, serviceName, this.client.subscriptionId(), filter, top, skip, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByServiceDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Lists all diagnostics of the API Management service instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br> + * @param top Number of records to return. + * @param skip Number of records to skip. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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<DiagnosticContractInner> object if successful. + */ + public PagedList listByService(final String resourceGroupName, final String serviceName, final String filter, final Integer top, final Integer skip) { + ServiceResponse> response = listByServiceSinglePageAsync(resourceGroupName, serviceName, filter, top, skip).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByServiceNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists all diagnostics of the API Management service instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br> + * @param top Number of records to return. + * @param skip Number of records to skip. + * @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> listByServiceAsync(final String resourceGroupName, final String serviceName, final String filter, final Integer top, final Integer skip, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByServiceSinglePageAsync(resourceGroupName, serviceName, filter, top, skip), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByServiceNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists all diagnostics of the API Management service instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br> + * @param top Number of records to return. + * @param skip Number of records to skip. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<DiagnosticContractInner> object + */ + public Observable> listByServiceAsync(final String resourceGroupName, final String serviceName, final String filter, final Integer top, final Integer skip) { + return listByServiceWithServiceResponseAsync(resourceGroupName, serviceName, filter, top, skip) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all diagnostics of the API Management service instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br> + * @param top Number of records to return. + * @param skip Number of records to skip. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<DiagnosticContractInner> object + */ + public Observable>> listByServiceWithServiceResponseAsync(final String resourceGroupName, final String serviceName, final String filter, final Integer top, final Integer skip) { + return listByServiceSinglePageAsync(resourceGroupName, serviceName, filter, top, skip) + .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(listByServiceNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists all diagnostics of the API Management service instance. + * + ServiceResponse> * @param resourceGroupName The name of the resource group. + ServiceResponse> * @param serviceName The name of the API Management service. + ServiceResponse> * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br> + ServiceResponse> * @param top Number of records to return. + ServiceResponse> * @param skip Number of records to skip. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<DiagnosticContractInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByServiceSinglePageAsync(final String resourceGroupName, final String serviceName, final String filter, final Integer top, final Integer skip) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + 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.listByService(resourceGroupName, serviceName, this.client.subscriptionId(), filter, top, skip, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByServiceDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByServiceDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Gets the entity state (Etag) version of the Diagnostic specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param diagnosticId Diagnostic identifier. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void getEntityTag(String resourceGroupName, String serviceName, String diagnosticId) { + getEntityTagWithServiceResponseAsync(resourceGroupName, serviceName, diagnosticId).toBlocking().single().body(); + } + + /** + * Gets the entity state (Etag) version of the Diagnostic specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param diagnosticId Diagnostic identifier. Must be unique in the current API Management service instance. + * @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 getEntityTagAsync(String resourceGroupName, String serviceName, String diagnosticId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(getEntityTagWithServiceResponseAsync(resourceGroupName, serviceName, diagnosticId), serviceCallback); + } + + /** + * Gets the entity state (Etag) version of the Diagnostic specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param diagnosticId Diagnostic identifier. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public Observable getEntityTagAsync(String resourceGroupName, String serviceName, String diagnosticId) { + return getEntityTagWithServiceResponseAsync(resourceGroupName, serviceName, diagnosticId).map(new Func1, Void>() { + @Override + public Void call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Gets the entity state (Etag) version of the Diagnostic specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param diagnosticId Diagnostic identifier. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public Observable> getEntityTagWithServiceResponseAsync(String resourceGroupName, String serviceName, String diagnosticId) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (diagnosticId == null) { + throw new IllegalArgumentException("Parameter diagnosticId is required and cannot be null."); + } + 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.getEntityTag(resourceGroupName, serviceName, diagnosticId, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = getEntityTagDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponseWithHeaders getEntityTagDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .buildEmptyWithHeaders(response, DiagnosticGetEntityTagHeaders.class); + } + + /** + * Gets the details of the Diagnostic specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param diagnosticId Diagnostic identifier. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the DiagnosticContractInner object if successful. + */ + public DiagnosticContractInner get(String resourceGroupName, String serviceName, String diagnosticId) { + return getWithServiceResponseAsync(resourceGroupName, serviceName, diagnosticId).toBlocking().single().body(); + } + + /** + * Gets the details of the Diagnostic specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param diagnosticId Diagnostic identifier. Must be unique in the current API Management service instance. + * @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 getAsync(String resourceGroupName, String serviceName, String diagnosticId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(getWithServiceResponseAsync(resourceGroupName, serviceName, diagnosticId), serviceCallback); + } + + /** + * Gets the details of the Diagnostic specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param diagnosticId Diagnostic identifier. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DiagnosticContractInner object + */ + public Observable getAsync(String resourceGroupName, String serviceName, String diagnosticId) { + return getWithServiceResponseAsync(resourceGroupName, serviceName, diagnosticId).map(new Func1, DiagnosticContractInner>() { + @Override + public DiagnosticContractInner call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Gets the details of the Diagnostic specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param diagnosticId Diagnostic identifier. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DiagnosticContractInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String serviceName, String diagnosticId) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (diagnosticId == null) { + throw new IllegalArgumentException("Parameter diagnosticId is required and cannot be null."); + } + 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.get(resourceGroupName, serviceName, diagnosticId, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = getDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponseWithHeaders getDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .buildWithHeaders(response, DiagnosticGetHeaders.class); + } + + /** + * Creates a new Diagnostic or updates an existing one. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param diagnosticId Diagnostic identifier. Must be unique in the current API Management service instance. + * @param parameters Create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the DiagnosticContractInner object if successful. + */ + public DiagnosticContractInner createOrUpdate(String resourceGroupName, String serviceName, String diagnosticId, DiagnosticContractInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serviceName, diagnosticId, parameters).toBlocking().single().body(); + } + + /** + * Creates a new Diagnostic or updates an existing one. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param diagnosticId Diagnostic identifier. Must be unique in the current API Management service instance. + * @param parameters Create parameters. + * @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 createOrUpdateAsync(String resourceGroupName, String serviceName, String diagnosticId, DiagnosticContractInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, serviceName, diagnosticId, parameters), serviceCallback); + } + + /** + * Creates a new Diagnostic or updates an existing one. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param diagnosticId Diagnostic identifier. Must be unique in the current API Management service instance. + * @param parameters Create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DiagnosticContractInner object + */ + public Observable createOrUpdateAsync(String resourceGroupName, String serviceName, String diagnosticId, DiagnosticContractInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serviceName, diagnosticId, parameters).map(new Func1, DiagnosticContractInner>() { + @Override + public DiagnosticContractInner call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Creates a new Diagnostic or updates an existing one. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param diagnosticId Diagnostic identifier. Must be unique in the current API Management service instance. + * @param parameters Create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DiagnosticContractInner object + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String serviceName, String diagnosticId, DiagnosticContractInner parameters) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (diagnosticId == null) { + throw new IllegalArgumentException("Parameter diagnosticId is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(parameters); + final String ifMatch = null; + return service.createOrUpdate(resourceGroupName, serviceName, diagnosticId, this.client.subscriptionId(), parameters, ifMatch, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = createOrUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Creates a new Diagnostic or updates an existing one. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param diagnosticId Diagnostic identifier. Must be unique in the current API Management service instance. + * @param parameters Create parameters. + * @param ifMatch ETag of the Entity. Not required when creating an entity, but required when updating an entity. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the DiagnosticContractInner object if successful. + */ + public DiagnosticContractInner createOrUpdate(String resourceGroupName, String serviceName, String diagnosticId, DiagnosticContractInner parameters, String ifMatch) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serviceName, diagnosticId, parameters, ifMatch).toBlocking().single().body(); + } + + /** + * Creates a new Diagnostic or updates an existing one. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param diagnosticId Diagnostic identifier. Must be unique in the current API Management service instance. + * @param parameters Create parameters. + * @param ifMatch ETag of the Entity. Not required when creating an entity, but required when updating an entity. + * @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 createOrUpdateAsync(String resourceGroupName, String serviceName, String diagnosticId, DiagnosticContractInner parameters, String ifMatch, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, serviceName, diagnosticId, parameters, ifMatch), serviceCallback); + } + + /** + * Creates a new Diagnostic or updates an existing one. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param diagnosticId Diagnostic identifier. Must be unique in the current API Management service instance. + * @param parameters Create parameters. + * @param ifMatch ETag of the Entity. Not required when creating an entity, but required when updating an entity. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DiagnosticContractInner object + */ + public Observable createOrUpdateAsync(String resourceGroupName, String serviceName, String diagnosticId, DiagnosticContractInner parameters, String ifMatch) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serviceName, diagnosticId, parameters, ifMatch).map(new Func1, DiagnosticContractInner>() { + @Override + public DiagnosticContractInner call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Creates a new Diagnostic or updates an existing one. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param diagnosticId Diagnostic identifier. Must be unique in the current API Management service instance. + * @param parameters Create parameters. + * @param ifMatch ETag of the Entity. Not required when creating an entity, but required when updating an entity. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DiagnosticContractInner object + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String serviceName, String diagnosticId, DiagnosticContractInner parameters, String ifMatch) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (diagnosticId == null) { + throw new IllegalArgumentException("Parameter diagnosticId is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(parameters); + return service.createOrUpdate(resourceGroupName, serviceName, diagnosticId, this.client.subscriptionId(), parameters, ifMatch, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = createOrUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponseWithHeaders createOrUpdateDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(201, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .buildWithHeaders(response, DiagnosticCreateOrUpdateHeaders.class); + } + + /** + * Updates the details of the Diagnostic specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param diagnosticId Diagnostic identifier. Must be unique in the current API Management service instance. + * @param parameters Diagnostic Update parameters. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void update(String resourceGroupName, String serviceName, String diagnosticId, DiagnosticContractInner parameters, String ifMatch) { + updateWithServiceResponseAsync(resourceGroupName, serviceName, diagnosticId, parameters, ifMatch).toBlocking().single().body(); + } + + /** + * Updates the details of the Diagnostic specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param diagnosticId Diagnostic identifier. Must be unique in the current API Management service instance. + * @param parameters Diagnostic Update parameters. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @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 serviceName, String diagnosticId, DiagnosticContractInner parameters, String ifMatch, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateWithServiceResponseAsync(resourceGroupName, serviceName, diagnosticId, parameters, ifMatch), serviceCallback); + } + + /** + * Updates the details of the Diagnostic specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param diagnosticId Diagnostic identifier. Must be unique in the current API Management service instance. + * @param parameters Diagnostic Update parameters. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable updateAsync(String resourceGroupName, String serviceName, String diagnosticId, DiagnosticContractInner parameters, String ifMatch) { + return updateWithServiceResponseAsync(resourceGroupName, serviceName, diagnosticId, parameters, ifMatch).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates the details of the Diagnostic specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param diagnosticId Diagnostic identifier. Must be unique in the current API Management service instance. + * @param parameters Diagnostic Update parameters. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> updateWithServiceResponseAsync(String resourceGroupName, String serviceName, String diagnosticId, DiagnosticContractInner parameters, String ifMatch) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (diagnosticId == null) { + throw new IllegalArgumentException("Parameter diagnosticId is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + if (ifMatch == null) { + throw new IllegalArgumentException("Parameter ifMatch is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(parameters); + return service.update(resourceGroupName, serviceName, diagnosticId, this.client.subscriptionId(), parameters, ifMatch, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = updateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse updateDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(204, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Deletes the specified Diagnostic. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param diagnosticId Diagnostic identifier. Must be unique in the current API Management service instance. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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 serviceName, String diagnosticId, String ifMatch) { + deleteWithServiceResponseAsync(resourceGroupName, serviceName, diagnosticId, ifMatch).toBlocking().single().body(); + } + + /** + * Deletes the specified Diagnostic. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param diagnosticId Diagnostic identifier. Must be unique in the current API Management service instance. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @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 serviceName, String diagnosticId, String ifMatch, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, serviceName, diagnosticId, ifMatch), serviceCallback); + } + + /** + * Deletes the specified Diagnostic. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param diagnosticId Diagnostic identifier. Must be unique in the current API Management service instance. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable deleteAsync(String resourceGroupName, String serviceName, String diagnosticId, String ifMatch) { + return deleteWithServiceResponseAsync(resourceGroupName, serviceName, diagnosticId, ifMatch).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes the specified Diagnostic. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param diagnosticId Diagnostic identifier. Must be unique in the current API Management service instance. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> deleteWithServiceResponseAsync(String resourceGroupName, String serviceName, String diagnosticId, String ifMatch) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (diagnosticId == null) { + throw new IllegalArgumentException("Parameter diagnosticId is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (ifMatch == null) { + throw new IllegalArgumentException("Parameter ifMatch 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.delete(resourceGroupName, serviceName, diagnosticId, this.client.subscriptionId(), ifMatch, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = deleteDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse deleteDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(204, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists all diagnostics of the API Management service instance. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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<DiagnosticContractInner> object if successful. + */ + public PagedList listByServiceNext(final String nextPageLink) { + ServiceResponse> response = listByServiceNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByServiceNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists all diagnostics of the API Management service instance. + * + * @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> listByServiceNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByServiceNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByServiceNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists all diagnostics of the API Management service instance. + * + * @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<DiagnosticContractInner> object + */ + public Observable> listByServiceNextAsync(final String nextPageLink) { + return listByServiceNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all diagnostics of the API Management service instance. + * + * @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<DiagnosticContractInner> object + */ + public Observable>> listByServiceNextWithServiceResponseAsync(final String nextPageLink) { + return listByServiceNextSinglePageAsync(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(listByServiceNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists all diagnostics of the API Management service instance. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<DiagnosticContractInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByServiceNextSinglePageAsync(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.listByServiceNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByServiceNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByServiceNextDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/EmailTemplateContractImpl.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/EmailTemplateContractImpl.java new file mode 100644 index 0000000000000..b21f96c32d76d --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/EmailTemplateContractImpl.java @@ -0,0 +1,197 @@ +/** + * 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.apimanagement.v2019_01_01.implementation; + +import com.microsoft.azure.management.apimanagement.v2019_01_01.EmailTemplateContract; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import com.microsoft.azure.management.apimanagement.v2019_01_01.EmailTemplateUpdateParameters; +import java.util.List; +import com.microsoft.azure.management.apimanagement.v2019_01_01.TemplateName; +import com.microsoft.azure.management.apimanagement.v2019_01_01.EmailTemplateParametersContractProperties; +import rx.functions.Func1; + +class EmailTemplateContractImpl extends CreatableUpdatableImpl implements EmailTemplateContract, EmailTemplateContract.Definition, EmailTemplateContract.Update { + private String resourceGroupName; + private String serviceName; + private TemplateName templateName; + private String cifMatch; + private String uifMatch; + private EmailTemplateUpdateParameters createOrUpdateParameter; + private final ApiManagementManager manager; + + EmailTemplateContractImpl(String name, ApiManagementManager manager) { + super(name, new EmailTemplateContractInner()); + this.manager = manager; + // Set resource name + this.templateName = TemplateName.fromString(name); + // + this.createOrUpdateParameter = new EmailTemplateUpdateParameters(); + } + + EmailTemplateContractImpl(EmailTemplateContractInner inner, ApiManagementManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.templateName = TemplateName.fromString(inner.name()); + // set resource ancestor and positional variables + this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourceGroups"); + this.serviceName = IdParsingUtils.getValueFromIdByName(inner.id(), "service"); + this.templateName = TemplateName.fromString(IdParsingUtils.getValueFromIdByName(inner.id(), "templates")); + // set other parameters for create and update + this.createOrUpdateParameter = new EmailTemplateUpdateParameters(); + } + + @Override + public ApiManagementManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + EmailTemplatesInner client = this.manager().inner().emailTemplates(); + return client.createOrUpdateAsync(this.resourceGroupName, this.serviceName, this.templateName, this.createOrUpdateParameter, this.cifMatch) + .map(new Func1() { + @Override + public EmailTemplateContractInner call(EmailTemplateContractInner resource) { + resetCreateUpdateParameters(); + return resource; + } + }) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + EmailTemplatesInner client = this.manager().inner().emailTemplates(); + return client.createOrUpdateAsync(this.resourceGroupName, this.serviceName, this.templateName, this.createOrUpdateParameter, this.uifMatch) + .map(new Func1() { + @Override + public EmailTemplateContractInner call(EmailTemplateContractInner resource) { + resetCreateUpdateParameters(); + return resource; + } + }) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + EmailTemplatesInner client = this.manager().inner().emailTemplates(); + return null; // NOP getInnerAsync implementation as get is not supported + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + private void resetCreateUpdateParameters() { + this.createOrUpdateParameter = new EmailTemplateUpdateParameters(); + } + + @Override + public String body() { + return this.inner().body(); + } + + @Override + public String description() { + return this.inner().description(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public Boolean isDefault() { + return this.inner().isDefault(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public List parameters() { + return this.inner().parameters(); + } + + @Override + public String subject() { + return this.inner().subject(); + } + + @Override + public String title() { + return this.inner().title(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public EmailTemplateContractImpl withResourceGroupName(String resourceGroupName) { + this.resourceGroupName = resourceGroupName; + return this; + } + + @Override + public EmailTemplateContractImpl withServiceName(String serviceName) { + this.serviceName = serviceName; + return this; + } + + @Override + public EmailTemplateContractImpl withIfMatch(String ifMatch) { + if (isInCreateMode()) { + this.cifMatch = ifMatch; + } else { + this.uifMatch = ifMatch; + } + return this; + } + + @Override + public EmailTemplateContractImpl withBody(String body) { + this.createOrUpdateParameter.withBody(body); + return this; + } + + @Override + public EmailTemplateContractImpl withDescription(String description) { + this.createOrUpdateParameter.withDescription(description); + return this; + } + + @Override + public EmailTemplateContractImpl withParameters(List parameters) { + this.createOrUpdateParameter.withParameters(parameters); + return this; + } + + @Override + public EmailTemplateContractImpl withSubject(String subject) { + this.createOrUpdateParameter.withSubject(subject); + return this; + } + + @Override + public EmailTemplateContractImpl withTitle(String title) { + this.createOrUpdateParameter.withTitle(title); + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/EmailTemplateContractInner.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/EmailTemplateContractInner.java new file mode 100644 index 0000000000000..653d746501c57 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/EmailTemplateContractInner.java @@ -0,0 +1,168 @@ +/** + * 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.apimanagement.v2019_01_01.implementation; + +import java.util.List; +import com.microsoft.azure.management.apimanagement.v2019_01_01.EmailTemplateParametersContractProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * Email Template details. + */ +@JsonFlatten +public class EmailTemplateContractInner extends ProxyResource { + /** + * Subject of the Template. + */ + @JsonProperty(value = "properties.subject", required = true) + private String subject; + + /** + * Email Template Body. This should be a valid XDocument. + */ + @JsonProperty(value = "properties.body", required = true) + private String body; + + /** + * Title of the Template. + */ + @JsonProperty(value = "properties.title") + private String title; + + /** + * Description of the Email Template. + */ + @JsonProperty(value = "properties.description") + private String description; + + /** + * Whether the template is the default template provided by Api Management + * or has been edited. + */ + @JsonProperty(value = "properties.isDefault", access = JsonProperty.Access.WRITE_ONLY) + private Boolean isDefault; + + /** + * Email Template Parameter values. + */ + @JsonProperty(value = "properties.parameters") + private List parameters; + + /** + * Get subject of the Template. + * + * @return the subject value + */ + public String subject() { + return this.subject; + } + + /** + * Set subject of the Template. + * + * @param subject the subject value to set + * @return the EmailTemplateContractInner object itself. + */ + public EmailTemplateContractInner withSubject(String subject) { + this.subject = subject; + return this; + } + + /** + * Get email Template Body. This should be a valid XDocument. + * + * @return the body value + */ + public String body() { + return this.body; + } + + /** + * Set email Template Body. This should be a valid XDocument. + * + * @param body the body value to set + * @return the EmailTemplateContractInner object itself. + */ + public EmailTemplateContractInner withBody(String body) { + this.body = body; + return this; + } + + /** + * Get title of the Template. + * + * @return the title value + */ + public String title() { + return this.title; + } + + /** + * Set title of the Template. + * + * @param title the title value to set + * @return the EmailTemplateContractInner object itself. + */ + public EmailTemplateContractInner withTitle(String title) { + this.title = title; + return this; + } + + /** + * Get description of the Email Template. + * + * @return the description value + */ + public String description() { + return this.description; + } + + /** + * Set description of the Email Template. + * + * @param description the description value to set + * @return the EmailTemplateContractInner object itself. + */ + public EmailTemplateContractInner withDescription(String description) { + this.description = description; + return this; + } + + /** + * Get whether the template is the default template provided by Api Management or has been edited. + * + * @return the isDefault value + */ + public Boolean isDefault() { + return this.isDefault; + } + + /** + * Get email Template Parameter values. + * + * @return the parameters value + */ + public List parameters() { + return this.parameters; + } + + /** + * Set email Template Parameter values. + * + * @param parameters the parameters value to set + * @return the EmailTemplateContractInner object itself. + */ + public EmailTemplateContractInner withParameters(List parameters) { + this.parameters = parameters; + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/EmailTemplatesImpl.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/EmailTemplatesImpl.java new file mode 100644 index 0000000000000..f716029d1d8fa --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/EmailTemplatesImpl.java @@ -0,0 +1,88 @@ +/** + * 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. + * jkl + */ + +package com.microsoft.azure.management.apimanagement.v2019_01_01.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.apimanagement.v2019_01_01.EmailTemplates; +import rx.Completable; +import rx.functions.Func1; +import rx.Observable; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.apimanagement.v2019_01_01.EmailTemplateContract; +import com.microsoft.azure.management.apimanagement.v2019_01_01.TemplateName; + +class EmailTemplatesImpl extends WrapperImpl implements EmailTemplates { + private final ApiManagementManager manager; + + EmailTemplatesImpl(ApiManagementManager manager) { + super(manager.inner().emailTemplates()); + this.manager = manager; + } + + public ApiManagementManager manager() { + return this.manager; + } + + @Override + public EmailTemplateContractImpl define(String name) { + return wrapModel(name); + } + + private EmailTemplateContractImpl wrapModel(EmailTemplateContractInner inner) { + return new EmailTemplateContractImpl(inner, manager()); + } + + private EmailTemplateContractImpl wrapModel(String name) { + return new EmailTemplateContractImpl(name, this.manager()); + } + + @Override + public Observable listByServiceAsync(final String resourceGroupName, final String serviceName) { + EmailTemplatesInner client = this.inner(); + return client.listByServiceAsync(resourceGroupName, serviceName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public EmailTemplateContract call(EmailTemplateContractInner inner) { + return new EmailTemplateContractImpl(inner, manager()); + } + }); + } + + @Override + public Completable getEntityTagAsync(String resourceGroupName, String serviceName, TemplateName templateName) { + EmailTemplatesInner client = this.inner(); + return client.getEntityTagAsync(resourceGroupName, serviceName, templateName).toCompletable(); + } + + @Override + public Observable getAsync(String resourceGroupName, String serviceName, TemplateName templateName) { + EmailTemplatesInner client = this.inner(); + return client.getAsync(resourceGroupName, serviceName, templateName) + .map(new Func1() { + @Override + public EmailTemplateContract call(EmailTemplateContractInner inner) { + return new EmailTemplateContractImpl(inner, manager()); + } + }); + } + + @Override + public Completable deleteAsync(String resourceGroupName, String serviceName, TemplateName templateName, String ifMatch) { + EmailTemplatesInner client = this.inner(); + return client.deleteAsync(resourceGroupName, serviceName, templateName, ifMatch).toCompletable(); + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/EmailTemplatesInner.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/EmailTemplatesInner.java new file mode 100644 index 0000000000000..b37ec5037b63b --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/EmailTemplatesInner.java @@ -0,0 +1,1062 @@ +/** + * 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.apimanagement.v2019_01_01.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.apimanagement.v2019_01_01.EmailTemplateGetEntityTagHeaders; +import com.microsoft.azure.management.apimanagement.v2019_01_01.EmailTemplateGetHeaders; +import com.microsoft.azure.management.apimanagement.v2019_01_01.EmailTemplateUpdateParameters; +import com.microsoft.azure.management.apimanagement.v2019_01_01.ErrorResponseException; +import com.microsoft.azure.management.apimanagement.v2019_01_01.TemplateName; +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.ServiceResponseWithHeaders; +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.HEAD; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.HTTP; +import retrofit2.http.PATCH; +import retrofit2.http.Path; +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 EmailTemplates. + */ +public class EmailTemplatesInner { + /** The Retrofit service to perform REST calls. */ + private EmailTemplatesService service; + /** The service client containing this operation class. */ + private ApiManagementClientImpl client; + + /** + * Initializes an instance of EmailTemplatesInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public EmailTemplatesInner(Retrofit retrofit, ApiManagementClientImpl client) { + this.service = retrofit.create(EmailTemplatesService.class); + this.client = client; + } + + /** + * The interface defining all the services for EmailTemplates to be + * used by Retrofit to perform actually REST calls. + */ + interface EmailTemplatesService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.apimanagement.v2019_01_01.EmailTemplates listByService" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/templates") + Observable> listByService(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("subscriptionId") String subscriptionId, @Query("$filter") String filter, @Query("$top") Integer top, @Query("$skip") Integer skip, @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.apimanagement.v2019_01_01.EmailTemplates getEntityTag" }) + @HEAD("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/templates/{templateName}") + Observable> getEntityTag(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("templateName") TemplateName templateName1, @Path("subscriptionId") String subscriptionId, @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.apimanagement.v2019_01_01.EmailTemplates get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/templates/{templateName}") + Observable> get(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("templateName") TemplateName templateName1, @Path("subscriptionId") String subscriptionId, @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.apimanagement.v2019_01_01.EmailTemplates createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/templates/{templateName}") + Observable> createOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("templateName") TemplateName templateName1, @Path("subscriptionId") String subscriptionId, @Body EmailTemplateUpdateParameters parameters, @Header("If-Match") String ifMatch, @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.apimanagement.v2019_01_01.EmailTemplates update" }) + @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/templates/{templateName}") + Observable> update(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("templateName") TemplateName templateName1, @Path("subscriptionId") String subscriptionId, @Body EmailTemplateUpdateParameters parameters, @Header("If-Match") String ifMatch, @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.apimanagement.v2019_01_01.EmailTemplates delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/templates/{templateName}", method = "DELETE", hasBody = true) + Observable> delete(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("templateName") TemplateName templateName1, @Path("subscriptionId") String subscriptionId, @Header("If-Match") String ifMatch, @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.apimanagement.v2019_01_01.EmailTemplates listByServiceNext" }) + @GET + Observable> listByServiceNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Lists a collection of properties defined within a service instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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<EmailTemplateContractInner> object if successful. + */ + public PagedList listByService(final String resourceGroupName, final String serviceName) { + ServiceResponse> response = listByServiceSinglePageAsync(resourceGroupName, serviceName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByServiceNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists a collection of properties defined within a service instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @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> listByServiceAsync(final String resourceGroupName, final String serviceName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByServiceSinglePageAsync(resourceGroupName, serviceName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByServiceNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists a collection of properties defined within a service instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<EmailTemplateContractInner> object + */ + public Observable> listByServiceAsync(final String resourceGroupName, final String serviceName) { + return listByServiceWithServiceResponseAsync(resourceGroupName, serviceName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists a collection of properties defined within a service instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<EmailTemplateContractInner> object + */ + public Observable>> listByServiceWithServiceResponseAsync(final String resourceGroupName, final String serviceName) { + return listByServiceSinglePageAsync(resourceGroupName, serviceName) + .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(listByServiceNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists a collection of properties defined within a service instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<EmailTemplateContractInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByServiceSinglePageAsync(final String resourceGroupName, final String serviceName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + 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 filter = null; + final Integer top = null; + final Integer skip = null; + return service.listByService(resourceGroupName, serviceName, this.client.subscriptionId(), filter, top, skip, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByServiceDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Lists a collection of properties defined within a service instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br> + * @param top Number of records to return. + * @param skip Number of records to skip. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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<EmailTemplateContractInner> object if successful. + */ + public PagedList listByService(final String resourceGroupName, final String serviceName, final String filter, final Integer top, final Integer skip) { + ServiceResponse> response = listByServiceSinglePageAsync(resourceGroupName, serviceName, filter, top, skip).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByServiceNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists a collection of properties defined within a service instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br> + * @param top Number of records to return. + * @param skip Number of records to skip. + * @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> listByServiceAsync(final String resourceGroupName, final String serviceName, final String filter, final Integer top, final Integer skip, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByServiceSinglePageAsync(resourceGroupName, serviceName, filter, top, skip), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByServiceNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists a collection of properties defined within a service instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br> + * @param top Number of records to return. + * @param skip Number of records to skip. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<EmailTemplateContractInner> object + */ + public Observable> listByServiceAsync(final String resourceGroupName, final String serviceName, final String filter, final Integer top, final Integer skip) { + return listByServiceWithServiceResponseAsync(resourceGroupName, serviceName, filter, top, skip) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists a collection of properties defined within a service instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br> + * @param top Number of records to return. + * @param skip Number of records to skip. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<EmailTemplateContractInner> object + */ + public Observable>> listByServiceWithServiceResponseAsync(final String resourceGroupName, final String serviceName, final String filter, final Integer top, final Integer skip) { + return listByServiceSinglePageAsync(resourceGroupName, serviceName, filter, top, skip) + .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(listByServiceNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists a collection of properties defined within a service instance. + * + ServiceResponse> * @param resourceGroupName The name of the resource group. + ServiceResponse> * @param serviceName The name of the API Management service. + ServiceResponse> * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br> + ServiceResponse> * @param top Number of records to return. + ServiceResponse> * @param skip Number of records to skip. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<EmailTemplateContractInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByServiceSinglePageAsync(final String resourceGroupName, final String serviceName, final String filter, final Integer top, final Integer skip) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + 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.listByService(resourceGroupName, serviceName, this.client.subscriptionId(), filter, top, skip, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByServiceDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByServiceDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Gets the entity state (Etag) version of the email template specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param templateName Email Template Name Identifier. Possible values include: 'applicationApprovedNotificationMessage', 'accountClosedDeveloper', 'quotaLimitApproachingDeveloperNotificationMessage', 'newDeveloperNotificationMessage', 'emailChangeIdentityDefault', 'inviteUserNotificationMessage', 'newCommentNotificationMessage', 'confirmSignUpIdentityDefault', 'newIssueNotificationMessage', 'purchaseDeveloperNotificationMessage', 'passwordResetIdentityDefault', 'passwordResetByAdminNotificationMessage', 'rejectDeveloperNotificationMessage', 'requestDeveloperNotificationMessage' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void getEntityTag(String resourceGroupName, String serviceName, TemplateName templateName) { + getEntityTagWithServiceResponseAsync(resourceGroupName, serviceName, templateName).toBlocking().single().body(); + } + + /** + * Gets the entity state (Etag) version of the email template specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param templateName Email Template Name Identifier. Possible values include: 'applicationApprovedNotificationMessage', 'accountClosedDeveloper', 'quotaLimitApproachingDeveloperNotificationMessage', 'newDeveloperNotificationMessage', 'emailChangeIdentityDefault', 'inviteUserNotificationMessage', 'newCommentNotificationMessage', 'confirmSignUpIdentityDefault', 'newIssueNotificationMessage', 'purchaseDeveloperNotificationMessage', 'passwordResetIdentityDefault', 'passwordResetByAdminNotificationMessage', 'rejectDeveloperNotificationMessage', 'requestDeveloperNotificationMessage' + * @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 getEntityTagAsync(String resourceGroupName, String serviceName, TemplateName templateName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(getEntityTagWithServiceResponseAsync(resourceGroupName, serviceName, templateName), serviceCallback); + } + + /** + * Gets the entity state (Etag) version of the email template specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param templateName Email Template Name Identifier. Possible values include: 'applicationApprovedNotificationMessage', 'accountClosedDeveloper', 'quotaLimitApproachingDeveloperNotificationMessage', 'newDeveloperNotificationMessage', 'emailChangeIdentityDefault', 'inviteUserNotificationMessage', 'newCommentNotificationMessage', 'confirmSignUpIdentityDefault', 'newIssueNotificationMessage', 'purchaseDeveloperNotificationMessage', 'passwordResetIdentityDefault', 'passwordResetByAdminNotificationMessage', 'rejectDeveloperNotificationMessage', 'requestDeveloperNotificationMessage' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public Observable getEntityTagAsync(String resourceGroupName, String serviceName, TemplateName templateName) { + return getEntityTagWithServiceResponseAsync(resourceGroupName, serviceName, templateName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Gets the entity state (Etag) version of the email template specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param templateName Email Template Name Identifier. Possible values include: 'applicationApprovedNotificationMessage', 'accountClosedDeveloper', 'quotaLimitApproachingDeveloperNotificationMessage', 'newDeveloperNotificationMessage', 'emailChangeIdentityDefault', 'inviteUserNotificationMessage', 'newCommentNotificationMessage', 'confirmSignUpIdentityDefault', 'newIssueNotificationMessage', 'purchaseDeveloperNotificationMessage', 'passwordResetIdentityDefault', 'passwordResetByAdminNotificationMessage', 'rejectDeveloperNotificationMessage', 'requestDeveloperNotificationMessage' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public Observable> getEntityTagWithServiceResponseAsync(String resourceGroupName, String serviceName, TemplateName templateName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (templateName == null) { + throw new IllegalArgumentException("Parameter templateName is required and cannot be null."); + } + 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.getEntityTag(resourceGroupName, serviceName, templateName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = getEntityTagDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponseWithHeaders getEntityTagDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .buildEmptyWithHeaders(response, EmailTemplateGetEntityTagHeaders.class); + } + + /** + * Gets the details of the email template specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param templateName Email Template Name Identifier. Possible values include: 'applicationApprovedNotificationMessage', 'accountClosedDeveloper', 'quotaLimitApproachingDeveloperNotificationMessage', 'newDeveloperNotificationMessage', 'emailChangeIdentityDefault', 'inviteUserNotificationMessage', 'newCommentNotificationMessage', 'confirmSignUpIdentityDefault', 'newIssueNotificationMessage', 'purchaseDeveloperNotificationMessage', 'passwordResetIdentityDefault', 'passwordResetByAdminNotificationMessage', 'rejectDeveloperNotificationMessage', 'requestDeveloperNotificationMessage' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the EmailTemplateContractInner object if successful. + */ + public EmailTemplateContractInner get(String resourceGroupName, String serviceName, TemplateName templateName) { + return getWithServiceResponseAsync(resourceGroupName, serviceName, templateName).toBlocking().single().body(); + } + + /** + * Gets the details of the email template specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param templateName Email Template Name Identifier. Possible values include: 'applicationApprovedNotificationMessage', 'accountClosedDeveloper', 'quotaLimitApproachingDeveloperNotificationMessage', 'newDeveloperNotificationMessage', 'emailChangeIdentityDefault', 'inviteUserNotificationMessage', 'newCommentNotificationMessage', 'confirmSignUpIdentityDefault', 'newIssueNotificationMessage', 'purchaseDeveloperNotificationMessage', 'passwordResetIdentityDefault', 'passwordResetByAdminNotificationMessage', 'rejectDeveloperNotificationMessage', 'requestDeveloperNotificationMessage' + * @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 getAsync(String resourceGroupName, String serviceName, TemplateName templateName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(getWithServiceResponseAsync(resourceGroupName, serviceName, templateName), serviceCallback); + } + + /** + * Gets the details of the email template specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param templateName Email Template Name Identifier. Possible values include: 'applicationApprovedNotificationMessage', 'accountClosedDeveloper', 'quotaLimitApproachingDeveloperNotificationMessage', 'newDeveloperNotificationMessage', 'emailChangeIdentityDefault', 'inviteUserNotificationMessage', 'newCommentNotificationMessage', 'confirmSignUpIdentityDefault', 'newIssueNotificationMessage', 'purchaseDeveloperNotificationMessage', 'passwordResetIdentityDefault', 'passwordResetByAdminNotificationMessage', 'rejectDeveloperNotificationMessage', 'requestDeveloperNotificationMessage' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the EmailTemplateContractInner object + */ + public Observable getAsync(String resourceGroupName, String serviceName, TemplateName templateName) { + return getWithServiceResponseAsync(resourceGroupName, serviceName, templateName).map(new Func1, EmailTemplateContractInner>() { + @Override + public EmailTemplateContractInner call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Gets the details of the email template specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param templateName Email Template Name Identifier. Possible values include: 'applicationApprovedNotificationMessage', 'accountClosedDeveloper', 'quotaLimitApproachingDeveloperNotificationMessage', 'newDeveloperNotificationMessage', 'emailChangeIdentityDefault', 'inviteUserNotificationMessage', 'newCommentNotificationMessage', 'confirmSignUpIdentityDefault', 'newIssueNotificationMessage', 'purchaseDeveloperNotificationMessage', 'passwordResetIdentityDefault', 'passwordResetByAdminNotificationMessage', 'rejectDeveloperNotificationMessage', 'requestDeveloperNotificationMessage' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the EmailTemplateContractInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String serviceName, TemplateName templateName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (templateName == null) { + throw new IllegalArgumentException("Parameter templateName is required and cannot be null."); + } + 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.get(resourceGroupName, serviceName, templateName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = getDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponseWithHeaders getDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .buildWithHeaders(response, EmailTemplateGetHeaders.class); + } + + /** + * Updates an Email Template. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param templateName Email Template Name Identifier. Possible values include: 'applicationApprovedNotificationMessage', 'accountClosedDeveloper', 'quotaLimitApproachingDeveloperNotificationMessage', 'newDeveloperNotificationMessage', 'emailChangeIdentityDefault', 'inviteUserNotificationMessage', 'newCommentNotificationMessage', 'confirmSignUpIdentityDefault', 'newIssueNotificationMessage', 'purchaseDeveloperNotificationMessage', 'passwordResetIdentityDefault', 'passwordResetByAdminNotificationMessage', 'rejectDeveloperNotificationMessage', 'requestDeveloperNotificationMessage' + * @param parameters Email Template update parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the EmailTemplateContractInner object if successful. + */ + public EmailTemplateContractInner createOrUpdate(String resourceGroupName, String serviceName, TemplateName templateName, EmailTemplateUpdateParameters parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serviceName, templateName, parameters).toBlocking().single().body(); + } + + /** + * Updates an Email Template. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param templateName Email Template Name Identifier. Possible values include: 'applicationApprovedNotificationMessage', 'accountClosedDeveloper', 'quotaLimitApproachingDeveloperNotificationMessage', 'newDeveloperNotificationMessage', 'emailChangeIdentityDefault', 'inviteUserNotificationMessage', 'newCommentNotificationMessage', 'confirmSignUpIdentityDefault', 'newIssueNotificationMessage', 'purchaseDeveloperNotificationMessage', 'passwordResetIdentityDefault', 'passwordResetByAdminNotificationMessage', 'rejectDeveloperNotificationMessage', 'requestDeveloperNotificationMessage' + * @param parameters Email Template update parameters. + * @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 createOrUpdateAsync(String resourceGroupName, String serviceName, TemplateName templateName, EmailTemplateUpdateParameters parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, serviceName, templateName, parameters), serviceCallback); + } + + /** + * Updates an Email Template. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param templateName Email Template Name Identifier. Possible values include: 'applicationApprovedNotificationMessage', 'accountClosedDeveloper', 'quotaLimitApproachingDeveloperNotificationMessage', 'newDeveloperNotificationMessage', 'emailChangeIdentityDefault', 'inviteUserNotificationMessage', 'newCommentNotificationMessage', 'confirmSignUpIdentityDefault', 'newIssueNotificationMessage', 'purchaseDeveloperNotificationMessage', 'passwordResetIdentityDefault', 'passwordResetByAdminNotificationMessage', 'rejectDeveloperNotificationMessage', 'requestDeveloperNotificationMessage' + * @param parameters Email Template update parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the EmailTemplateContractInner object + */ + public Observable createOrUpdateAsync(String resourceGroupName, String serviceName, TemplateName templateName, EmailTemplateUpdateParameters parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serviceName, templateName, parameters).map(new Func1, EmailTemplateContractInner>() { + @Override + public EmailTemplateContractInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates an Email Template. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param templateName Email Template Name Identifier. Possible values include: 'applicationApprovedNotificationMessage', 'accountClosedDeveloper', 'quotaLimitApproachingDeveloperNotificationMessage', 'newDeveloperNotificationMessage', 'emailChangeIdentityDefault', 'inviteUserNotificationMessage', 'newCommentNotificationMessage', 'confirmSignUpIdentityDefault', 'newIssueNotificationMessage', 'purchaseDeveloperNotificationMessage', 'passwordResetIdentityDefault', 'passwordResetByAdminNotificationMessage', 'rejectDeveloperNotificationMessage', 'requestDeveloperNotificationMessage' + * @param parameters Email Template update parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the EmailTemplateContractInner object + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String serviceName, TemplateName templateName, EmailTemplateUpdateParameters parameters) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (templateName == null) { + throw new IllegalArgumentException("Parameter templateName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(parameters); + final String ifMatch = null; + return service.createOrUpdate(resourceGroupName, serviceName, templateName, this.client.subscriptionId(), parameters, ifMatch, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = createOrUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Updates an Email Template. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param templateName Email Template Name Identifier. Possible values include: 'applicationApprovedNotificationMessage', 'accountClosedDeveloper', 'quotaLimitApproachingDeveloperNotificationMessage', 'newDeveloperNotificationMessage', 'emailChangeIdentityDefault', 'inviteUserNotificationMessage', 'newCommentNotificationMessage', 'confirmSignUpIdentityDefault', 'newIssueNotificationMessage', 'purchaseDeveloperNotificationMessage', 'passwordResetIdentityDefault', 'passwordResetByAdminNotificationMessage', 'rejectDeveloperNotificationMessage', 'requestDeveloperNotificationMessage' + * @param parameters Email Template update parameters. + * @param ifMatch ETag of the Entity. Not required when creating an entity, but required when updating an entity. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the EmailTemplateContractInner object if successful. + */ + public EmailTemplateContractInner createOrUpdate(String resourceGroupName, String serviceName, TemplateName templateName, EmailTemplateUpdateParameters parameters, String ifMatch) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serviceName, templateName, parameters, ifMatch).toBlocking().single().body(); + } + + /** + * Updates an Email Template. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param templateName Email Template Name Identifier. Possible values include: 'applicationApprovedNotificationMessage', 'accountClosedDeveloper', 'quotaLimitApproachingDeveloperNotificationMessage', 'newDeveloperNotificationMessage', 'emailChangeIdentityDefault', 'inviteUserNotificationMessage', 'newCommentNotificationMessage', 'confirmSignUpIdentityDefault', 'newIssueNotificationMessage', 'purchaseDeveloperNotificationMessage', 'passwordResetIdentityDefault', 'passwordResetByAdminNotificationMessage', 'rejectDeveloperNotificationMessage', 'requestDeveloperNotificationMessage' + * @param parameters Email Template update parameters. + * @param ifMatch ETag of the Entity. Not required when creating an entity, but required when updating an entity. + * @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 createOrUpdateAsync(String resourceGroupName, String serviceName, TemplateName templateName, EmailTemplateUpdateParameters parameters, String ifMatch, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, serviceName, templateName, parameters, ifMatch), serviceCallback); + } + + /** + * Updates an Email Template. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param templateName Email Template Name Identifier. Possible values include: 'applicationApprovedNotificationMessage', 'accountClosedDeveloper', 'quotaLimitApproachingDeveloperNotificationMessage', 'newDeveloperNotificationMessage', 'emailChangeIdentityDefault', 'inviteUserNotificationMessage', 'newCommentNotificationMessage', 'confirmSignUpIdentityDefault', 'newIssueNotificationMessage', 'purchaseDeveloperNotificationMessage', 'passwordResetIdentityDefault', 'passwordResetByAdminNotificationMessage', 'rejectDeveloperNotificationMessage', 'requestDeveloperNotificationMessage' + * @param parameters Email Template update parameters. + * @param ifMatch ETag of the Entity. Not required when creating an entity, but required when updating an entity. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the EmailTemplateContractInner object + */ + public Observable createOrUpdateAsync(String resourceGroupName, String serviceName, TemplateName templateName, EmailTemplateUpdateParameters parameters, String ifMatch) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serviceName, templateName, parameters, ifMatch).map(new Func1, EmailTemplateContractInner>() { + @Override + public EmailTemplateContractInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates an Email Template. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param templateName Email Template Name Identifier. Possible values include: 'applicationApprovedNotificationMessage', 'accountClosedDeveloper', 'quotaLimitApproachingDeveloperNotificationMessage', 'newDeveloperNotificationMessage', 'emailChangeIdentityDefault', 'inviteUserNotificationMessage', 'newCommentNotificationMessage', 'confirmSignUpIdentityDefault', 'newIssueNotificationMessage', 'purchaseDeveloperNotificationMessage', 'passwordResetIdentityDefault', 'passwordResetByAdminNotificationMessage', 'rejectDeveloperNotificationMessage', 'requestDeveloperNotificationMessage' + * @param parameters Email Template update parameters. + * @param ifMatch ETag of the Entity. Not required when creating an entity, but required when updating an entity. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the EmailTemplateContractInner object + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String serviceName, TemplateName templateName, EmailTemplateUpdateParameters parameters, String ifMatch) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (templateName == null) { + throw new IllegalArgumentException("Parameter templateName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(parameters); + return service.createOrUpdate(resourceGroupName, serviceName, templateName, this.client.subscriptionId(), parameters, ifMatch, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = createOrUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse createOrUpdateDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(201, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Updates the specific Email Template. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param templateName Email Template Name Identifier. Possible values include: 'applicationApprovedNotificationMessage', 'accountClosedDeveloper', 'quotaLimitApproachingDeveloperNotificationMessage', 'newDeveloperNotificationMessage', 'emailChangeIdentityDefault', 'inviteUserNotificationMessage', 'newCommentNotificationMessage', 'confirmSignUpIdentityDefault', 'newIssueNotificationMessage', 'purchaseDeveloperNotificationMessage', 'passwordResetIdentityDefault', 'passwordResetByAdminNotificationMessage', 'rejectDeveloperNotificationMessage', 'requestDeveloperNotificationMessage' + * @param parameters Update parameters. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void update(String resourceGroupName, String serviceName, TemplateName templateName, EmailTemplateUpdateParameters parameters, String ifMatch) { + updateWithServiceResponseAsync(resourceGroupName, serviceName, templateName, parameters, ifMatch).toBlocking().single().body(); + } + + /** + * Updates the specific Email Template. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param templateName Email Template Name Identifier. Possible values include: 'applicationApprovedNotificationMessage', 'accountClosedDeveloper', 'quotaLimitApproachingDeveloperNotificationMessage', 'newDeveloperNotificationMessage', 'emailChangeIdentityDefault', 'inviteUserNotificationMessage', 'newCommentNotificationMessage', 'confirmSignUpIdentityDefault', 'newIssueNotificationMessage', 'purchaseDeveloperNotificationMessage', 'passwordResetIdentityDefault', 'passwordResetByAdminNotificationMessage', 'rejectDeveloperNotificationMessage', 'requestDeveloperNotificationMessage' + * @param parameters Update parameters. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @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 serviceName, TemplateName templateName, EmailTemplateUpdateParameters parameters, String ifMatch, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateWithServiceResponseAsync(resourceGroupName, serviceName, templateName, parameters, ifMatch), serviceCallback); + } + + /** + * Updates the specific Email Template. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param templateName Email Template Name Identifier. Possible values include: 'applicationApprovedNotificationMessage', 'accountClosedDeveloper', 'quotaLimitApproachingDeveloperNotificationMessage', 'newDeveloperNotificationMessage', 'emailChangeIdentityDefault', 'inviteUserNotificationMessage', 'newCommentNotificationMessage', 'confirmSignUpIdentityDefault', 'newIssueNotificationMessage', 'purchaseDeveloperNotificationMessage', 'passwordResetIdentityDefault', 'passwordResetByAdminNotificationMessage', 'rejectDeveloperNotificationMessage', 'requestDeveloperNotificationMessage' + * @param parameters Update parameters. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable updateAsync(String resourceGroupName, String serviceName, TemplateName templateName, EmailTemplateUpdateParameters parameters, String ifMatch) { + return updateWithServiceResponseAsync(resourceGroupName, serviceName, templateName, parameters, ifMatch).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates the specific Email Template. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param templateName Email Template Name Identifier. Possible values include: 'applicationApprovedNotificationMessage', 'accountClosedDeveloper', 'quotaLimitApproachingDeveloperNotificationMessage', 'newDeveloperNotificationMessage', 'emailChangeIdentityDefault', 'inviteUserNotificationMessage', 'newCommentNotificationMessage', 'confirmSignUpIdentityDefault', 'newIssueNotificationMessage', 'purchaseDeveloperNotificationMessage', 'passwordResetIdentityDefault', 'passwordResetByAdminNotificationMessage', 'rejectDeveloperNotificationMessage', 'requestDeveloperNotificationMessage' + * @param parameters Update parameters. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> updateWithServiceResponseAsync(String resourceGroupName, String serviceName, TemplateName templateName, EmailTemplateUpdateParameters parameters, String ifMatch) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (templateName == null) { + throw new IllegalArgumentException("Parameter templateName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + if (ifMatch == null) { + throw new IllegalArgumentException("Parameter ifMatch is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(parameters); + return service.update(resourceGroupName, serviceName, templateName, this.client.subscriptionId(), parameters, ifMatch, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = updateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse updateDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(204, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Reset the Email Template to default template provided by the API Management service instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param templateName Email Template Name Identifier. Possible values include: 'applicationApprovedNotificationMessage', 'accountClosedDeveloper', 'quotaLimitApproachingDeveloperNotificationMessage', 'newDeveloperNotificationMessage', 'emailChangeIdentityDefault', 'inviteUserNotificationMessage', 'newCommentNotificationMessage', 'confirmSignUpIdentityDefault', 'newIssueNotificationMessage', 'purchaseDeveloperNotificationMessage', 'passwordResetIdentityDefault', 'passwordResetByAdminNotificationMessage', 'rejectDeveloperNotificationMessage', 'requestDeveloperNotificationMessage' + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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 serviceName, TemplateName templateName, String ifMatch) { + deleteWithServiceResponseAsync(resourceGroupName, serviceName, templateName, ifMatch).toBlocking().single().body(); + } + + /** + * Reset the Email Template to default template provided by the API Management service instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param templateName Email Template Name Identifier. Possible values include: 'applicationApprovedNotificationMessage', 'accountClosedDeveloper', 'quotaLimitApproachingDeveloperNotificationMessage', 'newDeveloperNotificationMessage', 'emailChangeIdentityDefault', 'inviteUserNotificationMessage', 'newCommentNotificationMessage', 'confirmSignUpIdentityDefault', 'newIssueNotificationMessage', 'purchaseDeveloperNotificationMessage', 'passwordResetIdentityDefault', 'passwordResetByAdminNotificationMessage', 'rejectDeveloperNotificationMessage', 'requestDeveloperNotificationMessage' + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @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 serviceName, TemplateName templateName, String ifMatch, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, serviceName, templateName, ifMatch), serviceCallback); + } + + /** + * Reset the Email Template to default template provided by the API Management service instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param templateName Email Template Name Identifier. Possible values include: 'applicationApprovedNotificationMessage', 'accountClosedDeveloper', 'quotaLimitApproachingDeveloperNotificationMessage', 'newDeveloperNotificationMessage', 'emailChangeIdentityDefault', 'inviteUserNotificationMessage', 'newCommentNotificationMessage', 'confirmSignUpIdentityDefault', 'newIssueNotificationMessage', 'purchaseDeveloperNotificationMessage', 'passwordResetIdentityDefault', 'passwordResetByAdminNotificationMessage', 'rejectDeveloperNotificationMessage', 'requestDeveloperNotificationMessage' + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable deleteAsync(String resourceGroupName, String serviceName, TemplateName templateName, String ifMatch) { + return deleteWithServiceResponseAsync(resourceGroupName, serviceName, templateName, ifMatch).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Reset the Email Template to default template provided by the API Management service instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param templateName Email Template Name Identifier. Possible values include: 'applicationApprovedNotificationMessage', 'accountClosedDeveloper', 'quotaLimitApproachingDeveloperNotificationMessage', 'newDeveloperNotificationMessage', 'emailChangeIdentityDefault', 'inviteUserNotificationMessage', 'newCommentNotificationMessage', 'confirmSignUpIdentityDefault', 'newIssueNotificationMessage', 'purchaseDeveloperNotificationMessage', 'passwordResetIdentityDefault', 'passwordResetByAdminNotificationMessage', 'rejectDeveloperNotificationMessage', 'requestDeveloperNotificationMessage' + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> deleteWithServiceResponseAsync(String resourceGroupName, String serviceName, TemplateName templateName, String ifMatch) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (templateName == null) { + throw new IllegalArgumentException("Parameter templateName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (ifMatch == null) { + throw new IllegalArgumentException("Parameter ifMatch 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.delete(resourceGroupName, serviceName, templateName, this.client.subscriptionId(), ifMatch, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = deleteDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse deleteDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(204, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists a collection of properties defined within a service instance. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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<EmailTemplateContractInner> object if successful. + */ + public PagedList listByServiceNext(final String nextPageLink) { + ServiceResponse> response = listByServiceNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByServiceNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists a collection of properties defined within a service instance. + * + * @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> listByServiceNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByServiceNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByServiceNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists a collection of properties defined within a service instance. + * + * @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<EmailTemplateContractInner> object + */ + public Observable> listByServiceNextAsync(final String nextPageLink) { + return listByServiceNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists a collection of properties defined within a service instance. + * + * @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<EmailTemplateContractInner> object + */ + public Observable>> listByServiceNextWithServiceResponseAsync(final String nextPageLink) { + return listByServiceNextSinglePageAsync(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(listByServiceNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists a collection of properties defined within a service instance. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<EmailTemplateContractInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByServiceNextSinglePageAsync(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.listByServiceNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByServiceNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByServiceNextDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/GenerateSsoUrlResultImpl.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/GenerateSsoUrlResultImpl.java new file mode 100644 index 0000000000000..994d0d87b0a75 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/GenerateSsoUrlResultImpl.java @@ -0,0 +1,31 @@ +/** + * 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.apimanagement.v2019_01_01.implementation; + +import com.microsoft.azure.management.apimanagement.v2019_01_01.GenerateSsoUrlResult; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; + +class GenerateSsoUrlResultImpl extends WrapperImpl implements GenerateSsoUrlResult { + private final ApiManagementManager manager; + GenerateSsoUrlResultImpl(GenerateSsoUrlResultInner inner, ApiManagementManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public ApiManagementManager manager() { + return this.manager; + } + + @Override + public String value() { + return this.inner().value(); + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/GenerateSsoUrlResultInner.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/GenerateSsoUrlResultInner.java new file mode 100644 index 0000000000000..32d58b3039911 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/GenerateSsoUrlResultInner.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.apimanagement.v2019_01_01.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Generate SSO Url operations response details. + */ +public class GenerateSsoUrlResultInner { + /** + * Redirect Url containing the SSO URL value. + */ + @JsonProperty(value = "value") + private String value; + + /** + * Get redirect Url containing the SSO URL value. + * + * @return the value value + */ + public String value() { + return this.value; + } + + /** + * Set redirect Url containing the SSO URL value. + * + * @param value the value value to set + * @return the GenerateSsoUrlResultInner object itself. + */ + public GenerateSsoUrlResultInner withValue(String value) { + this.value = value; + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/GroupContractImpl.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/GroupContractImpl.java new file mode 100644 index 0000000000000..467f20516126d --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/GroupContractImpl.java @@ -0,0 +1,184 @@ +/** + * 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.apimanagement.v2019_01_01.implementation; + +import com.microsoft.azure.management.apimanagement.v2019_01_01.GroupContract; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import com.microsoft.azure.management.apimanagement.v2019_01_01.GroupCreateParameters; +import com.microsoft.azure.management.apimanagement.v2019_01_01.GroupType; +import rx.functions.Func1; + +class GroupContractImpl extends CreatableUpdatableImpl implements GroupContract, GroupContract.Definition, GroupContract.Update { + private String resourceGroupName; + private String serviceName; + private String groupId; + private String cifMatch; + private String uifMatch; + private GroupCreateParameters createOrUpdateParameter; + private final ApiManagementManager manager; + + GroupContractImpl(String name, ApiManagementManager manager) { + super(name, new GroupContractInner()); + this.manager = manager; + // Set resource name + this.groupId = name; + // + this.createOrUpdateParameter = new GroupCreateParameters(); + } + + GroupContractImpl(GroupContractInner inner, ApiManagementManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.groupId = inner.name(); + // set resource ancestor and positional variables + this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourceGroups"); + this.serviceName = IdParsingUtils.getValueFromIdByName(inner.id(), "service"); + this.groupId = IdParsingUtils.getValueFromIdByName(inner.id(), "groups"); + // set other parameters for create and update + this.createOrUpdateParameter = new GroupCreateParameters(); + } + + @Override + public ApiManagementManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + GroupsInner client = this.manager().inner().groups(); + return client.createOrUpdateAsync(this.resourceGroupName, this.serviceName, this.groupId, this.createOrUpdateParameter, this.cifMatch) + .map(new Func1() { + @Override + public GroupContractInner call(GroupContractInner resource) { + resetCreateUpdateParameters(); + return resource; + } + }) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + GroupsInner client = this.manager().inner().groups(); + return client.createOrUpdateAsync(this.resourceGroupName, this.serviceName, this.groupId, this.createOrUpdateParameter, this.uifMatch) + .map(new Func1() { + @Override + public GroupContractInner call(GroupContractInner resource) { + resetCreateUpdateParameters(); + return resource; + } + }) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + GroupsInner client = this.manager().inner().groups(); + return null; // NOP getInnerAsync implementation as get is not supported + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + private void resetCreateUpdateParameters() { + this.createOrUpdateParameter = new GroupCreateParameters(); + } + + @Override + public Boolean builtIn() { + return this.inner().builtIn(); + } + + @Override + public String description() { + return this.inner().description(); + } + + @Override + public String displayName() { + return this.inner().displayName(); + } + + @Override + public String externalId() { + return this.inner().externalId(); + } + + @Override + public GroupType groupContractType() { + return this.inner().groupContractType(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public GroupContractImpl withResourceGroupName(String resourceGroupName) { + this.resourceGroupName = resourceGroupName; + return this; + } + + @Override + public GroupContractImpl withServiceName(String serviceName) { + this.serviceName = serviceName; + return this; + } + + @Override + public GroupContractImpl withDisplayName(String displayName) { + this.createOrUpdateParameter.withDisplayName(displayName); + return this; + } + + @Override + public GroupContractImpl withIfMatch(String ifMatch) { + if (isInCreateMode()) { + this.cifMatch = ifMatch; + } else { + this.uifMatch = ifMatch; + } + return this; + } + + @Override + public GroupContractImpl withDescription(String description) { + this.createOrUpdateParameter.withDescription(description); + return this; + } + + @Override + public GroupContractImpl withExternalId(String externalId) { + this.createOrUpdateParameter.withExternalId(externalId); + return this; + } + + @Override + public GroupContractImpl withType(GroupType type) { + this.createOrUpdateParameter.withType(type); + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/GroupContractInner.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/GroupContractInner.java new file mode 100644 index 0000000000000..e92c0b9baaae4 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/GroupContractInner.java @@ -0,0 +1,144 @@ +/** + * 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.apimanagement.v2019_01_01.implementation; + +import com.microsoft.azure.management.apimanagement.v2019_01_01.GroupType; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * Contract details. + */ +@JsonFlatten +public class GroupContractInner extends ProxyResource { + /** + * Group name. + */ + @JsonProperty(value = "properties.displayName", required = true) + private String displayName; + + /** + * Group description. Can contain HTML formatting tags. + */ + @JsonProperty(value = "properties.description") + private String description; + + /** + * true if the group is one of the three system groups (Administrators, + * Developers, or Guests); otherwise false. + */ + @JsonProperty(value = "properties.builtIn", access = JsonProperty.Access.WRITE_ONLY) + private Boolean builtIn; + + /** + * Group type. Possible values include: 'custom', 'system', 'external'. + */ + @JsonProperty(value = "properties.type") + private GroupType groupContractType; + + /** + * For external groups, this property contains the id of the group from the + * external identity provider, e.g. for Azure Active Directory + * `aad://<tenant>.onmicrosoft.com/groups/<group object id>`; + * otherwise the value is null. + */ + @JsonProperty(value = "properties.externalId") + private String externalId; + + /** + * Get group name. + * + * @return the displayName value + */ + public String displayName() { + return this.displayName; + } + + /** + * Set group name. + * + * @param displayName the displayName value to set + * @return the GroupContractInner object itself. + */ + public GroupContractInner withDisplayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Get group description. Can contain HTML formatting tags. + * + * @return the description value + */ + public String description() { + return this.description; + } + + /** + * Set group description. Can contain HTML formatting tags. + * + * @param description the description value to set + * @return the GroupContractInner object itself. + */ + public GroupContractInner withDescription(String description) { + this.description = description; + return this; + } + + /** + * Get true if the group is one of the three system groups (Administrators, Developers, or Guests); otherwise false. + * + * @return the builtIn value + */ + public Boolean builtIn() { + return this.builtIn; + } + + /** + * Get group type. Possible values include: 'custom', 'system', 'external'. + * + * @return the groupContractType value + */ + public GroupType groupContractType() { + return this.groupContractType; + } + + /** + * Set group type. Possible values include: 'custom', 'system', 'external'. + * + * @param groupContractType the groupContractType value to set + * @return the GroupContractInner object itself. + */ + public GroupContractInner withGroupContractType(GroupType groupContractType) { + this.groupContractType = groupContractType; + return this; + } + + /** + * Get for external groups, this property contains the id of the group from the external identity provider, e.g. for Azure Active Directory `aad://<tenant>.onmicrosoft.com/groups/<group object id>`; otherwise the value is null. + * + * @return the externalId value + */ + public String externalId() { + return this.externalId; + } + + /** + * Set for external groups, this property contains the id of the group from the external identity provider, e.g. for Azure Active Directory `aad://<tenant>.onmicrosoft.com/groups/<group object id>`; otherwise the value is null. + * + * @param externalId the externalId value to set + * @return the GroupContractInner object itself. + */ + public GroupContractInner withExternalId(String externalId) { + this.externalId = externalId; + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/GroupUserContractImpl.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/GroupUserContractImpl.java new file mode 100644 index 0000000000000..16a85176bbef7 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/GroupUserContractImpl.java @@ -0,0 +1,149 @@ +/** + * 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.apimanagement.v2019_01_01.implementation; + +import com.microsoft.azure.management.apimanagement.v2019_01_01.GroupUserContract; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import java.util.List; +import com.microsoft.azure.management.apimanagement.v2019_01_01.GroupContractProperties; +import java.util.ArrayList; +import com.microsoft.azure.management.apimanagement.v2019_01_01.UserIdentityContract; +import org.joda.time.DateTime; +import com.microsoft.azure.management.apimanagement.v2019_01_01.UserState; + +class GroupUserContractImpl extends CreatableUpdatableImpl implements GroupUserContract, GroupUserContract.Definition, GroupUserContract.Update { + private final ApiManagementManager manager; + private String resourceGroupName; + private String serviceName; + private String groupId; + private String userId; + + GroupUserContractImpl(String name, ApiManagementManager manager) { + super(name, new UserContractInner()); + this.manager = manager; + // Set resource name + this.userId = name; + // + } + + GroupUserContractImpl(UserContractInner inner, ApiManagementManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.userId = inner.name(); + // set resource ancestor and positional variables + this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourceGroups"); + this.serviceName = IdParsingUtils.getValueFromIdByName(inner.id(), "service"); + this.groupId = IdParsingUtils.getValueFromIdByName(inner.id(), "groups"); + this.userId = IdParsingUtils.getValueFromIdByName(inner.id(), "users"); + // + } + + @Override + public ApiManagementManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + GroupUsersInner client = this.manager().inner().groupUsers(); + return client.createAsync(this.resourceGroupName, this.serviceName, this.groupId, this.userId) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + GroupUsersInner client = this.manager().inner().groupUsers(); + return client.createAsync(this.resourceGroupName, this.serviceName, this.groupId, this.userId) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + GroupUsersInner client = this.manager().inner().groupUsers(); + return null; // NOP getInnerAsync implementation as get is not supported + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + + @Override + public String email() { + return this.inner().email(); + } + + @Override + public String firstName() { + return this.inner().firstName(); + } + + @Override + public List groups() { + return this.inner().groups(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public List identities() { + List lst = new ArrayList(); + if (this.inner().identities() != null) { + for (UserIdentityContractInner inner : this.inner().identities()) { + lst.add( new UserIdentityContractImpl(inner, manager())); + } + } + return lst; + } + + @Override + public String lastName() { + return this.inner().lastName(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public String note() { + return this.inner().note(); + } + + @Override + public DateTime registrationDate() { + return this.inner().registrationDate(); + } + + @Override + public UserState state() { + return this.inner().state(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public GroupUserContractImpl withExistingGroup(String resourceGroupName, String serviceName, String groupId) { + this.resourceGroupName = resourceGroupName; + this.serviceName = serviceName; + this.groupId = groupId; + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/GroupUsersImpl.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/GroupUsersImpl.java new file mode 100644 index 0000000000000..36a6c59f12657 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/GroupUsersImpl.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.apimanagement.v2019_01_01.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.apimanagement.v2019_01_01.GroupUsers; +import rx.Completable; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.apimanagement.v2019_01_01.GroupUserContract; + +class GroupUsersImpl extends WrapperImpl implements GroupUsers { + private final ApiManagementManager manager; + + GroupUsersImpl(ApiManagementManager manager) { + super(manager.inner().groupUsers()); + this.manager = manager; + } + + public ApiManagementManager manager() { + return this.manager; + } + + @Override + public GroupUserContractImpl define(String name) { + return wrapModel(name); + } + + private GroupUserContractImpl wrapModel(UserContractInner inner) { + return new GroupUserContractImpl(inner, manager()); + } + + private GroupUserContractImpl wrapModel(String name) { + return new GroupUserContractImpl(name, this.manager()); + } + + @Override + public Observable checkEntityExistsAsync(String resourceGroupName, String serviceName, String groupId, String userId) { + GroupUsersInner client = this.inner(); + return client.checkEntityExistsAsync(resourceGroupName, serviceName, groupId, userId) + ;} + + @Override + public Observable listAsync(final String resourceGroupName, final String serviceName, final String groupId) { + GroupUsersInner client = this.inner(); + return client.listAsync(resourceGroupName, serviceName, groupId) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public GroupUserContract call(UserContractInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Completable deleteAsync(String resourceGroupName, String serviceName, String groupId, String userId) { + GroupUsersInner client = this.inner(); + return client.deleteAsync(resourceGroupName, serviceName, groupId, userId).toCompletable(); + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/GroupUsersInner.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/GroupUsersInner.java new file mode 100644 index 0000000000000..3f665fcde6063 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/GroupUsersInner.java @@ -0,0 +1,771 @@ +/** + * 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.apimanagement.v2019_01_01.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.apimanagement.v2019_01_01.ErrorResponseException; +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.GET; +import retrofit2.http.HEAD; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.HTTP; +import retrofit2.http.Path; +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 GroupUsers. + */ +public class GroupUsersInner { + /** The Retrofit service to perform REST calls. */ + private GroupUsersService service; + /** The service client containing this operation class. */ + private ApiManagementClientImpl client; + + /** + * Initializes an instance of GroupUsersInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public GroupUsersInner(Retrofit retrofit, ApiManagementClientImpl client) { + this.service = retrofit.create(GroupUsersService.class); + this.client = client; + } + + /** + * The interface defining all the services for GroupUsers to be + * used by Retrofit to perform actually REST calls. + */ + interface GroupUsersService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.apimanagement.v2019_01_01.GroupUsers list" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/groups/{groupId}/users") + Observable> list(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("groupId") String groupId, @Path("subscriptionId") String subscriptionId, @Query("$filter") String filter, @Query("$top") Integer top, @Query("$skip") Integer skip, @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.apimanagement.v2019_01_01.GroupUsers checkEntityExists" }) + @HEAD("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/groups/{groupId}/users/{userId}") + Observable> checkEntityExists(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("groupId") String groupId, @Path("userId") String userId, @Path("subscriptionId") String subscriptionId, @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.apimanagement.v2019_01_01.GroupUsers create" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/groups/{groupId}/users/{userId}") + Observable> create(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("groupId") String groupId, @Path("userId") String userId, @Path("subscriptionId") String subscriptionId, @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.apimanagement.v2019_01_01.GroupUsers delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/groups/{groupId}/users/{userId}", method = "DELETE", hasBody = true) + Observable> delete(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("groupId") String groupId, @Path("userId") String userId, @Path("subscriptionId") String subscriptionId, @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.apimanagement.v2019_01_01.GroupUsers listNext" }) + @GET + Observable> listNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Lists a collection of user entities associated with the group. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param groupId Group identifier. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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<UserContractInner> object if successful. + */ + public PagedList list(final String resourceGroupName, final String serviceName, final String groupId) { + ServiceResponse> response = listSinglePageAsync(resourceGroupName, serviceName, groupId).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists a collection of user entities associated with the group. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param groupId Group identifier. Must be unique in the current API Management service instance. + * @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 resourceGroupName, final String serviceName, final String groupId, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(resourceGroupName, serviceName, groupId), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists a collection of user entities associated with the group. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param groupId Group identifier. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<UserContractInner> object + */ + public Observable> listAsync(final String resourceGroupName, final String serviceName, final String groupId) { + return listWithServiceResponseAsync(resourceGroupName, serviceName, groupId) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists a collection of user entities associated with the group. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param groupId Group identifier. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<UserContractInner> object + */ + public Observable>> listWithServiceResponseAsync(final String resourceGroupName, final String serviceName, final String groupId) { + return listSinglePageAsync(resourceGroupName, serviceName, groupId) + .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 a collection of user entities associated with the group. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param groupId Group identifier. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<UserContractInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync(final String resourceGroupName, final String serviceName, final String groupId) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (groupId == null) { + throw new IllegalArgumentException("Parameter groupId is required and cannot be null."); + } + 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 filter = null; + final Integer top = null; + final Integer skip = null; + return service.list(resourceGroupName, serviceName, groupId, this.client.subscriptionId(), filter, top, skip, this.client.apiVersion(), 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 a collection of user entities associated with the group. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param groupId Group identifier. Must be unique in the current API Management service instance. + * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| firstName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| lastName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| email | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| registrationDate | filter | ge, le, eq, ne, gt, lt | | </br>| note | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br> + * @param top Number of records to return. + * @param skip Number of records to skip. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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<UserContractInner> object if successful. + */ + public PagedList list(final String resourceGroupName, final String serviceName, final String groupId, final String filter, final Integer top, final Integer skip) { + ServiceResponse> response = listSinglePageAsync(resourceGroupName, serviceName, groupId, filter, top, skip).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists a collection of user entities associated with the group. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param groupId Group identifier. Must be unique in the current API Management service instance. + * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| firstName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| lastName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| email | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| registrationDate | filter | ge, le, eq, ne, gt, lt | | </br>| note | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br> + * @param top Number of records to return. + * @param skip Number of records to skip. + * @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 resourceGroupName, final String serviceName, final String groupId, final String filter, final Integer top, final Integer skip, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(resourceGroupName, serviceName, groupId, filter, top, skip), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists a collection of user entities associated with the group. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param groupId Group identifier. Must be unique in the current API Management service instance. + * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| firstName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| lastName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| email | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| registrationDate | filter | ge, le, eq, ne, gt, lt | | </br>| note | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br> + * @param top Number of records to return. + * @param skip Number of records to skip. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<UserContractInner> object + */ + public Observable> listAsync(final String resourceGroupName, final String serviceName, final String groupId, final String filter, final Integer top, final Integer skip) { + return listWithServiceResponseAsync(resourceGroupName, serviceName, groupId, filter, top, skip) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists a collection of user entities associated with the group. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param groupId Group identifier. Must be unique in the current API Management service instance. + * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| firstName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| lastName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| email | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| registrationDate | filter | ge, le, eq, ne, gt, lt | | </br>| note | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br> + * @param top Number of records to return. + * @param skip Number of records to skip. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<UserContractInner> object + */ + public Observable>> listWithServiceResponseAsync(final String resourceGroupName, final String serviceName, final String groupId, final String filter, final Integer top, final Integer skip) { + return listSinglePageAsync(resourceGroupName, serviceName, groupId, filter, top, skip) + .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 a collection of user entities associated with the group. + * + ServiceResponse> * @param resourceGroupName The name of the resource group. + ServiceResponse> * @param serviceName The name of the API Management service. + ServiceResponse> * @param groupId Group identifier. Must be unique in the current API Management service instance. + ServiceResponse> * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| firstName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| lastName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| email | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| registrationDate | filter | ge, le, eq, ne, gt, lt | | </br>| note | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br> + ServiceResponse> * @param top Number of records to return. + ServiceResponse> * @param skip Number of records to skip. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<UserContractInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync(final String resourceGroupName, final String serviceName, final String groupId, final String filter, final Integer top, final Integer skip) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (groupId == null) { + throw new IllegalArgumentException("Parameter groupId is required and cannot be null."); + } + 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(resourceGroupName, serviceName, groupId, this.client.subscriptionId(), filter, top, skip, this.client.apiVersion(), 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 ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Checks that user entity specified by identifier is associated with the group entity. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param groupId Group identifier. Must be unique in the current API Management service instance. + * @param userId User identifier. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the boolean object if successful. + */ + public boolean checkEntityExists(String resourceGroupName, String serviceName, String groupId, String userId) { + return checkEntityExistsWithServiceResponseAsync(resourceGroupName, serviceName, groupId, userId).toBlocking().single().body(); + } + + /** + * Checks that user entity specified by identifier is associated with the group entity. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param groupId Group identifier. Must be unique in the current API Management service instance. + * @param userId User identifier. Must be unique in the current API Management service instance. + * @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 checkEntityExistsAsync(String resourceGroupName, String serviceName, String groupId, String userId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(checkEntityExistsWithServiceResponseAsync(resourceGroupName, serviceName, groupId, userId), serviceCallback); + } + + /** + * Checks that user entity specified by identifier is associated with the group entity. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param groupId Group identifier. Must be unique in the current API Management service instance. + * @param userId User identifier. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the Boolean object + */ + public Observable checkEntityExistsAsync(String resourceGroupName, String serviceName, String groupId, String userId) { + return checkEntityExistsWithServiceResponseAsync(resourceGroupName, serviceName, groupId, userId).map(new Func1, Boolean>() { + @Override + public Boolean call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Checks that user entity specified by identifier is associated with the group entity. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param groupId Group identifier. Must be unique in the current API Management service instance. + * @param userId User identifier. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the Boolean object + */ + public Observable> checkEntityExistsWithServiceResponseAsync(String resourceGroupName, String serviceName, String groupId, String userId) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (groupId == null) { + throw new IllegalArgumentException("Parameter groupId is required and cannot be null."); + } + if (userId == null) { + throw new IllegalArgumentException("Parameter userId is required and cannot be null."); + } + 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.checkEntityExists(resourceGroupName, serviceName, groupId, userId, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = checkEntityExistsDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse checkEntityExistsDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(204, new TypeToken() { }.getType()) + .register(404, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .buildEmpty(response); + } + + /** + * Add existing user to existing group. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param groupId Group identifier. Must be unique in the current API Management service instance. + * @param userId User identifier. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the UserContractInner object if successful. + */ + public UserContractInner create(String resourceGroupName, String serviceName, String groupId, String userId) { + return createWithServiceResponseAsync(resourceGroupName, serviceName, groupId, userId).toBlocking().single().body(); + } + + /** + * Add existing user to existing group. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param groupId Group identifier. Must be unique in the current API Management service instance. + * @param userId User identifier. Must be unique in the current API Management service instance. + * @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 serviceName, String groupId, String userId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createWithServiceResponseAsync(resourceGroupName, serviceName, groupId, userId), serviceCallback); + } + + /** + * Add existing user to existing group. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param groupId Group identifier. Must be unique in the current API Management service instance. + * @param userId User identifier. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the UserContractInner object + */ + public Observable createAsync(String resourceGroupName, String serviceName, String groupId, String userId) { + return createWithServiceResponseAsync(resourceGroupName, serviceName, groupId, userId).map(new Func1, UserContractInner>() { + @Override + public UserContractInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Add existing user to existing group. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param groupId Group identifier. Must be unique in the current API Management service instance. + * @param userId User identifier. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the UserContractInner object + */ + public Observable> createWithServiceResponseAsync(String resourceGroupName, String serviceName, String groupId, String userId) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (groupId == null) { + throw new IllegalArgumentException("Parameter groupId is required and cannot be null."); + } + if (userId == null) { + throw new IllegalArgumentException("Parameter userId is required and cannot be null."); + } + 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.create(resourceGroupName, serviceName, groupId, userId, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = createDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse createDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(201, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Remove existing user from existing group. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param groupId Group identifier. Must be unique in the current API Management service instance. + * @param userId User identifier. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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 serviceName, String groupId, String userId) { + deleteWithServiceResponseAsync(resourceGroupName, serviceName, groupId, userId).toBlocking().single().body(); + } + + /** + * Remove existing user from existing group. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param groupId Group identifier. Must be unique in the current API Management service instance. + * @param userId User identifier. Must be unique in the current API Management service instance. + * @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 serviceName, String groupId, String userId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, serviceName, groupId, userId), serviceCallback); + } + + /** + * Remove existing user from existing group. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param groupId Group identifier. Must be unique in the current API Management service instance. + * @param userId User identifier. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable deleteAsync(String resourceGroupName, String serviceName, String groupId, String userId) { + return deleteWithServiceResponseAsync(resourceGroupName, serviceName, groupId, userId).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Remove existing user from existing group. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param groupId Group identifier. Must be unique in the current API Management service instance. + * @param userId User identifier. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> deleteWithServiceResponseAsync(String resourceGroupName, String serviceName, String groupId, String userId) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (groupId == null) { + throw new IllegalArgumentException("Parameter groupId is required and cannot be null."); + } + if (userId == null) { + throw new IllegalArgumentException("Parameter userId is required and cannot be null."); + } + 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.delete(resourceGroupName, serviceName, groupId, userId, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = deleteDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse deleteDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(204, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists a collection of user entities associated with the group. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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<UserContractInner> 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 a collection of user entities associated with the 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> 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 a collection of user entities associated with the 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<UserContractInner> object + */ + public Observable> listNextAsync(final String nextPageLink) { + return listNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists a collection of user entities associated with the 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<UserContractInner> 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 a collection of user entities associated with the 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<UserContractInner> 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 ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/GroupsImpl.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/GroupsImpl.java new file mode 100644 index 0000000000000..9a2ae022c9d65 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/GroupsImpl.java @@ -0,0 +1,87 @@ +/** + * 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. + * jkl + */ + +package com.microsoft.azure.management.apimanagement.v2019_01_01.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.apimanagement.v2019_01_01.Groups; +import rx.Completable; +import rx.functions.Func1; +import rx.Observable; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.apimanagement.v2019_01_01.GroupContract; + +class GroupsImpl extends WrapperImpl implements Groups { + private final ApiManagementManager manager; + + GroupsImpl(ApiManagementManager manager) { + super(manager.inner().groups()); + this.manager = manager; + } + + public ApiManagementManager manager() { + return this.manager; + } + + @Override + public GroupContractImpl define(String name) { + return wrapModel(name); + } + + private GroupContractImpl wrapModel(GroupContractInner inner) { + return new GroupContractImpl(inner, manager()); + } + + private GroupContractImpl wrapModel(String name) { + return new GroupContractImpl(name, this.manager()); + } + + @Override + public Observable listByServiceAsync(final String resourceGroupName, final String serviceName) { + GroupsInner client = this.inner(); + return client.listByServiceAsync(resourceGroupName, serviceName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public GroupContract call(GroupContractInner inner) { + return new GroupContractImpl(inner, manager()); + } + }); + } + + @Override + public Completable getEntityTagAsync(String resourceGroupName, String serviceName, String groupId) { + GroupsInner client = this.inner(); + return client.getEntityTagAsync(resourceGroupName, serviceName, groupId).toCompletable(); + } + + @Override + public Observable getAsync(String resourceGroupName, String serviceName, String groupId) { + GroupsInner client = this.inner(); + return client.getAsync(resourceGroupName, serviceName, groupId) + .map(new Func1() { + @Override + public GroupContract call(GroupContractInner inner) { + return new GroupContractImpl(inner, manager()); + } + }); + } + + @Override + public Completable deleteAsync(String resourceGroupName, String serviceName, String groupId, String ifMatch) { + GroupsInner client = this.inner(); + return client.deleteAsync(resourceGroupName, serviceName, groupId, ifMatch).toCompletable(); + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/GroupsInner.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/GroupsInner.java new file mode 100644 index 0000000000000..5e52193a5687c --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/GroupsInner.java @@ -0,0 +1,1063 @@ +/** + * 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.apimanagement.v2019_01_01.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.apimanagement.v2019_01_01.ErrorResponseException; +import com.microsoft.azure.management.apimanagement.v2019_01_01.GroupCreateOrUpdateHeaders; +import com.microsoft.azure.management.apimanagement.v2019_01_01.GroupCreateParameters; +import com.microsoft.azure.management.apimanagement.v2019_01_01.GroupGetEntityTagHeaders; +import com.microsoft.azure.management.apimanagement.v2019_01_01.GroupGetHeaders; +import com.microsoft.azure.management.apimanagement.v2019_01_01.GroupUpdateParameters; +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.ServiceResponseWithHeaders; +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.HEAD; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.HTTP; +import retrofit2.http.PATCH; +import retrofit2.http.Path; +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 Groups. + */ +public class GroupsInner { + /** The Retrofit service to perform REST calls. */ + private GroupsService service; + /** The service client containing this operation class. */ + private ApiManagementClientImpl client; + + /** + * Initializes an instance of GroupsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public GroupsInner(Retrofit retrofit, ApiManagementClientImpl client) { + this.service = retrofit.create(GroupsService.class); + this.client = client; + } + + /** + * The interface defining all the services for Groups to be + * used by Retrofit to perform actually REST calls. + */ + interface GroupsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.apimanagement.v2019_01_01.Groups listByService" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/groups") + Observable> listByService(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("subscriptionId") String subscriptionId, @Query("$filter") String filter, @Query("$top") Integer top, @Query("$skip") Integer skip, @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.apimanagement.v2019_01_01.Groups getEntityTag" }) + @HEAD("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/groups/{groupId}") + Observable> getEntityTag(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("groupId") String groupId, @Path("subscriptionId") String subscriptionId, @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.apimanagement.v2019_01_01.Groups get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/groups/{groupId}") + Observable> get(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("groupId") String groupId, @Path("subscriptionId") String subscriptionId, @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.apimanagement.v2019_01_01.Groups createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/groups/{groupId}") + Observable> createOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("groupId") String groupId, @Path("subscriptionId") String subscriptionId, @Body GroupCreateParameters parameters, @Header("If-Match") String ifMatch, @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.apimanagement.v2019_01_01.Groups update" }) + @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/groups/{groupId}") + Observable> update(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("groupId") String groupId, @Path("subscriptionId") String subscriptionId, @Body GroupUpdateParameters parameters, @Header("If-Match") String ifMatch, @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.apimanagement.v2019_01_01.Groups delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/groups/{groupId}", method = "DELETE", hasBody = true) + Observable> delete(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("groupId") String groupId, @Path("subscriptionId") String subscriptionId, @Header("If-Match") String ifMatch, @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.apimanagement.v2019_01_01.Groups listByServiceNext" }) + @GET + Observable> listByServiceNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Lists a collection of groups defined within a service instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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<GroupContractInner> object if successful. + */ + public PagedList listByService(final String resourceGroupName, final String serviceName) { + ServiceResponse> response = listByServiceSinglePageAsync(resourceGroupName, serviceName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByServiceNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists a collection of groups defined within a service instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @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> listByServiceAsync(final String resourceGroupName, final String serviceName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByServiceSinglePageAsync(resourceGroupName, serviceName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByServiceNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists a collection of groups defined within a service instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<GroupContractInner> object + */ + public Observable> listByServiceAsync(final String resourceGroupName, final String serviceName) { + return listByServiceWithServiceResponseAsync(resourceGroupName, serviceName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists a collection of groups defined within a service instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<GroupContractInner> object + */ + public Observable>> listByServiceWithServiceResponseAsync(final String resourceGroupName, final String serviceName) { + return listByServiceSinglePageAsync(resourceGroupName, serviceName) + .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(listByServiceNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists a collection of groups defined within a service instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<GroupContractInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByServiceSinglePageAsync(final String resourceGroupName, final String serviceName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + 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 filter = null; + final Integer top = null; + final Integer skip = null; + return service.listByService(resourceGroupName, serviceName, this.client.subscriptionId(), filter, top, skip, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByServiceDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Lists a collection of groups defined within a service instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| aadObjectId | filter | eq | | </br> + * @param top Number of records to return. + * @param skip Number of records to skip. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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<GroupContractInner> object if successful. + */ + public PagedList listByService(final String resourceGroupName, final String serviceName, final String filter, final Integer top, final Integer skip) { + ServiceResponse> response = listByServiceSinglePageAsync(resourceGroupName, serviceName, filter, top, skip).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByServiceNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists a collection of groups defined within a service instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| aadObjectId | filter | eq | | </br> + * @param top Number of records to return. + * @param skip Number of records to skip. + * @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> listByServiceAsync(final String resourceGroupName, final String serviceName, final String filter, final Integer top, final Integer skip, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByServiceSinglePageAsync(resourceGroupName, serviceName, filter, top, skip), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByServiceNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists a collection of groups defined within a service instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| aadObjectId | filter | eq | | </br> + * @param top Number of records to return. + * @param skip Number of records to skip. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<GroupContractInner> object + */ + public Observable> listByServiceAsync(final String resourceGroupName, final String serviceName, final String filter, final Integer top, final Integer skip) { + return listByServiceWithServiceResponseAsync(resourceGroupName, serviceName, filter, top, skip) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists a collection of groups defined within a service instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| aadObjectId | filter | eq | | </br> + * @param top Number of records to return. + * @param skip Number of records to skip. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<GroupContractInner> object + */ + public Observable>> listByServiceWithServiceResponseAsync(final String resourceGroupName, final String serviceName, final String filter, final Integer top, final Integer skip) { + return listByServiceSinglePageAsync(resourceGroupName, serviceName, filter, top, skip) + .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(listByServiceNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists a collection of groups defined within a service instance. + * + ServiceResponse> * @param resourceGroupName The name of the resource group. + ServiceResponse> * @param serviceName The name of the API Management service. + ServiceResponse> * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| aadObjectId | filter | eq | | </br> + ServiceResponse> * @param top Number of records to return. + ServiceResponse> * @param skip Number of records to skip. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<GroupContractInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByServiceSinglePageAsync(final String resourceGroupName, final String serviceName, final String filter, final Integer top, final Integer skip) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + 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.listByService(resourceGroupName, serviceName, this.client.subscriptionId(), filter, top, skip, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByServiceDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByServiceDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Gets the entity state (Etag) version of the group specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param groupId Group identifier. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void getEntityTag(String resourceGroupName, String serviceName, String groupId) { + getEntityTagWithServiceResponseAsync(resourceGroupName, serviceName, groupId).toBlocking().single().body(); + } + + /** + * Gets the entity state (Etag) version of the group specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param groupId Group identifier. Must be unique in the current API Management service instance. + * @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 getEntityTagAsync(String resourceGroupName, String serviceName, String groupId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(getEntityTagWithServiceResponseAsync(resourceGroupName, serviceName, groupId), serviceCallback); + } + + /** + * Gets the entity state (Etag) version of the group specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param groupId Group identifier. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public Observable getEntityTagAsync(String resourceGroupName, String serviceName, String groupId) { + return getEntityTagWithServiceResponseAsync(resourceGroupName, serviceName, groupId).map(new Func1, Void>() { + @Override + public Void call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Gets the entity state (Etag) version of the group specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param groupId Group identifier. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public Observable> getEntityTagWithServiceResponseAsync(String resourceGroupName, String serviceName, String groupId) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (groupId == null) { + throw new IllegalArgumentException("Parameter groupId is required and cannot be null."); + } + 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.getEntityTag(resourceGroupName, serviceName, groupId, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = getEntityTagDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponseWithHeaders getEntityTagDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .buildEmptyWithHeaders(response, GroupGetEntityTagHeaders.class); + } + + /** + * Gets the details of the group specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param groupId Group identifier. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the GroupContractInner object if successful. + */ + public GroupContractInner get(String resourceGroupName, String serviceName, String groupId) { + return getWithServiceResponseAsync(resourceGroupName, serviceName, groupId).toBlocking().single().body(); + } + + /** + * Gets the details of the group specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param groupId Group identifier. Must be unique in the current API Management service instance. + * @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 getAsync(String resourceGroupName, String serviceName, String groupId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(getWithServiceResponseAsync(resourceGroupName, serviceName, groupId), serviceCallback); + } + + /** + * Gets the details of the group specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param groupId Group identifier. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the GroupContractInner object + */ + public Observable getAsync(String resourceGroupName, String serviceName, String groupId) { + return getWithServiceResponseAsync(resourceGroupName, serviceName, groupId).map(new Func1, GroupContractInner>() { + @Override + public GroupContractInner call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Gets the details of the group specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param groupId Group identifier. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the GroupContractInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String serviceName, String groupId) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (groupId == null) { + throw new IllegalArgumentException("Parameter groupId is required and cannot be null."); + } + 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.get(resourceGroupName, serviceName, groupId, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = getDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponseWithHeaders getDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .buildWithHeaders(response, GroupGetHeaders.class); + } + + /** + * Creates or Updates a group. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param groupId Group identifier. Must be unique in the current API Management service instance. + * @param parameters Create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the GroupContractInner object if successful. + */ + public GroupContractInner createOrUpdate(String resourceGroupName, String serviceName, String groupId, GroupCreateParameters parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serviceName, groupId, parameters).toBlocking().single().body(); + } + + /** + * Creates or Updates a group. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param groupId Group identifier. Must be unique in the current API Management service instance. + * @param parameters Create parameters. + * @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 createOrUpdateAsync(String resourceGroupName, String serviceName, String groupId, GroupCreateParameters parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, serviceName, groupId, parameters), serviceCallback); + } + + /** + * Creates or Updates a group. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param groupId Group identifier. Must be unique in the current API Management service instance. + * @param parameters Create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the GroupContractInner object + */ + public Observable createOrUpdateAsync(String resourceGroupName, String serviceName, String groupId, GroupCreateParameters parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serviceName, groupId, parameters).map(new Func1, GroupContractInner>() { + @Override + public GroupContractInner call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Creates or Updates a group. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param groupId Group identifier. Must be unique in the current API Management service instance. + * @param parameters Create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the GroupContractInner object + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String serviceName, String groupId, GroupCreateParameters parameters) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (groupId == null) { + throw new IllegalArgumentException("Parameter groupId is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(parameters); + final String ifMatch = null; + return service.createOrUpdate(resourceGroupName, serviceName, groupId, this.client.subscriptionId(), parameters, ifMatch, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = createOrUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Creates or Updates a group. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param groupId Group identifier. Must be unique in the current API Management service instance. + * @param parameters Create parameters. + * @param ifMatch ETag of the Entity. Not required when creating an entity, but required when updating an entity. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the GroupContractInner object if successful. + */ + public GroupContractInner createOrUpdate(String resourceGroupName, String serviceName, String groupId, GroupCreateParameters parameters, String ifMatch) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serviceName, groupId, parameters, ifMatch).toBlocking().single().body(); + } + + /** + * Creates or Updates a group. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param groupId Group identifier. Must be unique in the current API Management service instance. + * @param parameters Create parameters. + * @param ifMatch ETag of the Entity. Not required when creating an entity, but required when updating an entity. + * @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 createOrUpdateAsync(String resourceGroupName, String serviceName, String groupId, GroupCreateParameters parameters, String ifMatch, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, serviceName, groupId, parameters, ifMatch), serviceCallback); + } + + /** + * Creates or Updates a group. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param groupId Group identifier. Must be unique in the current API Management service instance. + * @param parameters Create parameters. + * @param ifMatch ETag of the Entity. Not required when creating an entity, but required when updating an entity. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the GroupContractInner object + */ + public Observable createOrUpdateAsync(String resourceGroupName, String serviceName, String groupId, GroupCreateParameters parameters, String ifMatch) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serviceName, groupId, parameters, ifMatch).map(new Func1, GroupContractInner>() { + @Override + public GroupContractInner call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Creates or Updates a group. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param groupId Group identifier. Must be unique in the current API Management service instance. + * @param parameters Create parameters. + * @param ifMatch ETag of the Entity. Not required when creating an entity, but required when updating an entity. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the GroupContractInner object + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String serviceName, String groupId, GroupCreateParameters parameters, String ifMatch) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (groupId == null) { + throw new IllegalArgumentException("Parameter groupId is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(parameters); + return service.createOrUpdate(resourceGroupName, serviceName, groupId, this.client.subscriptionId(), parameters, ifMatch, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = createOrUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponseWithHeaders createOrUpdateDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(201, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .buildWithHeaders(response, GroupCreateOrUpdateHeaders.class); + } + + /** + * Updates the details of the group specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param groupId Group identifier. Must be unique in the current API Management service instance. + * @param parameters Update parameters. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void update(String resourceGroupName, String serviceName, String groupId, GroupUpdateParameters parameters, String ifMatch) { + updateWithServiceResponseAsync(resourceGroupName, serviceName, groupId, parameters, ifMatch).toBlocking().single().body(); + } + + /** + * Updates the details of the group specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param groupId Group identifier. Must be unique in the current API Management service instance. + * @param parameters Update parameters. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @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 serviceName, String groupId, GroupUpdateParameters parameters, String ifMatch, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateWithServiceResponseAsync(resourceGroupName, serviceName, groupId, parameters, ifMatch), serviceCallback); + } + + /** + * Updates the details of the group specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param groupId Group identifier. Must be unique in the current API Management service instance. + * @param parameters Update parameters. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable updateAsync(String resourceGroupName, String serviceName, String groupId, GroupUpdateParameters parameters, String ifMatch) { + return updateWithServiceResponseAsync(resourceGroupName, serviceName, groupId, parameters, ifMatch).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates the details of the group specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param groupId Group identifier. Must be unique in the current API Management service instance. + * @param parameters Update parameters. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> updateWithServiceResponseAsync(String resourceGroupName, String serviceName, String groupId, GroupUpdateParameters parameters, String ifMatch) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (groupId == null) { + throw new IllegalArgumentException("Parameter groupId is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + if (ifMatch == null) { + throw new IllegalArgumentException("Parameter ifMatch is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(parameters); + return service.update(resourceGroupName, serviceName, groupId, this.client.subscriptionId(), parameters, ifMatch, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = updateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse updateDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(204, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Deletes specific group of the API Management service instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param groupId Group identifier. Must be unique in the current API Management service instance. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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 serviceName, String groupId, String ifMatch) { + deleteWithServiceResponseAsync(resourceGroupName, serviceName, groupId, ifMatch).toBlocking().single().body(); + } + + /** + * Deletes specific group of the API Management service instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param groupId Group identifier. Must be unique in the current API Management service instance. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @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 serviceName, String groupId, String ifMatch, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, serviceName, groupId, ifMatch), serviceCallback); + } + + /** + * Deletes specific group of the API Management service instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param groupId Group identifier. Must be unique in the current API Management service instance. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable deleteAsync(String resourceGroupName, String serviceName, String groupId, String ifMatch) { + return deleteWithServiceResponseAsync(resourceGroupName, serviceName, groupId, ifMatch).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes specific group of the API Management service instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param groupId Group identifier. Must be unique in the current API Management service instance. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> deleteWithServiceResponseAsync(String resourceGroupName, String serviceName, String groupId, String ifMatch) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (groupId == null) { + throw new IllegalArgumentException("Parameter groupId is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (ifMatch == null) { + throw new IllegalArgumentException("Parameter ifMatch 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.delete(resourceGroupName, serviceName, groupId, this.client.subscriptionId(), ifMatch, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = deleteDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse deleteDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(204, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists a collection of groups defined within a service instance. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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<GroupContractInner> object if successful. + */ + public PagedList listByServiceNext(final String nextPageLink) { + ServiceResponse> response = listByServiceNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByServiceNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists a collection of groups defined within a service instance. + * + * @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> listByServiceNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByServiceNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByServiceNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists a collection of groups defined within a service instance. + * + * @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<GroupContractInner> object + */ + public Observable> listByServiceNextAsync(final String nextPageLink) { + return listByServiceNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists a collection of groups defined within a service instance. + * + * @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<GroupContractInner> object + */ + public Observable>> listByServiceNextWithServiceResponseAsync(final String nextPageLink) { + return listByServiceNextSinglePageAsync(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(listByServiceNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists a collection of groups defined within a service instance. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<GroupContractInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByServiceNextSinglePageAsync(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.listByServiceNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByServiceNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByServiceNextDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/IdParsingUtils.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/IdParsingUtils.java new file mode 100644 index 0000000000000..4a5075e50f5d9 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/IdParsingUtils.java @@ -0,0 +1,57 @@ +/** + * 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.apimanagement.v2019_01_01.implementation; +import java.util.Arrays; +import java.util.Iterator; + +class IdParsingUtils { + public static String getValueFromIdByName(String id, String name) { + if (id == null) { + return null; + } + Iterable iterable = Arrays.asList(id.split("/")); + Iterator itr = iterable.iterator(); + while (itr.hasNext()) { + String part = itr.next(); + if (part != null && part.trim() != "") { + if (part.equalsIgnoreCase(name)) { + if (itr.hasNext()) { + return itr.next(); + } else { + return null; + } + } + } + } + return null; + } + + public static String getValueFromIdByPosition(String id, int pos) { + if (id == null) { + return null; + } + Iterable iterable = Arrays.asList(id.split("/")); + Iterator itr = iterable.iterator(); + int index = 0; + while (itr.hasNext()) { + String part = itr.next(); + if (part != null && part.trim() != "") { + if (index == pos) { + if (itr.hasNext()) { + return itr.next(); + } else { + return null; + } + } + } + index++; + } + return null; + } +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/IdentityProviderContractImpl.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/IdentityProviderContractImpl.java new file mode 100644 index 0000000000000..ff4a6b5603e8a --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/IdentityProviderContractImpl.java @@ -0,0 +1,213 @@ +/** + * 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.apimanagement.v2019_01_01.implementation; + +import com.microsoft.azure.management.apimanagement.v2019_01_01.IdentityProviderContract; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import com.microsoft.azure.management.apimanagement.v2019_01_01.IdentityProviderType; +import java.util.List; + +class IdentityProviderContractImpl extends CreatableUpdatableImpl implements IdentityProviderContract, IdentityProviderContract.Definition, IdentityProviderContract.Update { + private String resourceGroupName; + private String serviceName; + private IdentityProviderType identityProviderName; + private String cifMatch; + private String uifMatch; + private final ApiManagementManager manager; + + IdentityProviderContractImpl(String name, ApiManagementManager manager) { + super(name, new IdentityProviderContractInner()); + this.manager = manager; + // Set resource name + this.identityProviderName = IdentityProviderType.fromString(name); + // + } + + IdentityProviderContractImpl(IdentityProviderContractInner inner, ApiManagementManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.identityProviderName = IdentityProviderType.fromString(inner.name()); + // set resource ancestor and positional variables + this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourceGroups"); + this.serviceName = IdParsingUtils.getValueFromIdByName(inner.id(), "service"); + this.identityProviderName = IdentityProviderType.fromString(IdParsingUtils.getValueFromIdByName(inner.id(), "identityProviders")); + // set other parameters for create and update + } + + @Override + public ApiManagementManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + IdentityProvidersInner client = this.manager().inner().identityProviders(); + return client.createOrUpdateAsync(this.resourceGroupName, this.serviceName, this.identityProviderName, this.inner(), this.cifMatch) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + IdentityProvidersInner client = this.manager().inner().identityProviders(); + return client.createOrUpdateAsync(this.resourceGroupName, this.serviceName, this.identityProviderName, this.inner(), this.uifMatch) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + IdentityProvidersInner client = this.manager().inner().identityProviders(); + return null; // NOP getInnerAsync implementation as get is not supported + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + + @Override + public List allowedTenants() { + return this.inner().allowedTenants(); + } + + @Override + public String authority() { + return this.inner().authority(); + } + + @Override + public String clientId() { + return this.inner().clientId(); + } + + @Override + public String clientSecret() { + return this.inner().clientSecret(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public IdentityProviderType identityProviderContractType() { + return this.inner().identityProviderContractType(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public String passwordResetPolicyName() { + return this.inner().passwordResetPolicyName(); + } + + @Override + public String profileEditingPolicyName() { + return this.inner().profileEditingPolicyName(); + } + + @Override + public String signinPolicyName() { + return this.inner().signinPolicyName(); + } + + @Override + public String signupPolicyName() { + return this.inner().signupPolicyName(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public IdentityProviderContractImpl withResourceGroupName(String resourceGroupName) { + this.resourceGroupName = resourceGroupName; + return this; + } + + @Override + public IdentityProviderContractImpl withServiceName(String serviceName) { + this.serviceName = serviceName; + return this; + } + + @Override + public IdentityProviderContractImpl withClientId(String clientId) { + this.inner().withClientId(clientId); + return this; + } + + @Override + public IdentityProviderContractImpl withClientSecret(String clientSecret) { + this.inner().withClientSecret(clientSecret); + return this; + } + + @Override + public IdentityProviderContractImpl withIfMatch(String ifMatch) { + if (isInCreateMode()) { + this.cifMatch = ifMatch; + } else { + this.uifMatch = ifMatch; + } + return this; + } + + @Override + public IdentityProviderContractImpl withAllowedTenants(List allowedTenants) { + this.inner().withAllowedTenants(allowedTenants); + return this; + } + + @Override + public IdentityProviderContractImpl withAuthority(String authority) { + this.inner().withAuthority(authority); + return this; + } + + @Override + public IdentityProviderContractImpl withIdentityProviderContractType(IdentityProviderType identityProviderContractType) { + this.inner().withIdentityProviderContractType(identityProviderContractType); + return this; + } + + @Override + public IdentityProviderContractImpl withPasswordResetPolicyName(String passwordResetPolicyName) { + this.inner().withPasswordResetPolicyName(passwordResetPolicyName); + return this; + } + + @Override + public IdentityProviderContractImpl withProfileEditingPolicyName(String profileEditingPolicyName) { + this.inner().withProfileEditingPolicyName(profileEditingPolicyName); + return this; + } + + @Override + public IdentityProviderContractImpl withSigninPolicyName(String signinPolicyName) { + this.inner().withSigninPolicyName(signinPolicyName); + return this; + } + + @Override + public IdentityProviderContractImpl withSignupPolicyName(String signupPolicyName) { + this.inner().withSignupPolicyName(signupPolicyName); + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/IdentityProviderContractInner.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/IdentityProviderContractInner.java new file mode 100644 index 0000000000000..9277d99dd32c5 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/IdentityProviderContractInner.java @@ -0,0 +1,261 @@ +/** + * 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.apimanagement.v2019_01_01.implementation; + +import com.microsoft.azure.management.apimanagement.v2019_01_01.IdentityProviderType; +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * Identity Provider details. + */ +@JsonFlatten +public class IdentityProviderContractInner extends ProxyResource { + /** + * Identity Provider Type identifier. Possible values include: 'facebook', + * 'google', 'microsoft', 'twitter', 'aad', 'aadB2C'. + */ + @JsonProperty(value = "properties.type") + private IdentityProviderType identityProviderContractType; + + /** + * List of Allowed Tenants when configuring Azure Active Directory login. + */ + @JsonProperty(value = "properties.allowedTenants") + private List allowedTenants; + + /** + * OpenID Connect discovery endpoint hostname for AAD or AAD B2C. + */ + @JsonProperty(value = "properties.authority") + private String authority; + + /** + * Signup Policy Name. Only applies to AAD B2C Identity Provider. + */ + @JsonProperty(value = "properties.signupPolicyName") + private String signupPolicyName; + + /** + * Signin Policy Name. Only applies to AAD B2C Identity Provider. + */ + @JsonProperty(value = "properties.signinPolicyName") + private String signinPolicyName; + + /** + * Profile Editing Policy Name. Only applies to AAD B2C Identity Provider. + */ + @JsonProperty(value = "properties.profileEditingPolicyName") + private String profileEditingPolicyName; + + /** + * Password Reset Policy Name. Only applies to AAD B2C Identity Provider. + */ + @JsonProperty(value = "properties.passwordResetPolicyName") + private String passwordResetPolicyName; + + /** + * Client Id of the Application in the external Identity Provider. It is + * App ID for Facebook login, Client ID for Google login, App ID for + * Microsoft. + */ + @JsonProperty(value = "properties.clientId", required = true) + private String clientId; + + /** + * Client secret of the Application in external Identity Provider, used to + * authenticate login request. For example, it is App Secret for Facebook + * login, API Key for Google login, Public Key for Microsoft. + */ + @JsonProperty(value = "properties.clientSecret", required = true) + private String clientSecret; + + /** + * Get identity Provider Type identifier. Possible values include: 'facebook', 'google', 'microsoft', 'twitter', 'aad', 'aadB2C'. + * + * @return the identityProviderContractType value + */ + public IdentityProviderType identityProviderContractType() { + return this.identityProviderContractType; + } + + /** + * Set identity Provider Type identifier. Possible values include: 'facebook', 'google', 'microsoft', 'twitter', 'aad', 'aadB2C'. + * + * @param identityProviderContractType the identityProviderContractType value to set + * @return the IdentityProviderContractInner object itself. + */ + public IdentityProviderContractInner withIdentityProviderContractType(IdentityProviderType identityProviderContractType) { + this.identityProviderContractType = identityProviderContractType; + return this; + } + + /** + * Get list of Allowed Tenants when configuring Azure Active Directory login. + * + * @return the allowedTenants value + */ + public List allowedTenants() { + return this.allowedTenants; + } + + /** + * Set list of Allowed Tenants when configuring Azure Active Directory login. + * + * @param allowedTenants the allowedTenants value to set + * @return the IdentityProviderContractInner object itself. + */ + public IdentityProviderContractInner withAllowedTenants(List allowedTenants) { + this.allowedTenants = allowedTenants; + return this; + } + + /** + * Get openID Connect discovery endpoint hostname for AAD or AAD B2C. + * + * @return the authority value + */ + public String authority() { + return this.authority; + } + + /** + * Set openID Connect discovery endpoint hostname for AAD or AAD B2C. + * + * @param authority the authority value to set + * @return the IdentityProviderContractInner object itself. + */ + public IdentityProviderContractInner withAuthority(String authority) { + this.authority = authority; + return this; + } + + /** + * Get signup Policy Name. Only applies to AAD B2C Identity Provider. + * + * @return the signupPolicyName value + */ + public String signupPolicyName() { + return this.signupPolicyName; + } + + /** + * Set signup Policy Name. Only applies to AAD B2C Identity Provider. + * + * @param signupPolicyName the signupPolicyName value to set + * @return the IdentityProviderContractInner object itself. + */ + public IdentityProviderContractInner withSignupPolicyName(String signupPolicyName) { + this.signupPolicyName = signupPolicyName; + return this; + } + + /** + * Get signin Policy Name. Only applies to AAD B2C Identity Provider. + * + * @return the signinPolicyName value + */ + public String signinPolicyName() { + return this.signinPolicyName; + } + + /** + * Set signin Policy Name. Only applies to AAD B2C Identity Provider. + * + * @param signinPolicyName the signinPolicyName value to set + * @return the IdentityProviderContractInner object itself. + */ + public IdentityProviderContractInner withSigninPolicyName(String signinPolicyName) { + this.signinPolicyName = signinPolicyName; + return this; + } + + /** + * Get profile Editing Policy Name. Only applies to AAD B2C Identity Provider. + * + * @return the profileEditingPolicyName value + */ + public String profileEditingPolicyName() { + return this.profileEditingPolicyName; + } + + /** + * Set profile Editing Policy Name. Only applies to AAD B2C Identity Provider. + * + * @param profileEditingPolicyName the profileEditingPolicyName value to set + * @return the IdentityProviderContractInner object itself. + */ + public IdentityProviderContractInner withProfileEditingPolicyName(String profileEditingPolicyName) { + this.profileEditingPolicyName = profileEditingPolicyName; + return this; + } + + /** + * Get password Reset Policy Name. Only applies to AAD B2C Identity Provider. + * + * @return the passwordResetPolicyName value + */ + public String passwordResetPolicyName() { + return this.passwordResetPolicyName; + } + + /** + * Set password Reset Policy Name. Only applies to AAD B2C Identity Provider. + * + * @param passwordResetPolicyName the passwordResetPolicyName value to set + * @return the IdentityProviderContractInner object itself. + */ + public IdentityProviderContractInner withPasswordResetPolicyName(String passwordResetPolicyName) { + this.passwordResetPolicyName = passwordResetPolicyName; + return this; + } + + /** + * Get client Id of the Application in the external Identity Provider. It is App ID for Facebook login, Client ID for Google login, App ID for Microsoft. + * + * @return the clientId value + */ + public String clientId() { + return this.clientId; + } + + /** + * Set client Id of the Application in the external Identity Provider. It is App ID for Facebook login, Client ID for Google login, App ID for Microsoft. + * + * @param clientId the clientId value to set + * @return the IdentityProviderContractInner object itself. + */ + public IdentityProviderContractInner withClientId(String clientId) { + this.clientId = clientId; + return this; + } + + /** + * Get client secret of the Application in external Identity Provider, used to authenticate login request. For example, it is App Secret for Facebook login, API Key for Google login, Public Key for Microsoft. + * + * @return the clientSecret value + */ + public String clientSecret() { + return this.clientSecret; + } + + /** + * Set client secret of the Application in external Identity Provider, used to authenticate login request. For example, it is App Secret for Facebook login, API Key for Google login, Public Key for Microsoft. + * + * @param clientSecret the clientSecret value to set + * @return the IdentityProviderContractInner object itself. + */ + public IdentityProviderContractInner withClientSecret(String clientSecret) { + this.clientSecret = clientSecret; + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/IdentityProvidersImpl.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/IdentityProvidersImpl.java new file mode 100644 index 0000000000000..9ea3913f1ec41 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/IdentityProvidersImpl.java @@ -0,0 +1,88 @@ +/** + * 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. + * jkl + */ + +package com.microsoft.azure.management.apimanagement.v2019_01_01.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.apimanagement.v2019_01_01.IdentityProviders; +import rx.Completable; +import rx.functions.Func1; +import rx.Observable; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.apimanagement.v2019_01_01.IdentityProviderContract; +import com.microsoft.azure.management.apimanagement.v2019_01_01.IdentityProviderType; + +class IdentityProvidersImpl extends WrapperImpl implements IdentityProviders { + private final ApiManagementManager manager; + + IdentityProvidersImpl(ApiManagementManager manager) { + super(manager.inner().identityProviders()); + this.manager = manager; + } + + public ApiManagementManager manager() { + return this.manager; + } + + @Override + public IdentityProviderContractImpl define(String name) { + return wrapModel(name); + } + + private IdentityProviderContractImpl wrapModel(IdentityProviderContractInner inner) { + return new IdentityProviderContractImpl(inner, manager()); + } + + private IdentityProviderContractImpl wrapModel(String name) { + return new IdentityProviderContractImpl(name, this.manager()); + } + + @Override + public Observable listByServiceAsync(final String resourceGroupName, final String serviceName) { + IdentityProvidersInner client = this.inner(); + return client.listByServiceAsync(resourceGroupName, serviceName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public IdentityProviderContract call(IdentityProviderContractInner inner) { + return new IdentityProviderContractImpl(inner, manager()); + } + }); + } + + @Override + public Completable getEntityTagAsync(String resourceGroupName, String serviceName, IdentityProviderType identityProviderName) { + IdentityProvidersInner client = this.inner(); + return client.getEntityTagAsync(resourceGroupName, serviceName, identityProviderName).toCompletable(); + } + + @Override + public Observable getAsync(String resourceGroupName, String serviceName, IdentityProviderType identityProviderName) { + IdentityProvidersInner client = this.inner(); + return client.getAsync(resourceGroupName, serviceName, identityProviderName) + .map(new Func1() { + @Override + public IdentityProviderContract call(IdentityProviderContractInner inner) { + return new IdentityProviderContractImpl(inner, manager()); + } + }); + } + + @Override + public Completable deleteAsync(String resourceGroupName, String serviceName, IdentityProviderType identityProviderName, String ifMatch) { + IdentityProvidersInner client = this.inner(); + return client.deleteAsync(resourceGroupName, serviceName, identityProviderName, ifMatch).toCompletable(); + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/IdentityProvidersInner.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/IdentityProvidersInner.java new file mode 100644 index 0000000000000..feaa6f5fe3226 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/IdentityProvidersInner.java @@ -0,0 +1,929 @@ +/** + * 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.apimanagement.v2019_01_01.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.apimanagement.v2019_01_01.ErrorResponseException; +import com.microsoft.azure.management.apimanagement.v2019_01_01.IdentityProviderCreateOrUpdateHeaders; +import com.microsoft.azure.management.apimanagement.v2019_01_01.IdentityProviderGetEntityTagHeaders; +import com.microsoft.azure.management.apimanagement.v2019_01_01.IdentityProviderGetHeaders; +import com.microsoft.azure.management.apimanagement.v2019_01_01.IdentityProviderType; +import com.microsoft.azure.management.apimanagement.v2019_01_01.IdentityProviderUpdateParameters; +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.ServiceResponseWithHeaders; +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.HEAD; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.HTTP; +import retrofit2.http.PATCH; +import retrofit2.http.Path; +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 IdentityProviders. + */ +public class IdentityProvidersInner { + /** The Retrofit service to perform REST calls. */ + private IdentityProvidersService service; + /** The service client containing this operation class. */ + private ApiManagementClientImpl client; + + /** + * Initializes an instance of IdentityProvidersInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public IdentityProvidersInner(Retrofit retrofit, ApiManagementClientImpl client) { + this.service = retrofit.create(IdentityProvidersService.class); + this.client = client; + } + + /** + * The interface defining all the services for IdentityProviders to be + * used by Retrofit to perform actually REST calls. + */ + interface IdentityProvidersService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.apimanagement.v2019_01_01.IdentityProviders listByService" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/identityProviders") + Observable> listByService(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("subscriptionId") String subscriptionId, @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.apimanagement.v2019_01_01.IdentityProviders getEntityTag" }) + @HEAD("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/identityProviders/{identityProviderName}") + Observable> getEntityTag(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("identityProviderName") IdentityProviderType identityProviderName, @Path("subscriptionId") String subscriptionId, @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.apimanagement.v2019_01_01.IdentityProviders get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/identityProviders/{identityProviderName}") + Observable> get(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("identityProviderName") IdentityProviderType identityProviderName, @Path("subscriptionId") String subscriptionId, @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.apimanagement.v2019_01_01.IdentityProviders createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/identityProviders/{identityProviderName}") + Observable> createOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("identityProviderName") IdentityProviderType identityProviderName, @Path("subscriptionId") String subscriptionId, @Body IdentityProviderContractInner parameters, @Header("If-Match") String ifMatch, @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.apimanagement.v2019_01_01.IdentityProviders update" }) + @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/identityProviders/{identityProviderName}") + Observable> update(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("identityProviderName") IdentityProviderType identityProviderName, @Path("subscriptionId") String subscriptionId, @Body IdentityProviderUpdateParameters parameters, @Header("If-Match") String ifMatch, @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.apimanagement.v2019_01_01.IdentityProviders delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/identityProviders/{identityProviderName}", method = "DELETE", hasBody = true) + Observable> delete(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("identityProviderName") IdentityProviderType identityProviderName, @Path("subscriptionId") String subscriptionId, @Header("If-Match") String ifMatch, @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.apimanagement.v2019_01_01.IdentityProviders listByServiceNext" }) + @GET + Observable> listByServiceNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Lists a collection of Identity Provider configured in the specified service instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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<IdentityProviderContractInner> object if successful. + */ + public PagedList listByService(final String resourceGroupName, final String serviceName) { + ServiceResponse> response = listByServiceSinglePageAsync(resourceGroupName, serviceName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByServiceNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists a collection of Identity Provider configured in the specified service instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @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> listByServiceAsync(final String resourceGroupName, final String serviceName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByServiceSinglePageAsync(resourceGroupName, serviceName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByServiceNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists a collection of Identity Provider configured in the specified service instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<IdentityProviderContractInner> object + */ + public Observable> listByServiceAsync(final String resourceGroupName, final String serviceName) { + return listByServiceWithServiceResponseAsync(resourceGroupName, serviceName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists a collection of Identity Provider configured in the specified service instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<IdentityProviderContractInner> object + */ + public Observable>> listByServiceWithServiceResponseAsync(final String resourceGroupName, final String serviceName) { + return listByServiceSinglePageAsync(resourceGroupName, serviceName) + .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(listByServiceNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists a collection of Identity Provider configured in the specified service instance. + * + ServiceResponse> * @param resourceGroupName The name of the resource group. + ServiceResponse> * @param serviceName The name of the API Management service. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<IdentityProviderContractInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByServiceSinglePageAsync(final String resourceGroupName, final String serviceName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + 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.listByService(resourceGroupName, serviceName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByServiceDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByServiceDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Gets the entity state (Etag) version of the identityProvider specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param identityProviderName Identity Provider Type identifier. Possible values include: 'facebook', 'google', 'microsoft', 'twitter', 'aad', 'aadB2C' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void getEntityTag(String resourceGroupName, String serviceName, IdentityProviderType identityProviderName) { + getEntityTagWithServiceResponseAsync(resourceGroupName, serviceName, identityProviderName).toBlocking().single().body(); + } + + /** + * Gets the entity state (Etag) version of the identityProvider specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param identityProviderName Identity Provider Type identifier. Possible values include: 'facebook', 'google', 'microsoft', 'twitter', 'aad', 'aadB2C' + * @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 getEntityTagAsync(String resourceGroupName, String serviceName, IdentityProviderType identityProviderName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(getEntityTagWithServiceResponseAsync(resourceGroupName, serviceName, identityProviderName), serviceCallback); + } + + /** + * Gets the entity state (Etag) version of the identityProvider specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param identityProviderName Identity Provider Type identifier. Possible values include: 'facebook', 'google', 'microsoft', 'twitter', 'aad', 'aadB2C' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public Observable getEntityTagAsync(String resourceGroupName, String serviceName, IdentityProviderType identityProviderName) { + return getEntityTagWithServiceResponseAsync(resourceGroupName, serviceName, identityProviderName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Gets the entity state (Etag) version of the identityProvider specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param identityProviderName Identity Provider Type identifier. Possible values include: 'facebook', 'google', 'microsoft', 'twitter', 'aad', 'aadB2C' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public Observable> getEntityTagWithServiceResponseAsync(String resourceGroupName, String serviceName, IdentityProviderType identityProviderName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (identityProviderName == null) { + throw new IllegalArgumentException("Parameter identityProviderName is required and cannot be null."); + } + 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.getEntityTag(resourceGroupName, serviceName, identityProviderName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = getEntityTagDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponseWithHeaders getEntityTagDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .buildEmptyWithHeaders(response, IdentityProviderGetEntityTagHeaders.class); + } + + /** + * Gets the configuration details of the identity Provider configured in specified service instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param identityProviderName Identity Provider Type identifier. Possible values include: 'facebook', 'google', 'microsoft', 'twitter', 'aad', 'aadB2C' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the IdentityProviderContractInner object if successful. + */ + public IdentityProviderContractInner get(String resourceGroupName, String serviceName, IdentityProviderType identityProviderName) { + return getWithServiceResponseAsync(resourceGroupName, serviceName, identityProviderName).toBlocking().single().body(); + } + + /** + * Gets the configuration details of the identity Provider configured in specified service instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param identityProviderName Identity Provider Type identifier. Possible values include: 'facebook', 'google', 'microsoft', 'twitter', 'aad', 'aadB2C' + * @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 getAsync(String resourceGroupName, String serviceName, IdentityProviderType identityProviderName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(getWithServiceResponseAsync(resourceGroupName, serviceName, identityProviderName), serviceCallback); + } + + /** + * Gets the configuration details of the identity Provider configured in specified service instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param identityProviderName Identity Provider Type identifier. Possible values include: 'facebook', 'google', 'microsoft', 'twitter', 'aad', 'aadB2C' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the IdentityProviderContractInner object + */ + public Observable getAsync(String resourceGroupName, String serviceName, IdentityProviderType identityProviderName) { + return getWithServiceResponseAsync(resourceGroupName, serviceName, identityProviderName).map(new Func1, IdentityProviderContractInner>() { + @Override + public IdentityProviderContractInner call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Gets the configuration details of the identity Provider configured in specified service instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param identityProviderName Identity Provider Type identifier. Possible values include: 'facebook', 'google', 'microsoft', 'twitter', 'aad', 'aadB2C' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the IdentityProviderContractInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String serviceName, IdentityProviderType identityProviderName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (identityProviderName == null) { + throw new IllegalArgumentException("Parameter identityProviderName is required and cannot be null."); + } + 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.get(resourceGroupName, serviceName, identityProviderName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = getDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponseWithHeaders getDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .buildWithHeaders(response, IdentityProviderGetHeaders.class); + } + + /** + * Creates or Updates the IdentityProvider configuration. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param identityProviderName Identity Provider Type identifier. Possible values include: 'facebook', 'google', 'microsoft', 'twitter', 'aad', 'aadB2C' + * @param parameters Create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the IdentityProviderContractInner object if successful. + */ + public IdentityProviderContractInner createOrUpdate(String resourceGroupName, String serviceName, IdentityProviderType identityProviderName, IdentityProviderContractInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serviceName, identityProviderName, parameters).toBlocking().single().body(); + } + + /** + * Creates or Updates the IdentityProvider configuration. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param identityProviderName Identity Provider Type identifier. Possible values include: 'facebook', 'google', 'microsoft', 'twitter', 'aad', 'aadB2C' + * @param parameters Create parameters. + * @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 createOrUpdateAsync(String resourceGroupName, String serviceName, IdentityProviderType identityProviderName, IdentityProviderContractInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, serviceName, identityProviderName, parameters), serviceCallback); + } + + /** + * Creates or Updates the IdentityProvider configuration. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param identityProviderName Identity Provider Type identifier. Possible values include: 'facebook', 'google', 'microsoft', 'twitter', 'aad', 'aadB2C' + * @param parameters Create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the IdentityProviderContractInner object + */ + public Observable createOrUpdateAsync(String resourceGroupName, String serviceName, IdentityProviderType identityProviderName, IdentityProviderContractInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serviceName, identityProviderName, parameters).map(new Func1, IdentityProviderContractInner>() { + @Override + public IdentityProviderContractInner call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Creates or Updates the IdentityProvider configuration. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param identityProviderName Identity Provider Type identifier. Possible values include: 'facebook', 'google', 'microsoft', 'twitter', 'aad', 'aadB2C' + * @param parameters Create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the IdentityProviderContractInner object + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String serviceName, IdentityProviderType identityProviderName, IdentityProviderContractInner parameters) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (identityProviderName == null) { + throw new IllegalArgumentException("Parameter identityProviderName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(parameters); + final String ifMatch = null; + return service.createOrUpdate(resourceGroupName, serviceName, identityProviderName, this.client.subscriptionId(), parameters, ifMatch, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = createOrUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Creates or Updates the IdentityProvider configuration. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param identityProviderName Identity Provider Type identifier. Possible values include: 'facebook', 'google', 'microsoft', 'twitter', 'aad', 'aadB2C' + * @param parameters Create parameters. + * @param ifMatch ETag of the Entity. Not required when creating an entity, but required when updating an entity. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the IdentityProviderContractInner object if successful. + */ + public IdentityProviderContractInner createOrUpdate(String resourceGroupName, String serviceName, IdentityProviderType identityProviderName, IdentityProviderContractInner parameters, String ifMatch) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serviceName, identityProviderName, parameters, ifMatch).toBlocking().single().body(); + } + + /** + * Creates or Updates the IdentityProvider configuration. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param identityProviderName Identity Provider Type identifier. Possible values include: 'facebook', 'google', 'microsoft', 'twitter', 'aad', 'aadB2C' + * @param parameters Create parameters. + * @param ifMatch ETag of the Entity. Not required when creating an entity, but required when updating an entity. + * @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 createOrUpdateAsync(String resourceGroupName, String serviceName, IdentityProviderType identityProviderName, IdentityProviderContractInner parameters, String ifMatch, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, serviceName, identityProviderName, parameters, ifMatch), serviceCallback); + } + + /** + * Creates or Updates the IdentityProvider configuration. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param identityProviderName Identity Provider Type identifier. Possible values include: 'facebook', 'google', 'microsoft', 'twitter', 'aad', 'aadB2C' + * @param parameters Create parameters. + * @param ifMatch ETag of the Entity. Not required when creating an entity, but required when updating an entity. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the IdentityProviderContractInner object + */ + public Observable createOrUpdateAsync(String resourceGroupName, String serviceName, IdentityProviderType identityProviderName, IdentityProviderContractInner parameters, String ifMatch) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serviceName, identityProviderName, parameters, ifMatch).map(new Func1, IdentityProviderContractInner>() { + @Override + public IdentityProviderContractInner call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Creates or Updates the IdentityProvider configuration. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param identityProviderName Identity Provider Type identifier. Possible values include: 'facebook', 'google', 'microsoft', 'twitter', 'aad', 'aadB2C' + * @param parameters Create parameters. + * @param ifMatch ETag of the Entity. Not required when creating an entity, but required when updating an entity. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the IdentityProviderContractInner object + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String serviceName, IdentityProviderType identityProviderName, IdentityProviderContractInner parameters, String ifMatch) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (identityProviderName == null) { + throw new IllegalArgumentException("Parameter identityProviderName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(parameters); + return service.createOrUpdate(resourceGroupName, serviceName, identityProviderName, this.client.subscriptionId(), parameters, ifMatch, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = createOrUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponseWithHeaders createOrUpdateDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(201, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .buildWithHeaders(response, IdentityProviderCreateOrUpdateHeaders.class); + } + + /** + * Updates an existing IdentityProvider configuration. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param identityProviderName Identity Provider Type identifier. Possible values include: 'facebook', 'google', 'microsoft', 'twitter', 'aad', 'aadB2C' + * @param parameters Update parameters. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void update(String resourceGroupName, String serviceName, IdentityProviderType identityProviderName, IdentityProviderUpdateParameters parameters, String ifMatch) { + updateWithServiceResponseAsync(resourceGroupName, serviceName, identityProviderName, parameters, ifMatch).toBlocking().single().body(); + } + + /** + * Updates an existing IdentityProvider configuration. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param identityProviderName Identity Provider Type identifier. Possible values include: 'facebook', 'google', 'microsoft', 'twitter', 'aad', 'aadB2C' + * @param parameters Update parameters. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @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 serviceName, IdentityProviderType identityProviderName, IdentityProviderUpdateParameters parameters, String ifMatch, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateWithServiceResponseAsync(resourceGroupName, serviceName, identityProviderName, parameters, ifMatch), serviceCallback); + } + + /** + * Updates an existing IdentityProvider configuration. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param identityProviderName Identity Provider Type identifier. Possible values include: 'facebook', 'google', 'microsoft', 'twitter', 'aad', 'aadB2C' + * @param parameters Update parameters. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable updateAsync(String resourceGroupName, String serviceName, IdentityProviderType identityProviderName, IdentityProviderUpdateParameters parameters, String ifMatch) { + return updateWithServiceResponseAsync(resourceGroupName, serviceName, identityProviderName, parameters, ifMatch).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates an existing IdentityProvider configuration. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param identityProviderName Identity Provider Type identifier. Possible values include: 'facebook', 'google', 'microsoft', 'twitter', 'aad', 'aadB2C' + * @param parameters Update parameters. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> updateWithServiceResponseAsync(String resourceGroupName, String serviceName, IdentityProviderType identityProviderName, IdentityProviderUpdateParameters parameters, String ifMatch) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (identityProviderName == null) { + throw new IllegalArgumentException("Parameter identityProviderName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + if (ifMatch == null) { + throw new IllegalArgumentException("Parameter ifMatch is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(parameters); + return service.update(resourceGroupName, serviceName, identityProviderName, this.client.subscriptionId(), parameters, ifMatch, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = updateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse updateDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(204, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Deletes the specified identity provider configuration. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param identityProviderName Identity Provider Type identifier. Possible values include: 'facebook', 'google', 'microsoft', 'twitter', 'aad', 'aadB2C' + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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 serviceName, IdentityProviderType identityProviderName, String ifMatch) { + deleteWithServiceResponseAsync(resourceGroupName, serviceName, identityProviderName, ifMatch).toBlocking().single().body(); + } + + /** + * Deletes the specified identity provider configuration. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param identityProviderName Identity Provider Type identifier. Possible values include: 'facebook', 'google', 'microsoft', 'twitter', 'aad', 'aadB2C' + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @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 serviceName, IdentityProviderType identityProviderName, String ifMatch, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, serviceName, identityProviderName, ifMatch), serviceCallback); + } + + /** + * Deletes the specified identity provider configuration. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param identityProviderName Identity Provider Type identifier. Possible values include: 'facebook', 'google', 'microsoft', 'twitter', 'aad', 'aadB2C' + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable deleteAsync(String resourceGroupName, String serviceName, IdentityProviderType identityProviderName, String ifMatch) { + return deleteWithServiceResponseAsync(resourceGroupName, serviceName, identityProviderName, ifMatch).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes the specified identity provider configuration. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param identityProviderName Identity Provider Type identifier. Possible values include: 'facebook', 'google', 'microsoft', 'twitter', 'aad', 'aadB2C' + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> deleteWithServiceResponseAsync(String resourceGroupName, String serviceName, IdentityProviderType identityProviderName, String ifMatch) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (identityProviderName == null) { + throw new IllegalArgumentException("Parameter identityProviderName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (ifMatch == null) { + throw new IllegalArgumentException("Parameter ifMatch 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.delete(resourceGroupName, serviceName, identityProviderName, this.client.subscriptionId(), ifMatch, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = deleteDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse deleteDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(204, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists a collection of Identity Provider configured in the specified service instance. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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<IdentityProviderContractInner> object if successful. + */ + public PagedList listByServiceNext(final String nextPageLink) { + ServiceResponse> response = listByServiceNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByServiceNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists a collection of Identity Provider configured in the specified service instance. + * + * @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> listByServiceNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByServiceNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByServiceNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists a collection of Identity Provider configured in the specified service instance. + * + * @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<IdentityProviderContractInner> object + */ + public Observable> listByServiceNextAsync(final String nextPageLink) { + return listByServiceNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists a collection of Identity Provider configured in the specified service instance. + * + * @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<IdentityProviderContractInner> object + */ + public Observable>> listByServiceNextWithServiceResponseAsync(final String nextPageLink) { + return listByServiceNextSinglePageAsync(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(listByServiceNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists a collection of Identity Provider configured in the specified service instance. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<IdentityProviderContractInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByServiceNextSinglePageAsync(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.listByServiceNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByServiceNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByServiceNextDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/IssueAttachmentContractImpl.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/IssueAttachmentContractImpl.java new file mode 100644 index 0000000000000..97551734b3403 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/IssueAttachmentContractImpl.java @@ -0,0 +1,145 @@ +/** + * 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.apimanagement.v2019_01_01.implementation; + +import com.microsoft.azure.management.apimanagement.v2019_01_01.IssueAttachmentContract; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; + +class IssueAttachmentContractImpl extends CreatableUpdatableImpl implements IssueAttachmentContract, IssueAttachmentContract.Definition, IssueAttachmentContract.Update { + private final ApiManagementManager manager; + private String resourceGroupName; + private String serviceName; + private String apiId; + private String issueId; + private String attachmentId; + private String cifMatch; + private String uifMatch; + + IssueAttachmentContractImpl(String name, ApiManagementManager manager) { + super(name, new IssueAttachmentContractInner()); + this.manager = manager; + // Set resource name + this.attachmentId = name; + // + } + + IssueAttachmentContractImpl(IssueAttachmentContractInner inner, ApiManagementManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.attachmentId = inner.name(); + // set resource ancestor and positional variables + this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourceGroups"); + this.serviceName = IdParsingUtils.getValueFromIdByName(inner.id(), "service"); + this.apiId = IdParsingUtils.getValueFromIdByName(inner.id(), "apis"); + this.issueId = IdParsingUtils.getValueFromIdByName(inner.id(), "issues"); + this.attachmentId = IdParsingUtils.getValueFromIdByName(inner.id(), "attachments"); + // + } + + @Override + public ApiManagementManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + ApiIssueAttachmentsInner client = this.manager().inner().apiIssueAttachments(); + return client.createOrUpdateAsync(this.resourceGroupName, this.serviceName, this.apiId, this.issueId, this.attachmentId, this.inner(), this.cifMatch) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + ApiIssueAttachmentsInner client = this.manager().inner().apiIssueAttachments(); + return client.createOrUpdateAsync(this.resourceGroupName, this.serviceName, this.apiId, this.issueId, this.attachmentId, this.inner(), this.uifMatch) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + ApiIssueAttachmentsInner client = this.manager().inner().apiIssueAttachments(); + return client.getAsync(this.resourceGroupName, this.serviceName, this.apiId, this.issueId, this.attachmentId); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + + @Override + public String content() { + return this.inner().content(); + } + + @Override + public String contentFormat() { + return this.inner().contentFormat(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public String title() { + return this.inner().title(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public IssueAttachmentContractImpl withExistingIssue(String resourceGroupName, String serviceName, String apiId, String issueId) { + this.resourceGroupName = resourceGroupName; + this.serviceName = serviceName; + this.apiId = apiId; + this.issueId = issueId; + return this; + } + + @Override + public IssueAttachmentContractImpl withContent(String content) { + this.inner().withContent(content); + return this; + } + + @Override + public IssueAttachmentContractImpl withContentFormat(String contentFormat) { + this.inner().withContentFormat(contentFormat); + return this; + } + + @Override + public IssueAttachmentContractImpl withTitle(String title) { + this.inner().withTitle(title); + return this; + } + + @Override + public IssueAttachmentContractImpl withIfMatch(String ifMatch) { + if (isInCreateMode()) { + this.cifMatch = ifMatch; + } else { + this.uifMatch = ifMatch; + } + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/IssueAttachmentContractInner.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/IssueAttachmentContractInner.java new file mode 100644 index 0000000000000..c3a777d502ec2 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/IssueAttachmentContractInner.java @@ -0,0 +1,99 @@ +/** + * 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.apimanagement.v2019_01_01.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * Issue Attachment Contract details. + */ +@JsonFlatten +public class IssueAttachmentContractInner extends ProxyResource { + /** + * Filename by which the binary data will be saved. + */ + @JsonProperty(value = "properties.title", required = true) + private String title; + + /** + * Either 'link' if content is provided via an HTTP link or the MIME type + * of the Base64-encoded binary data provided in the 'content' property. + */ + @JsonProperty(value = "properties.contentFormat", required = true) + private String contentFormat; + + /** + * An HTTP link or Base64-encoded binary data. + */ + @JsonProperty(value = "properties.content", required = true) + private String content; + + /** + * Get filename by which the binary data will be saved. + * + * @return the title value + */ + public String title() { + return this.title; + } + + /** + * Set filename by which the binary data will be saved. + * + * @param title the title value to set + * @return the IssueAttachmentContractInner object itself. + */ + public IssueAttachmentContractInner withTitle(String title) { + this.title = title; + return this; + } + + /** + * Get either 'link' if content is provided via an HTTP link or the MIME type of the Base64-encoded binary data provided in the 'content' property. + * + * @return the contentFormat value + */ + public String contentFormat() { + return this.contentFormat; + } + + /** + * Set either 'link' if content is provided via an HTTP link or the MIME type of the Base64-encoded binary data provided in the 'content' property. + * + * @param contentFormat the contentFormat value to set + * @return the IssueAttachmentContractInner object itself. + */ + public IssueAttachmentContractInner withContentFormat(String contentFormat) { + this.contentFormat = contentFormat; + return this; + } + + /** + * Get an HTTP link or Base64-encoded binary data. + * + * @return the content value + */ + public String content() { + return this.content; + } + + /** + * Set an HTTP link or Base64-encoded binary data. + * + * @param content the content value to set + * @return the IssueAttachmentContractInner object itself. + */ + public IssueAttachmentContractInner withContent(String content) { + this.content = content; + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/IssueCommentContractImpl.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/IssueCommentContractImpl.java new file mode 100644 index 0000000000000..b758587982eaf --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/IssueCommentContractImpl.java @@ -0,0 +1,146 @@ +/** + * 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.apimanagement.v2019_01_01.implementation; + +import com.microsoft.azure.management.apimanagement.v2019_01_01.IssueCommentContract; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import org.joda.time.DateTime; + +class IssueCommentContractImpl extends CreatableUpdatableImpl implements IssueCommentContract, IssueCommentContract.Definition, IssueCommentContract.Update { + private final ApiManagementManager manager; + private String resourceGroupName; + private String serviceName; + private String apiId; + private String issueId; + private String commentId; + private String cifMatch; + private String uifMatch; + + IssueCommentContractImpl(String name, ApiManagementManager manager) { + super(name, new IssueCommentContractInner()); + this.manager = manager; + // Set resource name + this.commentId = name; + // + } + + IssueCommentContractImpl(IssueCommentContractInner inner, ApiManagementManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.commentId = inner.name(); + // set resource ancestor and positional variables + this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourceGroups"); + this.serviceName = IdParsingUtils.getValueFromIdByName(inner.id(), "service"); + this.apiId = IdParsingUtils.getValueFromIdByName(inner.id(), "apis"); + this.issueId = IdParsingUtils.getValueFromIdByName(inner.id(), "issues"); + this.commentId = IdParsingUtils.getValueFromIdByName(inner.id(), "comments"); + // + } + + @Override + public ApiManagementManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + ApiIssueCommentsInner client = this.manager().inner().apiIssueComments(); + return client.createOrUpdateAsync(this.resourceGroupName, this.serviceName, this.apiId, this.issueId, this.commentId, this.inner(), this.cifMatch) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + ApiIssueCommentsInner client = this.manager().inner().apiIssueComments(); + return client.createOrUpdateAsync(this.resourceGroupName, this.serviceName, this.apiId, this.issueId, this.commentId, this.inner(), this.uifMatch) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + ApiIssueCommentsInner client = this.manager().inner().apiIssueComments(); + return client.getAsync(this.resourceGroupName, this.serviceName, this.apiId, this.issueId, this.commentId); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + + @Override + public DateTime createdDate() { + return this.inner().createdDate(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public String text() { + return this.inner().text(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public String userId() { + return this.inner().userId(); + } + + @Override + public IssueCommentContractImpl withExistingIssue(String resourceGroupName, String serviceName, String apiId, String issueId) { + this.resourceGroupName = resourceGroupName; + this.serviceName = serviceName; + this.apiId = apiId; + this.issueId = issueId; + return this; + } + + @Override + public IssueCommentContractImpl withText(String text) { + this.inner().withText(text); + return this; + } + + @Override + public IssueCommentContractImpl withUserId(String userId) { + this.inner().withUserId(userId); + return this; + } + + @Override + public IssueCommentContractImpl withIfMatch(String ifMatch) { + if (isInCreateMode()) { + this.cifMatch = ifMatch; + } else { + this.uifMatch = ifMatch; + } + return this; + } + + @Override + public IssueCommentContractImpl withCreatedDate(DateTime createdDate) { + this.inner().withCreatedDate(createdDate); + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/IssueCommentContractInner.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/IssueCommentContractInner.java new file mode 100644 index 0000000000000..415de33e46b6f --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/IssueCommentContractInner.java @@ -0,0 +1,99 @@ +/** + * 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.apimanagement.v2019_01_01.implementation; + +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * Issue Comment Contract details. + */ +@JsonFlatten +public class IssueCommentContractInner extends ProxyResource { + /** + * Comment text. + */ + @JsonProperty(value = "properties.text", required = true) + private String text; + + /** + * Date and time when the comment was created. + */ + @JsonProperty(value = "properties.createdDate") + private DateTime createdDate; + + /** + * A resource identifier for the user who left the comment. + */ + @JsonProperty(value = "properties.userId", required = true) + private String userId; + + /** + * Get comment text. + * + * @return the text value + */ + public String text() { + return this.text; + } + + /** + * Set comment text. + * + * @param text the text value to set + * @return the IssueCommentContractInner object itself. + */ + public IssueCommentContractInner withText(String text) { + this.text = text; + return this; + } + + /** + * Get date and time when the comment was created. + * + * @return the createdDate value + */ + public DateTime createdDate() { + return this.createdDate; + } + + /** + * Set date and time when the comment was created. + * + * @param createdDate the createdDate value to set + * @return the IssueCommentContractInner object itself. + */ + public IssueCommentContractInner withCreatedDate(DateTime createdDate) { + this.createdDate = createdDate; + return this; + } + + /** + * Get a resource identifier for the user who left the comment. + * + * @return the userId value + */ + public String userId() { + return this.userId; + } + + /** + * Set a resource identifier for the user who left the comment. + * + * @param userId the userId value to set + * @return the IssueCommentContractInner object itself. + */ + public IssueCommentContractInner withUserId(String userId) { + this.userId = userId; + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/IssueContractImpl.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/IssueContractImpl.java new file mode 100644 index 0000000000000..d014205d90eb0 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/IssueContractImpl.java @@ -0,0 +1,177 @@ +/** + * 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.apimanagement.v2019_01_01.implementation; + +import com.microsoft.azure.management.apimanagement.v2019_01_01.IssueContract; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import org.joda.time.DateTime; +import com.microsoft.azure.management.apimanagement.v2019_01_01.State; + +class IssueContractImpl extends CreatableUpdatableImpl implements IssueContract, IssueContract.Definition, IssueContract.Update { + private final ApiManagementManager manager; + private String resourceGroupName; + private String serviceName; + private String apiId; + private String issueId; + private String cifMatch; + private String uifMatch; + + IssueContractImpl(String name, ApiManagementManager manager) { + super(name, new IssueContractInner()); + this.manager = manager; + // Set resource name + this.issueId = name; + // + } + + IssueContractImpl(IssueContractInner inner, ApiManagementManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.issueId = inner.name(); + // set resource ancestor and positional variables + this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourceGroups"); + this.serviceName = IdParsingUtils.getValueFromIdByName(inner.id(), "service"); + this.apiId = IdParsingUtils.getValueFromIdByName(inner.id(), "apis"); + this.issueId = IdParsingUtils.getValueFromIdByName(inner.id(), "issues"); + // + } + + @Override + public ApiManagementManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + ApiIssuesInner client = this.manager().inner().apiIssues(); + return client.createOrUpdateAsync(this.resourceGroupName, this.serviceName, this.apiId, this.issueId, this.inner(), this.cifMatch) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + ApiIssuesInner client = this.manager().inner().apiIssues(); + return client.createOrUpdateAsync(this.resourceGroupName, this.serviceName, this.apiId, this.issueId, this.inner(), this.uifMatch) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + ApiIssuesInner client = this.manager().inner().apiIssues(); + return client.getAsync(this.resourceGroupName, this.serviceName, this.apiId, this.issueId); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + + @Override + public String apiId() { + return this.inner().apiId(); + } + + @Override + public DateTime createdDate() { + return this.inner().createdDate(); + } + + @Override + public String description() { + return this.inner().description(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public State state() { + return this.inner().state(); + } + + @Override + public String title() { + return this.inner().title(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public String userId() { + return this.inner().userId(); + } + + @Override + public IssueContractImpl withExistingApi(String resourceGroupName, String serviceName, String apiId) { + this.resourceGroupName = resourceGroupName; + this.serviceName = serviceName; + this.apiId = apiId; + return this; + } + + @Override + public IssueContractImpl withDescription(String description) { + this.inner().withDescription(description); + return this; + } + + @Override + public IssueContractImpl withTitle(String title) { + this.inner().withTitle(title); + return this; + } + + @Override + public IssueContractImpl withUserId(String userId) { + this.inner().withUserId(userId); + return this; + } + + @Override + public IssueContractImpl withIfMatch(String ifMatch) { + if (isInCreateMode()) { + this.cifMatch = ifMatch; + } else { + this.uifMatch = ifMatch; + } + return this; + } + + @Override + public IssueContractImpl withApiId(String apiId) { + this.inner().withApiId(apiId); + return this; + } + + @Override + public IssueContractImpl withCreatedDate(DateTime createdDate) { + this.inner().withCreatedDate(createdDate); + return this; + } + + @Override + public IssueContractImpl withState(State state) { + this.inner().withState(state); + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/IssueContractInner.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/IssueContractInner.java new file mode 100644 index 0000000000000..f2c320fa6ed63 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/IssueContractInner.java @@ -0,0 +1,179 @@ +/** + * 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.apimanagement.v2019_01_01.implementation; + +import org.joda.time.DateTime; +import com.microsoft.azure.management.apimanagement.v2019_01_01.State; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * Issue Contract details. + */ +@JsonFlatten +public class IssueContractInner extends ProxyResource { + /** + * Date and time when the issue was created. + */ + @JsonProperty(value = "properties.createdDate") + private DateTime createdDate; + + /** + * Status of the issue. Possible values include: 'proposed', 'open', + * 'removed', 'resolved', 'closed'. + */ + @JsonProperty(value = "properties.state") + private State state; + + /** + * A resource identifier for the API the issue was created for. + */ + @JsonProperty(value = "properties.apiId") + private String apiId; + + /** + * The issue title. + */ + @JsonProperty(value = "properties.title", required = true) + private String title; + + /** + * Text describing the issue. + */ + @JsonProperty(value = "properties.description", required = true) + private String description; + + /** + * A resource identifier for the user created the issue. + */ + @JsonProperty(value = "properties.userId", required = true) + private String userId; + + /** + * Get date and time when the issue was created. + * + * @return the createdDate value + */ + public DateTime createdDate() { + return this.createdDate; + } + + /** + * Set date and time when the issue was created. + * + * @param createdDate the createdDate value to set + * @return the IssueContractInner object itself. + */ + public IssueContractInner withCreatedDate(DateTime createdDate) { + this.createdDate = createdDate; + return this; + } + + /** + * Get status of the issue. Possible values include: 'proposed', 'open', 'removed', 'resolved', 'closed'. + * + * @return the state value + */ + public State state() { + return this.state; + } + + /** + * Set status of the issue. Possible values include: 'proposed', 'open', 'removed', 'resolved', 'closed'. + * + * @param state the state value to set + * @return the IssueContractInner object itself. + */ + public IssueContractInner withState(State state) { + this.state = state; + return this; + } + + /** + * Get a resource identifier for the API the issue was created for. + * + * @return the apiId value + */ + public String apiId() { + return this.apiId; + } + + /** + * Set a resource identifier for the API the issue was created for. + * + * @param apiId the apiId value to set + * @return the IssueContractInner object itself. + */ + public IssueContractInner withApiId(String apiId) { + this.apiId = apiId; + return this; + } + + /** + * Get the issue title. + * + * @return the title value + */ + public String title() { + return this.title; + } + + /** + * Set the issue title. + * + * @param title the title value to set + * @return the IssueContractInner object itself. + */ + public IssueContractInner withTitle(String title) { + this.title = title; + return this; + } + + /** + * Get text describing the issue. + * + * @return the description value + */ + public String description() { + return this.description; + } + + /** + * Set text describing the issue. + * + * @param description the description value to set + * @return the IssueContractInner object itself. + */ + public IssueContractInner withDescription(String description) { + this.description = description; + return this; + } + + /** + * Get a resource identifier for the user created the issue. + * + * @return the userId value + */ + public String userId() { + return this.userId; + } + + /** + * Set a resource identifier for the user created the issue. + * + * @param userId the userId value to set + * @return the IssueContractInner object itself. + */ + public IssueContractInner withUserId(String userId) { + this.userId = userId; + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/IssuesImpl.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/IssuesImpl.java new file mode 100644 index 0000000000000..6900ac5421e7d --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/IssuesImpl.java @@ -0,0 +1,61 @@ +/** + * 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. + * abc + */ + +package com.microsoft.azure.management.apimanagement.v2019_01_01.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.apimanagement.v2019_01_01.Issues; +import rx.functions.Func1; +import rx.Observable; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.apimanagement.v2019_01_01.IssueContract; + +class IssuesImpl extends WrapperImpl implements Issues { + private final ApiManagementManager manager; + + IssuesImpl(ApiManagementManager manager) { + super(manager.inner().issues()); + this.manager = manager; + } + + public ApiManagementManager manager() { + return this.manager; + } + + @Override + public Observable listByServiceAsync(final String resourceGroupName, final String serviceName) { + IssuesInner client = this.inner(); + return client.listByServiceAsync(resourceGroupName, serviceName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public IssueContract call(IssueContractInner inner) { + return new IssueContractImpl(inner, manager()); + } + }); + } + + @Override + public Observable getAsync(String resourceGroupName, String serviceName, String issueId) { + IssuesInner client = this.inner(); + return client.getAsync(resourceGroupName, serviceName, issueId) + .map(new Func1() { + @Override + public IssueContract call(IssueContractInner inner) { + return new IssueContractImpl(inner, manager()); + } + }); + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/IssuesInner.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/IssuesInner.java new file mode 100644 index 0000000000000..d84771af7d33f --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/IssuesInner.java @@ -0,0 +1,537 @@ +/** + * 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.apimanagement.v2019_01_01.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.apimanagement.v2019_01_01.ErrorResponseException; +import com.microsoft.azure.management.apimanagement.v2019_01_01.IssueGetHeaders; +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.ServiceResponseWithHeaders; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Path; +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 Issues. + */ +public class IssuesInner { + /** The Retrofit service to perform REST calls. */ + private IssuesService service; + /** The service client containing this operation class. */ + private ApiManagementClientImpl client; + + /** + * Initializes an instance of IssuesInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public IssuesInner(Retrofit retrofit, ApiManagementClientImpl client) { + this.service = retrofit.create(IssuesService.class); + this.client = client; + } + + /** + * The interface defining all the services for Issues to be + * used by Retrofit to perform actually REST calls. + */ + interface IssuesService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.apimanagement.v2019_01_01.Issues listByService" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/issues") + Observable> listByService(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("subscriptionId") String subscriptionId, @Query("$filter") String filter, @Query("$top") Integer top, @Query("$skip") Integer skip, @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.apimanagement.v2019_01_01.Issues get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/issues/{issueId}") + Observable> get(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("issueId") String issueId, @Path("subscriptionId") String subscriptionId, @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.apimanagement.v2019_01_01.Issues listByServiceNext" }) + @GET + Observable> listByServiceNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Lists a collection of issues in the specified service instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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<IssueContractInner> object if successful. + */ + public PagedList listByService(final String resourceGroupName, final String serviceName) { + ServiceResponse> response = listByServiceSinglePageAsync(resourceGroupName, serviceName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByServiceNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists a collection of issues in the specified service instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @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> listByServiceAsync(final String resourceGroupName, final String serviceName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByServiceSinglePageAsync(resourceGroupName, serviceName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByServiceNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists a collection of issues in the specified service instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<IssueContractInner> object + */ + public Observable> listByServiceAsync(final String resourceGroupName, final String serviceName) { + return listByServiceWithServiceResponseAsync(resourceGroupName, serviceName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists a collection of issues in the specified service instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<IssueContractInner> object + */ + public Observable>> listByServiceWithServiceResponseAsync(final String resourceGroupName, final String serviceName) { + return listByServiceSinglePageAsync(resourceGroupName, serviceName) + .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(listByServiceNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists a collection of issues in the specified service instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<IssueContractInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByServiceSinglePageAsync(final String resourceGroupName, final String serviceName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + 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 filter = null; + final Integer top = null; + final Integer skip = null; + return service.listByService(resourceGroupName, serviceName, this.client.subscriptionId(), filter, top, skip, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByServiceDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Lists a collection of issues in the specified service instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| apiId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| title | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| authorName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| state | filter | eq | | </br> + * @param top Number of records to return. + * @param skip Number of records to skip. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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<IssueContractInner> object if successful. + */ + public PagedList listByService(final String resourceGroupName, final String serviceName, final String filter, final Integer top, final Integer skip) { + ServiceResponse> response = listByServiceSinglePageAsync(resourceGroupName, serviceName, filter, top, skip).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByServiceNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists a collection of issues in the specified service instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| apiId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| title | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| authorName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| state | filter | eq | | </br> + * @param top Number of records to return. + * @param skip Number of records to skip. + * @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> listByServiceAsync(final String resourceGroupName, final String serviceName, final String filter, final Integer top, final Integer skip, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByServiceSinglePageAsync(resourceGroupName, serviceName, filter, top, skip), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByServiceNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists a collection of issues in the specified service instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| apiId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| title | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| authorName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| state | filter | eq | | </br> + * @param top Number of records to return. + * @param skip Number of records to skip. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<IssueContractInner> object + */ + public Observable> listByServiceAsync(final String resourceGroupName, final String serviceName, final String filter, final Integer top, final Integer skip) { + return listByServiceWithServiceResponseAsync(resourceGroupName, serviceName, filter, top, skip) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists a collection of issues in the specified service instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| apiId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| title | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| authorName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| state | filter | eq | | </br> + * @param top Number of records to return. + * @param skip Number of records to skip. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<IssueContractInner> object + */ + public Observable>> listByServiceWithServiceResponseAsync(final String resourceGroupName, final String serviceName, final String filter, final Integer top, final Integer skip) { + return listByServiceSinglePageAsync(resourceGroupName, serviceName, filter, top, skip) + .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(listByServiceNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists a collection of issues in the specified service instance. + * + ServiceResponse> * @param resourceGroupName The name of the resource group. + ServiceResponse> * @param serviceName The name of the API Management service. + ServiceResponse> * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| apiId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| title | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| authorName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| state | filter | eq | | </br> + ServiceResponse> * @param top Number of records to return. + ServiceResponse> * @param skip Number of records to skip. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<IssueContractInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByServiceSinglePageAsync(final String resourceGroupName, final String serviceName, final String filter, final Integer top, final Integer skip) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + 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.listByService(resourceGroupName, serviceName, this.client.subscriptionId(), filter, top, skip, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByServiceDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByServiceDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Gets API Management issue details. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param issueId Issue identifier. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the IssueContractInner object if successful. + */ + public IssueContractInner get(String resourceGroupName, String serviceName, String issueId) { + return getWithServiceResponseAsync(resourceGroupName, serviceName, issueId).toBlocking().single().body(); + } + + /** + * Gets API Management issue details. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param issueId Issue identifier. Must be unique in the current API Management service instance. + * @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 getAsync(String resourceGroupName, String serviceName, String issueId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(getWithServiceResponseAsync(resourceGroupName, serviceName, issueId), serviceCallback); + } + + /** + * Gets API Management issue details. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param issueId Issue identifier. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the IssueContractInner object + */ + public Observable getAsync(String resourceGroupName, String serviceName, String issueId) { + return getWithServiceResponseAsync(resourceGroupName, serviceName, issueId).map(new Func1, IssueContractInner>() { + @Override + public IssueContractInner call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Gets API Management issue details. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param issueId Issue identifier. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the IssueContractInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String serviceName, String issueId) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (issueId == null) { + throw new IllegalArgumentException("Parameter issueId is required and cannot be null."); + } + 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.get(resourceGroupName, serviceName, issueId, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = getDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponseWithHeaders getDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .buildWithHeaders(response, IssueGetHeaders.class); + } + + /** + * Lists a collection of issues in the specified service instance. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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<IssueContractInner> object if successful. + */ + public PagedList listByServiceNext(final String nextPageLink) { + ServiceResponse> response = listByServiceNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByServiceNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists a collection of issues in the specified service instance. + * + * @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> listByServiceNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByServiceNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByServiceNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists a collection of issues in the specified service instance. + * + * @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<IssueContractInner> object + */ + public Observable> listByServiceNextAsync(final String nextPageLink) { + return listByServiceNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists a collection of issues in the specified service instance. + * + * @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<IssueContractInner> object + */ + public Observable>> listByServiceNextWithServiceResponseAsync(final String nextPageLink) { + return listByServiceNextSinglePageAsync(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(listByServiceNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists a collection of issues in the specified service instance. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<IssueContractInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByServiceNextSinglePageAsync(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.listByServiceNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByServiceNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByServiceNextDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/LoggerContractImpl.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/LoggerContractImpl.java new file mode 100644 index 0000000000000..fce945885bee7 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/LoggerContractImpl.java @@ -0,0 +1,169 @@ +/** + * 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.apimanagement.v2019_01_01.implementation; + +import com.microsoft.azure.management.apimanagement.v2019_01_01.LoggerContract; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import com.microsoft.azure.management.apimanagement.v2019_01_01.LoggerType; +import java.util.Map; + +class LoggerContractImpl extends CreatableUpdatableImpl implements LoggerContract, LoggerContract.Definition, LoggerContract.Update { + private String resourceGroupName; + private String serviceName; + private String loggerId; + private String cifMatch; + private String uifMatch; + private final ApiManagementManager manager; + + LoggerContractImpl(String name, ApiManagementManager manager) { + super(name, new LoggerContractInner()); + this.manager = manager; + // Set resource name + this.loggerId = name; + // + } + + LoggerContractImpl(LoggerContractInner inner, ApiManagementManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.loggerId = inner.name(); + // set resource ancestor and positional variables + this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourceGroups"); + this.serviceName = IdParsingUtils.getValueFromIdByName(inner.id(), "service"); + this.loggerId = IdParsingUtils.getValueFromIdByName(inner.id(), "loggers"); + // set other parameters for create and update + } + + @Override + public ApiManagementManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + LoggersInner client = this.manager().inner().loggers(); + return client.createOrUpdateAsync(this.resourceGroupName, this.serviceName, this.loggerId, this.inner(), this.cifMatch) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + LoggersInner client = this.manager().inner().loggers(); + return client.createOrUpdateAsync(this.resourceGroupName, this.serviceName, this.loggerId, this.inner(), this.uifMatch) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + LoggersInner client = this.manager().inner().loggers(); + return null; // NOP getInnerAsync implementation as get is not supported + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + + @Override + public Map credentials() { + return this.inner().credentials(); + } + + @Override + public String description() { + return this.inner().description(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public Boolean isBuffered() { + return this.inner().isBuffered(); + } + + @Override + public LoggerType loggerType() { + return this.inner().loggerType(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public String resourceId() { + return this.inner().resourceId(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public LoggerContractImpl withResourceGroupName(String resourceGroupName) { + this.resourceGroupName = resourceGroupName; + return this; + } + + @Override + public LoggerContractImpl withServiceName(String serviceName) { + this.serviceName = serviceName; + return this; + } + + @Override + public LoggerContractImpl withCredentials(Map credentials) { + this.inner().withCredentials(credentials); + return this; + } + + @Override + public LoggerContractImpl withLoggerType(LoggerType loggerType) { + this.inner().withLoggerType(loggerType); + return this; + } + + @Override + public LoggerContractImpl withIfMatch(String ifMatch) { + if (isInCreateMode()) { + this.cifMatch = ifMatch; + } else { + this.uifMatch = ifMatch; + } + return this; + } + + @Override + public LoggerContractImpl withDescription(String description) { + this.inner().withDescription(description); + return this; + } + + @Override + public LoggerContractImpl withIsBuffered(Boolean isBuffered) { + this.inner().withIsBuffered(isBuffered); + return this; + } + + @Override + public LoggerContractImpl withResourceId(String resourceId) { + this.inner().withResourceId(resourceId); + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/LoggerContractInner.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/LoggerContractInner.java new file mode 100644 index 0000000000000..39fa4c29ee2bb --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/LoggerContractInner.java @@ -0,0 +1,159 @@ +/** + * 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.apimanagement.v2019_01_01.implementation; + +import com.microsoft.azure.management.apimanagement.v2019_01_01.LoggerType; +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * Logger details. + */ +@JsonFlatten +public class LoggerContractInner extends ProxyResource { + /** + * Logger type. Possible values include: 'azureEventHub', + * 'applicationInsights'. + */ + @JsonProperty(value = "properties.loggerType", required = true) + private LoggerType loggerType; + + /** + * Logger description. + */ + @JsonProperty(value = "properties.description") + private String description; + + /** + * The name and SendRule connection string of the event hub for + * azureEventHub logger. + * Instrumentation key for applicationInsights logger. + */ + @JsonProperty(value = "properties.credentials", required = true) + private Map credentials; + + /** + * Whether records are buffered in the logger before publishing. Default is + * assumed to be true. + */ + @JsonProperty(value = "properties.isBuffered") + private Boolean isBuffered; + + /** + * Azure Resource Id of a log target (either Azure Event Hub resource or + * Azure Application Insights resource). + */ + @JsonProperty(value = "properties.resourceId") + private String resourceId; + + /** + * Get logger type. Possible values include: 'azureEventHub', 'applicationInsights'. + * + * @return the loggerType value + */ + public LoggerType loggerType() { + return this.loggerType; + } + + /** + * Set logger type. Possible values include: 'azureEventHub', 'applicationInsights'. + * + * @param loggerType the loggerType value to set + * @return the LoggerContractInner object itself. + */ + public LoggerContractInner withLoggerType(LoggerType loggerType) { + this.loggerType = loggerType; + return this; + } + + /** + * Get logger description. + * + * @return the description value + */ + public String description() { + return this.description; + } + + /** + * Set logger description. + * + * @param description the description value to set + * @return the LoggerContractInner object itself. + */ + public LoggerContractInner withDescription(String description) { + this.description = description; + return this; + } + + /** + * Get the name and SendRule connection string of the event hub for azureEventHub logger. + Instrumentation key for applicationInsights logger. + * + * @return the credentials value + */ + public Map credentials() { + return this.credentials; + } + + /** + * Set the name and SendRule connection string of the event hub for azureEventHub logger. + Instrumentation key for applicationInsights logger. + * + * @param credentials the credentials value to set + * @return the LoggerContractInner object itself. + */ + public LoggerContractInner withCredentials(Map credentials) { + this.credentials = credentials; + return this; + } + + /** + * Get whether records are buffered in the logger before publishing. Default is assumed to be true. + * + * @return the isBuffered value + */ + public Boolean isBuffered() { + return this.isBuffered; + } + + /** + * Set whether records are buffered in the logger before publishing. Default is assumed to be true. + * + * @param isBuffered the isBuffered value to set + * @return the LoggerContractInner object itself. + */ + public LoggerContractInner withIsBuffered(Boolean isBuffered) { + this.isBuffered = isBuffered; + return this; + } + + /** + * Get azure Resource Id of a log target (either Azure Event Hub resource or Azure Application Insights resource). + * + * @return the resourceId value + */ + public String resourceId() { + return this.resourceId; + } + + /** + * Set azure Resource Id of a log target (either Azure Event Hub resource or Azure Application Insights resource). + * + * @param resourceId the resourceId value to set + * @return the LoggerContractInner object itself. + */ + public LoggerContractInner withResourceId(String resourceId) { + this.resourceId = resourceId; + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/LoggersImpl.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/LoggersImpl.java new file mode 100644 index 0000000000000..65c37c6659ff4 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/LoggersImpl.java @@ -0,0 +1,87 @@ +/** + * 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. + * jkl + */ + +package com.microsoft.azure.management.apimanagement.v2019_01_01.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.apimanagement.v2019_01_01.Loggers; +import rx.Completable; +import rx.functions.Func1; +import rx.Observable; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.apimanagement.v2019_01_01.LoggerContract; + +class LoggersImpl extends WrapperImpl implements Loggers { + private final ApiManagementManager manager; + + LoggersImpl(ApiManagementManager manager) { + super(manager.inner().loggers()); + this.manager = manager; + } + + public ApiManagementManager manager() { + return this.manager; + } + + @Override + public LoggerContractImpl define(String name) { + return wrapModel(name); + } + + private LoggerContractImpl wrapModel(LoggerContractInner inner) { + return new LoggerContractImpl(inner, manager()); + } + + private LoggerContractImpl wrapModel(String name) { + return new LoggerContractImpl(name, this.manager()); + } + + @Override + public Observable listByServiceAsync(final String resourceGroupName, final String serviceName) { + LoggersInner client = this.inner(); + return client.listByServiceAsync(resourceGroupName, serviceName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public LoggerContract call(LoggerContractInner inner) { + return new LoggerContractImpl(inner, manager()); + } + }); + } + + @Override + public Completable getEntityTagAsync(String resourceGroupName, String serviceName, String loggerId) { + LoggersInner client = this.inner(); + return client.getEntityTagAsync(resourceGroupName, serviceName, loggerId).toCompletable(); + } + + @Override + public Observable getAsync(String resourceGroupName, String serviceName, String loggerId) { + LoggersInner client = this.inner(); + return client.getAsync(resourceGroupName, serviceName, loggerId) + .map(new Func1() { + @Override + public LoggerContract call(LoggerContractInner inner) { + return new LoggerContractImpl(inner, manager()); + } + }); + } + + @Override + public Completable deleteAsync(String resourceGroupName, String serviceName, String loggerId, String ifMatch) { + LoggersInner client = this.inner(); + return client.deleteAsync(resourceGroupName, serviceName, loggerId, ifMatch).toCompletable(); + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/LoggersInner.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/LoggersInner.java new file mode 100644 index 0000000000000..b0cec6b1d0089 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/LoggersInner.java @@ -0,0 +1,1159 @@ +/** + * 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.apimanagement.v2019_01_01.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.apimanagement.v2019_01_01.ErrorResponseException; +import com.microsoft.azure.management.apimanagement.v2019_01_01.LoggerCreateOrUpdateHeaders; +import com.microsoft.azure.management.apimanagement.v2019_01_01.LoggerGetEntityTagHeaders; +import com.microsoft.azure.management.apimanagement.v2019_01_01.LoggerGetHeaders; +import com.microsoft.azure.management.apimanagement.v2019_01_01.LoggerUpdateContract; +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.ServiceResponseWithHeaders; +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.HEAD; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.HTTP; +import retrofit2.http.PATCH; +import retrofit2.http.Path; +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 Loggers. + */ +public class LoggersInner { + /** The Retrofit service to perform REST calls. */ + private LoggersService service; + /** The service client containing this operation class. */ + private ApiManagementClientImpl client; + + /** + * Initializes an instance of LoggersInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public LoggersInner(Retrofit retrofit, ApiManagementClientImpl client) { + this.service = retrofit.create(LoggersService.class); + this.client = client; + } + + /** + * The interface defining all the services for Loggers to be + * used by Retrofit to perform actually REST calls. + */ + interface LoggersService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.apimanagement.v2019_01_01.Loggers listByService" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/loggers") + Observable> listByService(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("subscriptionId") String subscriptionId, @Query("$filter") String filter, @Query("$top") Integer top, @Query("$skip") Integer skip, @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.apimanagement.v2019_01_01.Loggers getEntityTag" }) + @HEAD("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/loggers/{loggerId}") + Observable> getEntityTag(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("loggerId") String loggerId, @Path("subscriptionId") String subscriptionId, @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.apimanagement.v2019_01_01.Loggers get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/loggers/{loggerId}") + Observable> get(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("loggerId") String loggerId, @Path("subscriptionId") String subscriptionId, @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.apimanagement.v2019_01_01.Loggers createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/loggers/{loggerId}") + Observable> createOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("loggerId") String loggerId, @Path("subscriptionId") String subscriptionId, @Body LoggerContractInner parameters, @Header("If-Match") String ifMatch, @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.apimanagement.v2019_01_01.Loggers update" }) + @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/loggers/{loggerId}") + Observable> update(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("loggerId") String loggerId, @Path("subscriptionId") String subscriptionId, @Body LoggerUpdateContract parameters, @Header("If-Match") String ifMatch, @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.apimanagement.v2019_01_01.Loggers delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/loggers/{loggerId}", method = "DELETE", hasBody = true) + Observable> delete(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("loggerId") String loggerId, @Path("subscriptionId") String subscriptionId, @Header("If-Match") String ifMatch, @Query("force") Boolean force, @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.apimanagement.v2019_01_01.Loggers listByServiceNext" }) + @GET + Observable> listByServiceNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Lists a collection of loggers in the specified service instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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<LoggerContractInner> object if successful. + */ + public PagedList listByService(final String resourceGroupName, final String serviceName) { + ServiceResponse> response = listByServiceSinglePageAsync(resourceGroupName, serviceName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByServiceNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists a collection of loggers in the specified service instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @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> listByServiceAsync(final String resourceGroupName, final String serviceName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByServiceSinglePageAsync(resourceGroupName, serviceName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByServiceNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists a collection of loggers in the specified service instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<LoggerContractInner> object + */ + public Observable> listByServiceAsync(final String resourceGroupName, final String serviceName) { + return listByServiceWithServiceResponseAsync(resourceGroupName, serviceName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists a collection of loggers in the specified service instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<LoggerContractInner> object + */ + public Observable>> listByServiceWithServiceResponseAsync(final String resourceGroupName, final String serviceName) { + return listByServiceSinglePageAsync(resourceGroupName, serviceName) + .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(listByServiceNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists a collection of loggers in the specified service instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<LoggerContractInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByServiceSinglePageAsync(final String resourceGroupName, final String serviceName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + 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 filter = null; + final Integer top = null; + final Integer skip = null; + return service.listByService(resourceGroupName, serviceName, this.client.subscriptionId(), filter, top, skip, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByServiceDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Lists a collection of loggers in the specified service instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| loggerType | filter | eq | | </br>| resourceId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br> + * @param top Number of records to return. + * @param skip Number of records to skip. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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<LoggerContractInner> object if successful. + */ + public PagedList listByService(final String resourceGroupName, final String serviceName, final String filter, final Integer top, final Integer skip) { + ServiceResponse> response = listByServiceSinglePageAsync(resourceGroupName, serviceName, filter, top, skip).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByServiceNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists a collection of loggers in the specified service instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| loggerType | filter | eq | | </br>| resourceId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br> + * @param top Number of records to return. + * @param skip Number of records to skip. + * @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> listByServiceAsync(final String resourceGroupName, final String serviceName, final String filter, final Integer top, final Integer skip, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByServiceSinglePageAsync(resourceGroupName, serviceName, filter, top, skip), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByServiceNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists a collection of loggers in the specified service instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| loggerType | filter | eq | | </br>| resourceId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br> + * @param top Number of records to return. + * @param skip Number of records to skip. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<LoggerContractInner> object + */ + public Observable> listByServiceAsync(final String resourceGroupName, final String serviceName, final String filter, final Integer top, final Integer skip) { + return listByServiceWithServiceResponseAsync(resourceGroupName, serviceName, filter, top, skip) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists a collection of loggers in the specified service instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| loggerType | filter | eq | | </br>| resourceId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br> + * @param top Number of records to return. + * @param skip Number of records to skip. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<LoggerContractInner> object + */ + public Observable>> listByServiceWithServiceResponseAsync(final String resourceGroupName, final String serviceName, final String filter, final Integer top, final Integer skip) { + return listByServiceSinglePageAsync(resourceGroupName, serviceName, filter, top, skip) + .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(listByServiceNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists a collection of loggers in the specified service instance. + * + ServiceResponse> * @param resourceGroupName The name of the resource group. + ServiceResponse> * @param serviceName The name of the API Management service. + ServiceResponse> * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| loggerType | filter | eq | | </br>| resourceId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br> + ServiceResponse> * @param top Number of records to return. + ServiceResponse> * @param skip Number of records to skip. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<LoggerContractInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByServiceSinglePageAsync(final String resourceGroupName, final String serviceName, final String filter, final Integer top, final Integer skip) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + 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.listByService(resourceGroupName, serviceName, this.client.subscriptionId(), filter, top, skip, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByServiceDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByServiceDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Gets the entity state (Etag) version of the logger specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param loggerId Logger identifier. Must be unique in the API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void getEntityTag(String resourceGroupName, String serviceName, String loggerId) { + getEntityTagWithServiceResponseAsync(resourceGroupName, serviceName, loggerId).toBlocking().single().body(); + } + + /** + * Gets the entity state (Etag) version of the logger specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param loggerId Logger identifier. Must be unique in the API Management service instance. + * @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 getEntityTagAsync(String resourceGroupName, String serviceName, String loggerId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(getEntityTagWithServiceResponseAsync(resourceGroupName, serviceName, loggerId), serviceCallback); + } + + /** + * Gets the entity state (Etag) version of the logger specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param loggerId Logger identifier. Must be unique in the API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public Observable getEntityTagAsync(String resourceGroupName, String serviceName, String loggerId) { + return getEntityTagWithServiceResponseAsync(resourceGroupName, serviceName, loggerId).map(new Func1, Void>() { + @Override + public Void call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Gets the entity state (Etag) version of the logger specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param loggerId Logger identifier. Must be unique in the API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public Observable> getEntityTagWithServiceResponseAsync(String resourceGroupName, String serviceName, String loggerId) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (loggerId == null) { + throw new IllegalArgumentException("Parameter loggerId is required and cannot be null."); + } + 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.getEntityTag(resourceGroupName, serviceName, loggerId, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = getEntityTagDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponseWithHeaders getEntityTagDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .buildEmptyWithHeaders(response, LoggerGetEntityTagHeaders.class); + } + + /** + * Gets the details of the logger specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param loggerId Logger identifier. Must be unique in the API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the LoggerContractInner object if successful. + */ + public LoggerContractInner get(String resourceGroupName, String serviceName, String loggerId) { + return getWithServiceResponseAsync(resourceGroupName, serviceName, loggerId).toBlocking().single().body(); + } + + /** + * Gets the details of the logger specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param loggerId Logger identifier. Must be unique in the API Management service instance. + * @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 getAsync(String resourceGroupName, String serviceName, String loggerId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(getWithServiceResponseAsync(resourceGroupName, serviceName, loggerId), serviceCallback); + } + + /** + * Gets the details of the logger specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param loggerId Logger identifier. Must be unique in the API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the LoggerContractInner object + */ + public Observable getAsync(String resourceGroupName, String serviceName, String loggerId) { + return getWithServiceResponseAsync(resourceGroupName, serviceName, loggerId).map(new Func1, LoggerContractInner>() { + @Override + public LoggerContractInner call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Gets the details of the logger specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param loggerId Logger identifier. Must be unique in the API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the LoggerContractInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String serviceName, String loggerId) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (loggerId == null) { + throw new IllegalArgumentException("Parameter loggerId is required and cannot be null."); + } + 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.get(resourceGroupName, serviceName, loggerId, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = getDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponseWithHeaders getDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .buildWithHeaders(response, LoggerGetHeaders.class); + } + + /** + * Creates or Updates a logger. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param loggerId Logger identifier. Must be unique in the API Management service instance. + * @param parameters Create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the LoggerContractInner object if successful. + */ + public LoggerContractInner createOrUpdate(String resourceGroupName, String serviceName, String loggerId, LoggerContractInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serviceName, loggerId, parameters).toBlocking().single().body(); + } + + /** + * Creates or Updates a logger. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param loggerId Logger identifier. Must be unique in the API Management service instance. + * @param parameters Create parameters. + * @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 createOrUpdateAsync(String resourceGroupName, String serviceName, String loggerId, LoggerContractInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, serviceName, loggerId, parameters), serviceCallback); + } + + /** + * Creates or Updates a logger. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param loggerId Logger identifier. Must be unique in the API Management service instance. + * @param parameters Create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the LoggerContractInner object + */ + public Observable createOrUpdateAsync(String resourceGroupName, String serviceName, String loggerId, LoggerContractInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serviceName, loggerId, parameters).map(new Func1, LoggerContractInner>() { + @Override + public LoggerContractInner call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Creates or Updates a logger. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param loggerId Logger identifier. Must be unique in the API Management service instance. + * @param parameters Create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the LoggerContractInner object + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String serviceName, String loggerId, LoggerContractInner parameters) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (loggerId == null) { + throw new IllegalArgumentException("Parameter loggerId is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(parameters); + final String ifMatch = null; + return service.createOrUpdate(resourceGroupName, serviceName, loggerId, this.client.subscriptionId(), parameters, ifMatch, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = createOrUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Creates or Updates a logger. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param loggerId Logger identifier. Must be unique in the API Management service instance. + * @param parameters Create parameters. + * @param ifMatch ETag of the Entity. Not required when creating an entity, but required when updating an entity. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the LoggerContractInner object if successful. + */ + public LoggerContractInner createOrUpdate(String resourceGroupName, String serviceName, String loggerId, LoggerContractInner parameters, String ifMatch) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serviceName, loggerId, parameters, ifMatch).toBlocking().single().body(); + } + + /** + * Creates or Updates a logger. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param loggerId Logger identifier. Must be unique in the API Management service instance. + * @param parameters Create parameters. + * @param ifMatch ETag of the Entity. Not required when creating an entity, but required when updating an entity. + * @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 createOrUpdateAsync(String resourceGroupName, String serviceName, String loggerId, LoggerContractInner parameters, String ifMatch, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, serviceName, loggerId, parameters, ifMatch), serviceCallback); + } + + /** + * Creates or Updates a logger. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param loggerId Logger identifier. Must be unique in the API Management service instance. + * @param parameters Create parameters. + * @param ifMatch ETag of the Entity. Not required when creating an entity, but required when updating an entity. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the LoggerContractInner object + */ + public Observable createOrUpdateAsync(String resourceGroupName, String serviceName, String loggerId, LoggerContractInner parameters, String ifMatch) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serviceName, loggerId, parameters, ifMatch).map(new Func1, LoggerContractInner>() { + @Override + public LoggerContractInner call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Creates or Updates a logger. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param loggerId Logger identifier. Must be unique in the API Management service instance. + * @param parameters Create parameters. + * @param ifMatch ETag of the Entity. Not required when creating an entity, but required when updating an entity. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the LoggerContractInner object + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String serviceName, String loggerId, LoggerContractInner parameters, String ifMatch) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (loggerId == null) { + throw new IllegalArgumentException("Parameter loggerId is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(parameters); + return service.createOrUpdate(resourceGroupName, serviceName, loggerId, this.client.subscriptionId(), parameters, ifMatch, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = createOrUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponseWithHeaders createOrUpdateDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(201, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .buildWithHeaders(response, LoggerCreateOrUpdateHeaders.class); + } + + /** + * Updates an existing logger. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param loggerId Logger identifier. Must be unique in the API Management service instance. + * @param parameters Update parameters. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void update(String resourceGroupName, String serviceName, String loggerId, LoggerUpdateContract parameters, String ifMatch) { + updateWithServiceResponseAsync(resourceGroupName, serviceName, loggerId, parameters, ifMatch).toBlocking().single().body(); + } + + /** + * Updates an existing logger. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param loggerId Logger identifier. Must be unique in the API Management service instance. + * @param parameters Update parameters. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @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 serviceName, String loggerId, LoggerUpdateContract parameters, String ifMatch, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateWithServiceResponseAsync(resourceGroupName, serviceName, loggerId, parameters, ifMatch), serviceCallback); + } + + /** + * Updates an existing logger. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param loggerId Logger identifier. Must be unique in the API Management service instance. + * @param parameters Update parameters. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable updateAsync(String resourceGroupName, String serviceName, String loggerId, LoggerUpdateContract parameters, String ifMatch) { + return updateWithServiceResponseAsync(resourceGroupName, serviceName, loggerId, parameters, ifMatch).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates an existing logger. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param loggerId Logger identifier. Must be unique in the API Management service instance. + * @param parameters Update parameters. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> updateWithServiceResponseAsync(String resourceGroupName, String serviceName, String loggerId, LoggerUpdateContract parameters, String ifMatch) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (loggerId == null) { + throw new IllegalArgumentException("Parameter loggerId is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + if (ifMatch == null) { + throw new IllegalArgumentException("Parameter ifMatch is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(parameters); + return service.update(resourceGroupName, serviceName, loggerId, this.client.subscriptionId(), parameters, ifMatch, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = updateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse updateDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(204, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Deletes the specified logger. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param loggerId Logger identifier. Must be unique in the API Management service instance. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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 serviceName, String loggerId, String ifMatch) { + deleteWithServiceResponseAsync(resourceGroupName, serviceName, loggerId, ifMatch).toBlocking().single().body(); + } + + /** + * Deletes the specified logger. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param loggerId Logger identifier. Must be unique in the API Management service instance. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @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 serviceName, String loggerId, String ifMatch, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, serviceName, loggerId, ifMatch), serviceCallback); + } + + /** + * Deletes the specified logger. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param loggerId Logger identifier. Must be unique in the API Management service instance. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable deleteAsync(String resourceGroupName, String serviceName, String loggerId, String ifMatch) { + return deleteWithServiceResponseAsync(resourceGroupName, serviceName, loggerId, ifMatch).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes the specified logger. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param loggerId Logger identifier. Must be unique in the API Management service instance. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> deleteWithServiceResponseAsync(String resourceGroupName, String serviceName, String loggerId, String ifMatch) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (loggerId == null) { + throw new IllegalArgumentException("Parameter loggerId is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (ifMatch == null) { + throw new IllegalArgumentException("Parameter ifMatch 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 Boolean force = null; + return service.delete(resourceGroupName, serviceName, loggerId, this.client.subscriptionId(), ifMatch, force, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = deleteDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Deletes the specified logger. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param loggerId Logger identifier. Must be unique in the API Management service instance. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @param force Force deletion even if diagnostic is attached. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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 serviceName, String loggerId, String ifMatch, Boolean force) { + deleteWithServiceResponseAsync(resourceGroupName, serviceName, loggerId, ifMatch, force).toBlocking().single().body(); + } + + /** + * Deletes the specified logger. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param loggerId Logger identifier. Must be unique in the API Management service instance. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @param force Force deletion even if diagnostic is attached. + * @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 serviceName, String loggerId, String ifMatch, Boolean force, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, serviceName, loggerId, ifMatch, force), serviceCallback); + } + + /** + * Deletes the specified logger. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param loggerId Logger identifier. Must be unique in the API Management service instance. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @param force Force deletion even if diagnostic is attached. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable deleteAsync(String resourceGroupName, String serviceName, String loggerId, String ifMatch, Boolean force) { + return deleteWithServiceResponseAsync(resourceGroupName, serviceName, loggerId, ifMatch, force).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes the specified logger. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param loggerId Logger identifier. Must be unique in the API Management service instance. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @param force Force deletion even if diagnostic is attached. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> deleteWithServiceResponseAsync(String resourceGroupName, String serviceName, String loggerId, String ifMatch, Boolean force) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (loggerId == null) { + throw new IllegalArgumentException("Parameter loggerId is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (ifMatch == null) { + throw new IllegalArgumentException("Parameter ifMatch 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.delete(resourceGroupName, serviceName, loggerId, this.client.subscriptionId(), ifMatch, force, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = deleteDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse deleteDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(204, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists a collection of loggers in the specified service instance. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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<LoggerContractInner> object if successful. + */ + public PagedList listByServiceNext(final String nextPageLink) { + ServiceResponse> response = listByServiceNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByServiceNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists a collection of loggers in the specified service instance. + * + * @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> listByServiceNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByServiceNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByServiceNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists a collection of loggers in the specified service instance. + * + * @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<LoggerContractInner> object + */ + public Observable> listByServiceNextAsync(final String nextPageLink) { + return listByServiceNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists a collection of loggers in the specified service instance. + * + * @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<LoggerContractInner> object + */ + public Observable>> listByServiceNextWithServiceResponseAsync(final String nextPageLink) { + return listByServiceNextSinglePageAsync(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(listByServiceNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists a collection of loggers in the specified service instance. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<LoggerContractInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByServiceNextSinglePageAsync(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.listByServiceNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByServiceNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByServiceNextDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/NetworkStatusContractByLocationImpl.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/NetworkStatusContractByLocationImpl.java new file mode 100644 index 0000000000000..5463789811c3b --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/NetworkStatusContractByLocationImpl.java @@ -0,0 +1,36 @@ +/** + * 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.apimanagement.v2019_01_01.implementation; + +import com.microsoft.azure.management.apimanagement.v2019_01_01.NetworkStatusContractByLocation; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; + +class NetworkStatusContractByLocationImpl extends WrapperImpl implements NetworkStatusContractByLocation { + private final ApiManagementManager manager; + NetworkStatusContractByLocationImpl(NetworkStatusContractByLocationInner inner, ApiManagementManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public ApiManagementManager manager() { + return this.manager; + } + + @Override + public String location() { + return this.inner().location(); + } + + @Override + public NetworkStatusContractInner networkStatus() { + return this.inner().networkStatus(); + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/NetworkStatusContractByLocationInner.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/NetworkStatusContractByLocationInner.java new file mode 100644 index 0000000000000..cc98e12a38df4 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/NetworkStatusContractByLocationInner.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.apimanagement.v2019_01_01.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Network Status in the Location. + */ +public class NetworkStatusContractByLocationInner { + /** + * Location of service. + */ + @JsonProperty(value = "location") + private String location; + + /** + * Network status in Location. + */ + @JsonProperty(value = "networkStatus") + private NetworkStatusContractInner networkStatus; + + /** + * Get location of service. + * + * @return the location value + */ + public String location() { + return this.location; + } + + /** + * Set location of service. + * + * @param location the location value to set + * @return the NetworkStatusContractByLocationInner object itself. + */ + public NetworkStatusContractByLocationInner withLocation(String location) { + this.location = location; + return this; + } + + /** + * Get network status in Location. + * + * @return the networkStatus value + */ + public NetworkStatusContractInner networkStatus() { + return this.networkStatus; + } + + /** + * Set network status in Location. + * + * @param networkStatus the networkStatus value to set + * @return the NetworkStatusContractByLocationInner object itself. + */ + public NetworkStatusContractByLocationInner withNetworkStatus(NetworkStatusContractInner networkStatus) { + this.networkStatus = networkStatus; + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/NetworkStatusContractImpl.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/NetworkStatusContractImpl.java new file mode 100644 index 0000000000000..8d439c72be61e --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/NetworkStatusContractImpl.java @@ -0,0 +1,38 @@ +/** + * 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.apimanagement.v2019_01_01.implementation; + +import com.microsoft.azure.management.apimanagement.v2019_01_01.NetworkStatusContract; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import java.util.List; +import com.microsoft.azure.management.apimanagement.v2019_01_01.ConnectivityStatusContract; + +class NetworkStatusContractImpl extends WrapperImpl implements NetworkStatusContract { + private final ApiManagementManager manager; + NetworkStatusContractImpl(NetworkStatusContractInner inner, ApiManagementManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public ApiManagementManager manager() { + return this.manager; + } + + @Override + public List connectivityStatus() { + return this.inner().connectivityStatus(); + } + + @Override + public List dnsServers() { + return this.inner().dnsServers(); + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/NetworkStatusContractInner.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/NetworkStatusContractInner.java new file mode 100644 index 0000000000000..af6bd3ecd1567 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/NetworkStatusContractInner.java @@ -0,0 +1,72 @@ +/** + * 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.apimanagement.v2019_01_01.implementation; + +import java.util.List; +import com.microsoft.azure.management.apimanagement.v2019_01_01.ConnectivityStatusContract; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Network Status details. + */ +public class NetworkStatusContractInner { + /** + * Gets the list of DNS servers IPV4 addresses. + */ + @JsonProperty(value = "dnsServers", required = true) + private List dnsServers; + + /** + * Gets the list of Connectivity Status to the Resources on which the + * service depends upon. + */ + @JsonProperty(value = "connectivityStatus", required = true) + private List connectivityStatus; + + /** + * Get gets the list of DNS servers IPV4 addresses. + * + * @return the dnsServers value + */ + public List dnsServers() { + return this.dnsServers; + } + + /** + * Set gets the list of DNS servers IPV4 addresses. + * + * @param dnsServers the dnsServers value to set + * @return the NetworkStatusContractInner object itself. + */ + public NetworkStatusContractInner withDnsServers(List dnsServers) { + this.dnsServers = dnsServers; + return this; + } + + /** + * Get gets the list of Connectivity Status to the Resources on which the service depends upon. + * + * @return the connectivityStatus value + */ + public List connectivityStatus() { + return this.connectivityStatus; + } + + /** + * Set gets the list of Connectivity Status to the Resources on which the service depends upon. + * + * @param connectivityStatus the connectivityStatus value to set + * @return the NetworkStatusContractInner object itself. + */ + public NetworkStatusContractInner withConnectivityStatus(List connectivityStatus) { + this.connectivityStatus = connectivityStatus; + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/NetworkStatusImpl.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/NetworkStatusImpl.java new file mode 100644 index 0000000000000..23ee81996dc42 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/NetworkStatusImpl.java @@ -0,0 +1,62 @@ +/** + * 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. + * abc + */ + +package com.microsoft.azure.management.apimanagement.v2019_01_01.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.apimanagement.v2019_01_01.NetworkStatus; +import rx.functions.Func1; +import rx.Observable; +import java.util.List; +import com.microsoft.azure.management.apimanagement.v2019_01_01.NetworkStatusContractByLocation; +import com.microsoft.azure.management.apimanagement.v2019_01_01.NetworkStatusContract; + +class NetworkStatusImpl extends WrapperImpl implements NetworkStatus { + private final ApiManagementManager manager; + + NetworkStatusImpl(ApiManagementManager manager) { + super(manager.inner().networkStatus()); + this.manager = manager; + } + + public ApiManagementManager manager() { + return this.manager; + } + + @Override + public Observable listByServiceAsync(String resourceGroupName, String serviceName) { + NetworkStatusInner client = this.inner(); + return client.listByServiceAsync(resourceGroupName, serviceName) + .flatMap(new Func1, Observable>() { + @Override + public Observable call(List innerList) { + return Observable.from(innerList); + } + }) + .map(new Func1() { + @Override + public NetworkStatusContractByLocation call(NetworkStatusContractByLocationInner inner) { + return new NetworkStatusContractByLocationImpl(inner, manager()); + } + }); + } + + @Override + public Observable listByLocationAsync(String resourceGroupName, String serviceName, String locationName) { + NetworkStatusInner client = this.inner(); + return client.listByLocationAsync(resourceGroupName, serviceName, locationName) + .map(new Func1() { + @Override + public NetworkStatusContract call(NetworkStatusContractInner inner) { + return new NetworkStatusContractImpl(inner, manager()); + } + }); + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/NetworkStatusInner.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/NetworkStatusInner.java new file mode 100644 index 0000000000000..6baba56b24834 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/NetworkStatusInner.java @@ -0,0 +1,244 @@ +/** + * 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.apimanagement.v2019_01_01.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.management.apimanagement.v2019_01_01.ErrorResponseException; +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.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Path; +import retrofit2.http.Query; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in NetworkStatus. + */ +public class NetworkStatusInner { + /** The Retrofit service to perform REST calls. */ + private NetworkStatusService service; + /** The service client containing this operation class. */ + private ApiManagementClientImpl client; + + /** + * Initializes an instance of NetworkStatusInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public NetworkStatusInner(Retrofit retrofit, ApiManagementClientImpl client) { + this.service = retrofit.create(NetworkStatusService.class); + this.client = client; + } + + /** + * The interface defining all the services for NetworkStatus to be + * used by Retrofit to perform actually REST calls. + */ + interface NetworkStatusService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.apimanagement.v2019_01_01.NetworkStatus listByService" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/networkstatus") + Observable> listByService(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @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.apimanagement.v2019_01_01.NetworkStatus listByLocation" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/locations/{locationName}/networkstatus") + Observable> listByLocation(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("locationName") String locationName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Gets the Connectivity Status to the external resources on which the Api Management service depends from inside the Cloud Service. This also returns the DNS Servers as visible to the CloudService. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the List<NetworkStatusContractByLocationInner> object if successful. + */ + public List listByService(String resourceGroupName, String serviceName) { + return listByServiceWithServiceResponseAsync(resourceGroupName, serviceName).toBlocking().single().body(); + } + + /** + * Gets the Connectivity Status to the external resources on which the Api Management service depends from inside the Cloud Service. This also returns the DNS Servers as visible to the CloudService. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @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> listByServiceAsync(String resourceGroupName, String serviceName, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listByServiceWithServiceResponseAsync(resourceGroupName, serviceName), serviceCallback); + } + + /** + * Gets the Connectivity Status to the external resources on which the Api Management service depends from inside the Cloud Service. This also returns the DNS Servers as visible to the CloudService. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<NetworkStatusContractByLocationInner> object + */ + public Observable> listByServiceAsync(String resourceGroupName, String serviceName) { + return listByServiceWithServiceResponseAsync(resourceGroupName, serviceName).map(new Func1>, List>() { + @Override + public List call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets the Connectivity Status to the external resources on which the Api Management service depends from inside the Cloud Service. This also returns the DNS Servers as visible to the CloudService. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<NetworkStatusContractByLocationInner> object + */ + public Observable>> listByServiceWithServiceResponseAsync(String resourceGroupName, String serviceName) { + 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 (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName 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.listByService(this.client.subscriptionId(), resourceGroupName, serviceName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> clientResponse = listByServiceDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByServiceDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Gets the Connectivity Status to the external resources on which the Api Management service depends from inside the Cloud Service. This also returns the DNS Servers as visible to the CloudService. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param locationName Location in which the API Management service is deployed. This is one of the Azure Regions like West US, East US, South Central US. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the NetworkStatusContractInner object if successful. + */ + public NetworkStatusContractInner listByLocation(String resourceGroupName, String serviceName, String locationName) { + return listByLocationWithServiceResponseAsync(resourceGroupName, serviceName, locationName).toBlocking().single().body(); + } + + /** + * Gets the Connectivity Status to the external resources on which the Api Management service depends from inside the Cloud Service. This also returns the DNS Servers as visible to the CloudService. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param locationName Location in which the API Management service is deployed. This is one of the Azure Regions like West US, East US, South Central US. + * @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 listByLocationAsync(String resourceGroupName, String serviceName, String locationName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(listByLocationWithServiceResponseAsync(resourceGroupName, serviceName, locationName), serviceCallback); + } + + /** + * Gets the Connectivity Status to the external resources on which the Api Management service depends from inside the Cloud Service. This also returns the DNS Servers as visible to the CloudService. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param locationName Location in which the API Management service is deployed. This is one of the Azure Regions like West US, East US, South Central US. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the NetworkStatusContractInner object + */ + public Observable listByLocationAsync(String resourceGroupName, String serviceName, String locationName) { + return listByLocationWithServiceResponseAsync(resourceGroupName, serviceName, locationName).map(new Func1, NetworkStatusContractInner>() { + @Override + public NetworkStatusContractInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets the Connectivity Status to the external resources on which the Api Management service depends from inside the Cloud Service. This also returns the DNS Servers as visible to the CloudService. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param locationName Location in which the API Management service is deployed. This is one of the Azure Regions like West US, East US, South Central US. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the NetworkStatusContractInner object + */ + public Observable> listByLocationWithServiceResponseAsync(String resourceGroupName, String serviceName, String locationName) { + 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 (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (locationName == null) { + throw new IllegalArgumentException("Parameter locationName 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.listByLocation(this.client.subscriptionId(), resourceGroupName, serviceName, locationName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = listByLocationDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse listByLocationDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/NotificationContractImpl.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/NotificationContractImpl.java new file mode 100644 index 0000000000000..170028d2c1831 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/NotificationContractImpl.java @@ -0,0 +1,129 @@ +/** + * 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.apimanagement.v2019_01_01.implementation; + +import com.microsoft.azure.management.apimanagement.v2019_01_01.NotificationContract; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import com.microsoft.azure.management.apimanagement.v2019_01_01.NotificationName; +import com.microsoft.azure.management.apimanagement.v2019_01_01.RecipientsContractProperties; + +class NotificationContractImpl extends CreatableUpdatableImpl implements NotificationContract, NotificationContract.Definition, NotificationContract.Update { + private String resourceGroupName; + private String serviceName; + private NotificationName notificationName; + private String cifMatch; + private String uifMatch; + private final ApiManagementManager manager; + + NotificationContractImpl(String name, ApiManagementManager manager) { + super(name, new NotificationContractInner()); + this.manager = manager; + // Set resource name + this.notificationName = NotificationName.fromString(name); + // + } + + NotificationContractImpl(NotificationContractInner inner, ApiManagementManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.notificationName = NotificationName.fromString(inner.name()); + // set resource ancestor and positional variables + this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourceGroups"); + this.serviceName = IdParsingUtils.getValueFromIdByName(inner.id(), "service"); + this.notificationName = NotificationName.fromString(IdParsingUtils.getValueFromIdByName(inner.id(), "notifications")); + // set other parameters for create and update + } + + @Override + public ApiManagementManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + NotificationsInner client = this.manager().inner().notifications(); + return client.createOrUpdateAsync(this.resourceGroupName, this.serviceName, this.notificationName, this.cifMatch) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + NotificationsInner client = this.manager().inner().notifications(); + return client.createOrUpdateAsync(this.resourceGroupName, this.serviceName, this.notificationName, this.uifMatch) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + NotificationsInner client = this.manager().inner().notifications(); + return null; // NOP getInnerAsync implementation as get is not supported + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + + @Override + public String description() { + return this.inner().description(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public RecipientsContractProperties recipients() { + return this.inner().recipients(); + } + + @Override + public String title() { + return this.inner().title(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public NotificationContractImpl withResourceGroupName(String resourceGroupName) { + this.resourceGroupName = resourceGroupName; + return this; + } + + @Override + public NotificationContractImpl withServiceName(String serviceName) { + this.serviceName = serviceName; + return this; + } + + @Override + public NotificationContractImpl withIfMatch(String ifMatch) { + if (isInCreateMode()) { + this.cifMatch = ifMatch; + } else { + this.uifMatch = ifMatch; + } + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/NotificationContractInner.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/NotificationContractInner.java new file mode 100644 index 0000000000000..5dde8fdc2f84a --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/NotificationContractInner.java @@ -0,0 +1,99 @@ +/** + * 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.apimanagement.v2019_01_01.implementation; + +import com.microsoft.azure.management.apimanagement.v2019_01_01.RecipientsContractProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * Notification details. + */ +@JsonFlatten +public class NotificationContractInner extends ProxyResource { + /** + * Title of the Notification. + */ + @JsonProperty(value = "properties.title", required = true) + private String title; + + /** + * Description of the Notification. + */ + @JsonProperty(value = "properties.description") + private String description; + + /** + * Recipient Parameter values. + */ + @JsonProperty(value = "properties.recipients") + private RecipientsContractProperties recipients; + + /** + * Get title of the Notification. + * + * @return the title value + */ + public String title() { + return this.title; + } + + /** + * Set title of the Notification. + * + * @param title the title value to set + * @return the NotificationContractInner object itself. + */ + public NotificationContractInner withTitle(String title) { + this.title = title; + return this; + } + + /** + * Get description of the Notification. + * + * @return the description value + */ + public String description() { + return this.description; + } + + /** + * Set description of the Notification. + * + * @param description the description value to set + * @return the NotificationContractInner object itself. + */ + public NotificationContractInner withDescription(String description) { + this.description = description; + return this; + } + + /** + * Get recipient Parameter values. + * + * @return the recipients value + */ + public RecipientsContractProperties recipients() { + return this.recipients; + } + + /** + * Set recipient Parameter values. + * + * @param recipients the recipients value to set + * @return the NotificationContractInner object itself. + */ + public NotificationContractInner withRecipients(RecipientsContractProperties recipients) { + this.recipients = recipients; + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/NotificationRecipientEmailsImpl.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/NotificationRecipientEmailsImpl.java new file mode 100644 index 0000000000000..fb326475c69f1 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/NotificationRecipientEmailsImpl.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.apimanagement.v2019_01_01.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.apimanagement.v2019_01_01.NotificationRecipientEmails; +import rx.Completable; +import rx.functions.Func1; +import rx.Observable; +import com.microsoft.azure.management.apimanagement.v2019_01_01.RecipientEmailCollection; +import com.microsoft.azure.management.apimanagement.v2019_01_01.NotificationName; + +class NotificationRecipientEmailsImpl extends WrapperImpl implements NotificationRecipientEmails { + private final ApiManagementManager manager; + + NotificationRecipientEmailsImpl(ApiManagementManager manager) { + super(manager.inner().notificationRecipientEmails()); + this.manager = manager; + } + + public ApiManagementManager manager() { + return this.manager; + } + + @Override + public RecipientEmailContractImpl define(String name) { + return wrapModel(name); + } + + private RecipientEmailContractImpl wrapModel(RecipientEmailContractInner inner) { + return new RecipientEmailContractImpl(inner, manager()); + } + + private RecipientEmailContractImpl wrapModel(String name) { + return new RecipientEmailContractImpl(name, this.manager()); + } + + @Override + public Observable listByNotificationAsync(String resourceGroupName, String serviceName, NotificationName notificationName) { + NotificationRecipientEmailsInner client = this.inner(); + return client.listByNotificationAsync(resourceGroupName, serviceName, notificationName) + .map(new Func1() { + @Override + public RecipientEmailCollection call(RecipientEmailCollectionInner inner) { + return new RecipientEmailCollectionImpl(inner, manager()); + } + }); + } + + @Override + public Observable checkEntityExistsAsync(String resourceGroupName, String serviceName, NotificationName notificationName, String email) { + NotificationRecipientEmailsInner client = this.inner(); + return client.checkEntityExistsAsync(resourceGroupName, serviceName, notificationName, email) + ;} + + @Override + public Completable deleteAsync(String resourceGroupName, String serviceName, NotificationName notificationName, String email) { + NotificationRecipientEmailsInner client = this.inner(); + return client.deleteAsync(resourceGroupName, serviceName, notificationName, email).toCompletable(); + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/NotificationRecipientEmailsInner.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/NotificationRecipientEmailsInner.java new file mode 100644 index 0000000000000..184fa935ecd44 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/NotificationRecipientEmailsInner.java @@ -0,0 +1,471 @@ +/** + * 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.apimanagement.v2019_01_01.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.management.apimanagement.v2019_01_01.ErrorResponseException; +import com.microsoft.azure.management.apimanagement.v2019_01_01.NotificationName; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import java.io.IOException; +import okhttp3.ResponseBody; +import retrofit2.http.GET; +import retrofit2.http.HEAD; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.HTTP; +import retrofit2.http.Path; +import retrofit2.http.PUT; +import retrofit2.http.Query; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in NotificationRecipientEmails. + */ +public class NotificationRecipientEmailsInner { + /** The Retrofit service to perform REST calls. */ + private NotificationRecipientEmailsService service; + /** The service client containing this operation class. */ + private ApiManagementClientImpl client; + + /** + * Initializes an instance of NotificationRecipientEmailsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public NotificationRecipientEmailsInner(Retrofit retrofit, ApiManagementClientImpl client) { + this.service = retrofit.create(NotificationRecipientEmailsService.class); + this.client = client; + } + + /** + * The interface defining all the services for NotificationRecipientEmails to be + * used by Retrofit to perform actually REST calls. + */ + interface NotificationRecipientEmailsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.apimanagement.v2019_01_01.NotificationRecipientEmails listByNotification" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/notifications/{notificationName}/recipientEmails") + Observable> listByNotification(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("notificationName") NotificationName notificationName1, @Path("subscriptionId") String subscriptionId, @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.apimanagement.v2019_01_01.NotificationRecipientEmails checkEntityExists" }) + @HEAD("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/notifications/{notificationName}/recipientEmails/{email}") + Observable> checkEntityExists(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("notificationName") NotificationName notificationName1, @Path("email") String email, @Path("subscriptionId") String subscriptionId, @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.apimanagement.v2019_01_01.NotificationRecipientEmails createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/notifications/{notificationName}/recipientEmails/{email}") + Observable> createOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("notificationName") NotificationName notificationName1, @Path("email") String email, @Path("subscriptionId") String subscriptionId, @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.apimanagement.v2019_01_01.NotificationRecipientEmails delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/notifications/{notificationName}/recipientEmails/{email}", method = "DELETE", hasBody = true) + Observable> delete(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("notificationName") NotificationName notificationName1, @Path("email") String email, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Gets the list of the Notification Recipient Emails subscribed to a notification. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param notificationName Notification Name Identifier. Possible values include: 'RequestPublisherNotificationMessage', 'PurchasePublisherNotificationMessage', 'NewApplicationNotificationMessage', 'BCC', 'NewIssuePublisherNotificationMessage', 'AccountClosedPublisher', 'QuotaLimitApproachingPublisherNotificationMessage' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the RecipientEmailCollectionInner object if successful. + */ + public RecipientEmailCollectionInner listByNotification(String resourceGroupName, String serviceName, NotificationName notificationName) { + return listByNotificationWithServiceResponseAsync(resourceGroupName, serviceName, notificationName).toBlocking().single().body(); + } + + /** + * Gets the list of the Notification Recipient Emails subscribed to a notification. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param notificationName Notification Name Identifier. Possible values include: 'RequestPublisherNotificationMessage', 'PurchasePublisherNotificationMessage', 'NewApplicationNotificationMessage', 'BCC', 'NewIssuePublisherNotificationMessage', 'AccountClosedPublisher', 'QuotaLimitApproachingPublisherNotificationMessage' + * @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 listByNotificationAsync(String resourceGroupName, String serviceName, NotificationName notificationName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(listByNotificationWithServiceResponseAsync(resourceGroupName, serviceName, notificationName), serviceCallback); + } + + /** + * Gets the list of the Notification Recipient Emails subscribed to a notification. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param notificationName Notification Name Identifier. Possible values include: 'RequestPublisherNotificationMessage', 'PurchasePublisherNotificationMessage', 'NewApplicationNotificationMessage', 'BCC', 'NewIssuePublisherNotificationMessage', 'AccountClosedPublisher', 'QuotaLimitApproachingPublisherNotificationMessage' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the RecipientEmailCollectionInner object + */ + public Observable listByNotificationAsync(String resourceGroupName, String serviceName, NotificationName notificationName) { + return listByNotificationWithServiceResponseAsync(resourceGroupName, serviceName, notificationName).map(new Func1, RecipientEmailCollectionInner>() { + @Override + public RecipientEmailCollectionInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets the list of the Notification Recipient Emails subscribed to a notification. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param notificationName Notification Name Identifier. Possible values include: 'RequestPublisherNotificationMessage', 'PurchasePublisherNotificationMessage', 'NewApplicationNotificationMessage', 'BCC', 'NewIssuePublisherNotificationMessage', 'AccountClosedPublisher', 'QuotaLimitApproachingPublisherNotificationMessage' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the RecipientEmailCollectionInner object + */ + public Observable> listByNotificationWithServiceResponseAsync(String resourceGroupName, String serviceName, NotificationName notificationName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (notificationName == null) { + throw new IllegalArgumentException("Parameter notificationName is required and cannot be null."); + } + 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.listByNotification(resourceGroupName, serviceName, notificationName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = listByNotificationDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse listByNotificationDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Determine if Notification Recipient Email subscribed to the notification. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param notificationName Notification Name Identifier. Possible values include: 'RequestPublisherNotificationMessage', 'PurchasePublisherNotificationMessage', 'NewApplicationNotificationMessage', 'BCC', 'NewIssuePublisherNotificationMessage', 'AccountClosedPublisher', 'QuotaLimitApproachingPublisherNotificationMessage' + * @param email Email identifier. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the boolean object if successful. + */ + public boolean checkEntityExists(String resourceGroupName, String serviceName, NotificationName notificationName, String email) { + return checkEntityExistsWithServiceResponseAsync(resourceGroupName, serviceName, notificationName, email).toBlocking().single().body(); + } + + /** + * Determine if Notification Recipient Email subscribed to the notification. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param notificationName Notification Name Identifier. Possible values include: 'RequestPublisherNotificationMessage', 'PurchasePublisherNotificationMessage', 'NewApplicationNotificationMessage', 'BCC', 'NewIssuePublisherNotificationMessage', 'AccountClosedPublisher', 'QuotaLimitApproachingPublisherNotificationMessage' + * @param email Email identifier. + * @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 checkEntityExistsAsync(String resourceGroupName, String serviceName, NotificationName notificationName, String email, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(checkEntityExistsWithServiceResponseAsync(resourceGroupName, serviceName, notificationName, email), serviceCallback); + } + + /** + * Determine if Notification Recipient Email subscribed to the notification. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param notificationName Notification Name Identifier. Possible values include: 'RequestPublisherNotificationMessage', 'PurchasePublisherNotificationMessage', 'NewApplicationNotificationMessage', 'BCC', 'NewIssuePublisherNotificationMessage', 'AccountClosedPublisher', 'QuotaLimitApproachingPublisherNotificationMessage' + * @param email Email identifier. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the Boolean object + */ + public Observable checkEntityExistsAsync(String resourceGroupName, String serviceName, NotificationName notificationName, String email) { + return checkEntityExistsWithServiceResponseAsync(resourceGroupName, serviceName, notificationName, email).map(new Func1, Boolean>() { + @Override + public Boolean call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Determine if Notification Recipient Email subscribed to the notification. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param notificationName Notification Name Identifier. Possible values include: 'RequestPublisherNotificationMessage', 'PurchasePublisherNotificationMessage', 'NewApplicationNotificationMessage', 'BCC', 'NewIssuePublisherNotificationMessage', 'AccountClosedPublisher', 'QuotaLimitApproachingPublisherNotificationMessage' + * @param email Email identifier. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the Boolean object + */ + public Observable> checkEntityExistsWithServiceResponseAsync(String resourceGroupName, String serviceName, NotificationName notificationName, String email) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (notificationName == null) { + throw new IllegalArgumentException("Parameter notificationName is required and cannot be null."); + } + if (email == null) { + throw new IllegalArgumentException("Parameter email is required and cannot be null."); + } + 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.checkEntityExists(resourceGroupName, serviceName, notificationName, email, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = checkEntityExistsDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse checkEntityExistsDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(204, new TypeToken() { }.getType()) + .register(404, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .buildEmpty(response); + } + + /** + * Adds the Email address to the list of Recipients for the Notification. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param notificationName Notification Name Identifier. Possible values include: 'RequestPublisherNotificationMessage', 'PurchasePublisherNotificationMessage', 'NewApplicationNotificationMessage', 'BCC', 'NewIssuePublisherNotificationMessage', 'AccountClosedPublisher', 'QuotaLimitApproachingPublisherNotificationMessage' + * @param email Email identifier. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the RecipientEmailContractInner object if successful. + */ + public RecipientEmailContractInner createOrUpdate(String resourceGroupName, String serviceName, NotificationName notificationName, String email) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serviceName, notificationName, email).toBlocking().single().body(); + } + + /** + * Adds the Email address to the list of Recipients for the Notification. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param notificationName Notification Name Identifier. Possible values include: 'RequestPublisherNotificationMessage', 'PurchasePublisherNotificationMessage', 'NewApplicationNotificationMessage', 'BCC', 'NewIssuePublisherNotificationMessage', 'AccountClosedPublisher', 'QuotaLimitApproachingPublisherNotificationMessage' + * @param email Email identifier. + * @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 createOrUpdateAsync(String resourceGroupName, String serviceName, NotificationName notificationName, String email, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, serviceName, notificationName, email), serviceCallback); + } + + /** + * Adds the Email address to the list of Recipients for the Notification. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param notificationName Notification Name Identifier. Possible values include: 'RequestPublisherNotificationMessage', 'PurchasePublisherNotificationMessage', 'NewApplicationNotificationMessage', 'BCC', 'NewIssuePublisherNotificationMessage', 'AccountClosedPublisher', 'QuotaLimitApproachingPublisherNotificationMessage' + * @param email Email identifier. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the RecipientEmailContractInner object + */ + public Observable createOrUpdateAsync(String resourceGroupName, String serviceName, NotificationName notificationName, String email) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serviceName, notificationName, email).map(new Func1, RecipientEmailContractInner>() { + @Override + public RecipientEmailContractInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Adds the Email address to the list of Recipients for the Notification. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param notificationName Notification Name Identifier. Possible values include: 'RequestPublisherNotificationMessage', 'PurchasePublisherNotificationMessage', 'NewApplicationNotificationMessage', 'BCC', 'NewIssuePublisherNotificationMessage', 'AccountClosedPublisher', 'QuotaLimitApproachingPublisherNotificationMessage' + * @param email Email identifier. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the RecipientEmailContractInner object + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String serviceName, NotificationName notificationName, String email) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (notificationName == null) { + throw new IllegalArgumentException("Parameter notificationName is required and cannot be null."); + } + if (email == null) { + throw new IllegalArgumentException("Parameter email is required and cannot be null."); + } + 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.createOrUpdate(resourceGroupName, serviceName, notificationName, email, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = createOrUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse createOrUpdateDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(201, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Removes the email from the list of Notification. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param notificationName Notification Name Identifier. Possible values include: 'RequestPublisherNotificationMessage', 'PurchasePublisherNotificationMessage', 'NewApplicationNotificationMessage', 'BCC', 'NewIssuePublisherNotificationMessage', 'AccountClosedPublisher', 'QuotaLimitApproachingPublisherNotificationMessage' + * @param email Email identifier. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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 serviceName, NotificationName notificationName, String email) { + deleteWithServiceResponseAsync(resourceGroupName, serviceName, notificationName, email).toBlocking().single().body(); + } + + /** + * Removes the email from the list of Notification. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param notificationName Notification Name Identifier. Possible values include: 'RequestPublisherNotificationMessage', 'PurchasePublisherNotificationMessage', 'NewApplicationNotificationMessage', 'BCC', 'NewIssuePublisherNotificationMessage', 'AccountClosedPublisher', 'QuotaLimitApproachingPublisherNotificationMessage' + * @param email Email identifier. + * @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 serviceName, NotificationName notificationName, String email, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, serviceName, notificationName, email), serviceCallback); + } + + /** + * Removes the email from the list of Notification. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param notificationName Notification Name Identifier. Possible values include: 'RequestPublisherNotificationMessage', 'PurchasePublisherNotificationMessage', 'NewApplicationNotificationMessage', 'BCC', 'NewIssuePublisherNotificationMessage', 'AccountClosedPublisher', 'QuotaLimitApproachingPublisherNotificationMessage' + * @param email Email identifier. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable deleteAsync(String resourceGroupName, String serviceName, NotificationName notificationName, String email) { + return deleteWithServiceResponseAsync(resourceGroupName, serviceName, notificationName, email).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Removes the email from the list of Notification. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param notificationName Notification Name Identifier. Possible values include: 'RequestPublisherNotificationMessage', 'PurchasePublisherNotificationMessage', 'NewApplicationNotificationMessage', 'BCC', 'NewIssuePublisherNotificationMessage', 'AccountClosedPublisher', 'QuotaLimitApproachingPublisherNotificationMessage' + * @param email Email identifier. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> deleteWithServiceResponseAsync(String resourceGroupName, String serviceName, NotificationName notificationName, String email) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (notificationName == null) { + throw new IllegalArgumentException("Parameter notificationName is required and cannot be null."); + } + if (email == null) { + throw new IllegalArgumentException("Parameter email is required and cannot be null."); + } + 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.delete(resourceGroupName, serviceName, notificationName, email, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = deleteDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse deleteDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(204, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/NotificationRecipientUsersImpl.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/NotificationRecipientUsersImpl.java new file mode 100644 index 0000000000000..c8f66839cf5ab --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/NotificationRecipientUsersImpl.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.apimanagement.v2019_01_01.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.apimanagement.v2019_01_01.NotificationRecipientUsers; +import rx.Completable; +import rx.functions.Func1; +import rx.Observable; +import com.microsoft.azure.management.apimanagement.v2019_01_01.RecipientUserCollection; +import com.microsoft.azure.management.apimanagement.v2019_01_01.NotificationName; + +class NotificationRecipientUsersImpl extends WrapperImpl implements NotificationRecipientUsers { + private final ApiManagementManager manager; + + NotificationRecipientUsersImpl(ApiManagementManager manager) { + super(manager.inner().notificationRecipientUsers()); + this.manager = manager; + } + + public ApiManagementManager manager() { + return this.manager; + } + + @Override + public RecipientUserContractImpl define(String name) { + return wrapModel(name); + } + + private RecipientUserContractImpl wrapModel(RecipientUserContractInner inner) { + return new RecipientUserContractImpl(inner, manager()); + } + + private RecipientUserContractImpl wrapModel(String name) { + return new RecipientUserContractImpl(name, this.manager()); + } + + @Override + public Observable listByNotificationAsync(String resourceGroupName, String serviceName, NotificationName notificationName) { + NotificationRecipientUsersInner client = this.inner(); + return client.listByNotificationAsync(resourceGroupName, serviceName, notificationName) + .map(new Func1() { + @Override + public RecipientUserCollection call(RecipientUserCollectionInner inner) { + return new RecipientUserCollectionImpl(inner, manager()); + } + }); + } + + @Override + public Observable checkEntityExistsAsync(String resourceGroupName, String serviceName, NotificationName notificationName, String userId) { + NotificationRecipientUsersInner client = this.inner(); + return client.checkEntityExistsAsync(resourceGroupName, serviceName, notificationName, userId) + ;} + + @Override + public Completable deleteAsync(String resourceGroupName, String serviceName, NotificationName notificationName, String userId) { + NotificationRecipientUsersInner client = this.inner(); + return client.deleteAsync(resourceGroupName, serviceName, notificationName, userId).toCompletable(); + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/NotificationRecipientUsersInner.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/NotificationRecipientUsersInner.java new file mode 100644 index 0000000000000..1eb29da62680f --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/NotificationRecipientUsersInner.java @@ -0,0 +1,471 @@ +/** + * 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.apimanagement.v2019_01_01.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.management.apimanagement.v2019_01_01.ErrorResponseException; +import com.microsoft.azure.management.apimanagement.v2019_01_01.NotificationName; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import java.io.IOException; +import okhttp3.ResponseBody; +import retrofit2.http.GET; +import retrofit2.http.HEAD; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.HTTP; +import retrofit2.http.Path; +import retrofit2.http.PUT; +import retrofit2.http.Query; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in NotificationRecipientUsers. + */ +public class NotificationRecipientUsersInner { + /** The Retrofit service to perform REST calls. */ + private NotificationRecipientUsersService service; + /** The service client containing this operation class. */ + private ApiManagementClientImpl client; + + /** + * Initializes an instance of NotificationRecipientUsersInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public NotificationRecipientUsersInner(Retrofit retrofit, ApiManagementClientImpl client) { + this.service = retrofit.create(NotificationRecipientUsersService.class); + this.client = client; + } + + /** + * The interface defining all the services for NotificationRecipientUsers to be + * used by Retrofit to perform actually REST calls. + */ + interface NotificationRecipientUsersService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.apimanagement.v2019_01_01.NotificationRecipientUsers listByNotification" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/notifications/{notificationName}/recipientUsers") + Observable> listByNotification(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("notificationName") NotificationName notificationName1, @Path("subscriptionId") String subscriptionId, @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.apimanagement.v2019_01_01.NotificationRecipientUsers checkEntityExists" }) + @HEAD("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/notifications/{notificationName}/recipientUsers/{userId}") + Observable> checkEntityExists(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("notificationName") NotificationName notificationName1, @Path("userId") String userId, @Path("subscriptionId") String subscriptionId, @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.apimanagement.v2019_01_01.NotificationRecipientUsers createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/notifications/{notificationName}/recipientUsers/{userId}") + Observable> createOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("notificationName") NotificationName notificationName1, @Path("userId") String userId, @Path("subscriptionId") String subscriptionId, @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.apimanagement.v2019_01_01.NotificationRecipientUsers delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/notifications/{notificationName}/recipientUsers/{userId}", method = "DELETE", hasBody = true) + Observable> delete(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("notificationName") NotificationName notificationName1, @Path("userId") String userId, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Gets the list of the Notification Recipient User subscribed to the notification. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param notificationName Notification Name Identifier. Possible values include: 'RequestPublisherNotificationMessage', 'PurchasePublisherNotificationMessage', 'NewApplicationNotificationMessage', 'BCC', 'NewIssuePublisherNotificationMessage', 'AccountClosedPublisher', 'QuotaLimitApproachingPublisherNotificationMessage' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the RecipientUserCollectionInner object if successful. + */ + public RecipientUserCollectionInner listByNotification(String resourceGroupName, String serviceName, NotificationName notificationName) { + return listByNotificationWithServiceResponseAsync(resourceGroupName, serviceName, notificationName).toBlocking().single().body(); + } + + /** + * Gets the list of the Notification Recipient User subscribed to the notification. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param notificationName Notification Name Identifier. Possible values include: 'RequestPublisherNotificationMessage', 'PurchasePublisherNotificationMessage', 'NewApplicationNotificationMessage', 'BCC', 'NewIssuePublisherNotificationMessage', 'AccountClosedPublisher', 'QuotaLimitApproachingPublisherNotificationMessage' + * @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 listByNotificationAsync(String resourceGroupName, String serviceName, NotificationName notificationName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(listByNotificationWithServiceResponseAsync(resourceGroupName, serviceName, notificationName), serviceCallback); + } + + /** + * Gets the list of the Notification Recipient User subscribed to the notification. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param notificationName Notification Name Identifier. Possible values include: 'RequestPublisherNotificationMessage', 'PurchasePublisherNotificationMessage', 'NewApplicationNotificationMessage', 'BCC', 'NewIssuePublisherNotificationMessage', 'AccountClosedPublisher', 'QuotaLimitApproachingPublisherNotificationMessage' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the RecipientUserCollectionInner object + */ + public Observable listByNotificationAsync(String resourceGroupName, String serviceName, NotificationName notificationName) { + return listByNotificationWithServiceResponseAsync(resourceGroupName, serviceName, notificationName).map(new Func1, RecipientUserCollectionInner>() { + @Override + public RecipientUserCollectionInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets the list of the Notification Recipient User subscribed to the notification. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param notificationName Notification Name Identifier. Possible values include: 'RequestPublisherNotificationMessage', 'PurchasePublisherNotificationMessage', 'NewApplicationNotificationMessage', 'BCC', 'NewIssuePublisherNotificationMessage', 'AccountClosedPublisher', 'QuotaLimitApproachingPublisherNotificationMessage' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the RecipientUserCollectionInner object + */ + public Observable> listByNotificationWithServiceResponseAsync(String resourceGroupName, String serviceName, NotificationName notificationName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (notificationName == null) { + throw new IllegalArgumentException("Parameter notificationName is required and cannot be null."); + } + 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.listByNotification(resourceGroupName, serviceName, notificationName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = listByNotificationDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse listByNotificationDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Determine if the Notification Recipient User is subscribed to the notification. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param notificationName Notification Name Identifier. Possible values include: 'RequestPublisherNotificationMessage', 'PurchasePublisherNotificationMessage', 'NewApplicationNotificationMessage', 'BCC', 'NewIssuePublisherNotificationMessage', 'AccountClosedPublisher', 'QuotaLimitApproachingPublisherNotificationMessage' + * @param userId User identifier. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the boolean object if successful. + */ + public boolean checkEntityExists(String resourceGroupName, String serviceName, NotificationName notificationName, String userId) { + return checkEntityExistsWithServiceResponseAsync(resourceGroupName, serviceName, notificationName, userId).toBlocking().single().body(); + } + + /** + * Determine if the Notification Recipient User is subscribed to the notification. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param notificationName Notification Name Identifier. Possible values include: 'RequestPublisherNotificationMessage', 'PurchasePublisherNotificationMessage', 'NewApplicationNotificationMessage', 'BCC', 'NewIssuePublisherNotificationMessage', 'AccountClosedPublisher', 'QuotaLimitApproachingPublisherNotificationMessage' + * @param userId User identifier. Must be unique in the current API Management service instance. + * @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 checkEntityExistsAsync(String resourceGroupName, String serviceName, NotificationName notificationName, String userId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(checkEntityExistsWithServiceResponseAsync(resourceGroupName, serviceName, notificationName, userId), serviceCallback); + } + + /** + * Determine if the Notification Recipient User is subscribed to the notification. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param notificationName Notification Name Identifier. Possible values include: 'RequestPublisherNotificationMessage', 'PurchasePublisherNotificationMessage', 'NewApplicationNotificationMessage', 'BCC', 'NewIssuePublisherNotificationMessage', 'AccountClosedPublisher', 'QuotaLimitApproachingPublisherNotificationMessage' + * @param userId User identifier. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the Boolean object + */ + public Observable checkEntityExistsAsync(String resourceGroupName, String serviceName, NotificationName notificationName, String userId) { + return checkEntityExistsWithServiceResponseAsync(resourceGroupName, serviceName, notificationName, userId).map(new Func1, Boolean>() { + @Override + public Boolean call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Determine if the Notification Recipient User is subscribed to the notification. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param notificationName Notification Name Identifier. Possible values include: 'RequestPublisherNotificationMessage', 'PurchasePublisherNotificationMessage', 'NewApplicationNotificationMessage', 'BCC', 'NewIssuePublisherNotificationMessage', 'AccountClosedPublisher', 'QuotaLimitApproachingPublisherNotificationMessage' + * @param userId User identifier. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the Boolean object + */ + public Observable> checkEntityExistsWithServiceResponseAsync(String resourceGroupName, String serviceName, NotificationName notificationName, String userId) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (notificationName == null) { + throw new IllegalArgumentException("Parameter notificationName is required and cannot be null."); + } + if (userId == null) { + throw new IllegalArgumentException("Parameter userId is required and cannot be null."); + } + 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.checkEntityExists(resourceGroupName, serviceName, notificationName, userId, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = checkEntityExistsDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse checkEntityExistsDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(204, new TypeToken() { }.getType()) + .register(404, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .buildEmpty(response); + } + + /** + * Adds the API Management User to the list of Recipients for the Notification. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param notificationName Notification Name Identifier. Possible values include: 'RequestPublisherNotificationMessage', 'PurchasePublisherNotificationMessage', 'NewApplicationNotificationMessage', 'BCC', 'NewIssuePublisherNotificationMessage', 'AccountClosedPublisher', 'QuotaLimitApproachingPublisherNotificationMessage' + * @param userId User identifier. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the RecipientUserContractInner object if successful. + */ + public RecipientUserContractInner createOrUpdate(String resourceGroupName, String serviceName, NotificationName notificationName, String userId) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serviceName, notificationName, userId).toBlocking().single().body(); + } + + /** + * Adds the API Management User to the list of Recipients for the Notification. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param notificationName Notification Name Identifier. Possible values include: 'RequestPublisherNotificationMessage', 'PurchasePublisherNotificationMessage', 'NewApplicationNotificationMessage', 'BCC', 'NewIssuePublisherNotificationMessage', 'AccountClosedPublisher', 'QuotaLimitApproachingPublisherNotificationMessage' + * @param userId User identifier. Must be unique in the current API Management service instance. + * @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 createOrUpdateAsync(String resourceGroupName, String serviceName, NotificationName notificationName, String userId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, serviceName, notificationName, userId), serviceCallback); + } + + /** + * Adds the API Management User to the list of Recipients for the Notification. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param notificationName Notification Name Identifier. Possible values include: 'RequestPublisherNotificationMessage', 'PurchasePublisherNotificationMessage', 'NewApplicationNotificationMessage', 'BCC', 'NewIssuePublisherNotificationMessage', 'AccountClosedPublisher', 'QuotaLimitApproachingPublisherNotificationMessage' + * @param userId User identifier. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the RecipientUserContractInner object + */ + public Observable createOrUpdateAsync(String resourceGroupName, String serviceName, NotificationName notificationName, String userId) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serviceName, notificationName, userId).map(new Func1, RecipientUserContractInner>() { + @Override + public RecipientUserContractInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Adds the API Management User to the list of Recipients for the Notification. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param notificationName Notification Name Identifier. Possible values include: 'RequestPublisherNotificationMessage', 'PurchasePublisherNotificationMessage', 'NewApplicationNotificationMessage', 'BCC', 'NewIssuePublisherNotificationMessage', 'AccountClosedPublisher', 'QuotaLimitApproachingPublisherNotificationMessage' + * @param userId User identifier. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the RecipientUserContractInner object + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String serviceName, NotificationName notificationName, String userId) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (notificationName == null) { + throw new IllegalArgumentException("Parameter notificationName is required and cannot be null."); + } + if (userId == null) { + throw new IllegalArgumentException("Parameter userId is required and cannot be null."); + } + 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.createOrUpdate(resourceGroupName, serviceName, notificationName, userId, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = createOrUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse createOrUpdateDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(201, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Removes the API Management user from the list of Notification. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param notificationName Notification Name Identifier. Possible values include: 'RequestPublisherNotificationMessage', 'PurchasePublisherNotificationMessage', 'NewApplicationNotificationMessage', 'BCC', 'NewIssuePublisherNotificationMessage', 'AccountClosedPublisher', 'QuotaLimitApproachingPublisherNotificationMessage' + * @param userId User identifier. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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 serviceName, NotificationName notificationName, String userId) { + deleteWithServiceResponseAsync(resourceGroupName, serviceName, notificationName, userId).toBlocking().single().body(); + } + + /** + * Removes the API Management user from the list of Notification. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param notificationName Notification Name Identifier. Possible values include: 'RequestPublisherNotificationMessage', 'PurchasePublisherNotificationMessage', 'NewApplicationNotificationMessage', 'BCC', 'NewIssuePublisherNotificationMessage', 'AccountClosedPublisher', 'QuotaLimitApproachingPublisherNotificationMessage' + * @param userId User identifier. Must be unique in the current API Management service instance. + * @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 serviceName, NotificationName notificationName, String userId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, serviceName, notificationName, userId), serviceCallback); + } + + /** + * Removes the API Management user from the list of Notification. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param notificationName Notification Name Identifier. Possible values include: 'RequestPublisherNotificationMessage', 'PurchasePublisherNotificationMessage', 'NewApplicationNotificationMessage', 'BCC', 'NewIssuePublisherNotificationMessage', 'AccountClosedPublisher', 'QuotaLimitApproachingPublisherNotificationMessage' + * @param userId User identifier. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable deleteAsync(String resourceGroupName, String serviceName, NotificationName notificationName, String userId) { + return deleteWithServiceResponseAsync(resourceGroupName, serviceName, notificationName, userId).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Removes the API Management user from the list of Notification. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param notificationName Notification Name Identifier. Possible values include: 'RequestPublisherNotificationMessage', 'PurchasePublisherNotificationMessage', 'NewApplicationNotificationMessage', 'BCC', 'NewIssuePublisherNotificationMessage', 'AccountClosedPublisher', 'QuotaLimitApproachingPublisherNotificationMessage' + * @param userId User identifier. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> deleteWithServiceResponseAsync(String resourceGroupName, String serviceName, NotificationName notificationName, String userId) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (notificationName == null) { + throw new IllegalArgumentException("Parameter notificationName is required and cannot be null."); + } + if (userId == null) { + throw new IllegalArgumentException("Parameter userId is required and cannot be null."); + } + 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.delete(resourceGroupName, serviceName, notificationName, userId, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = deleteDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse deleteDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(204, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/NotificationsImpl.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/NotificationsImpl.java new file mode 100644 index 0000000000000..25a26bbac7f63 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/NotificationsImpl.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. + * jkl + */ + +package com.microsoft.azure.management.apimanagement.v2019_01_01.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.apimanagement.v2019_01_01.Notifications; +import rx.functions.Func1; +import rx.Observable; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.apimanagement.v2019_01_01.NotificationContract; +import com.microsoft.azure.management.apimanagement.v2019_01_01.NotificationName; + +class NotificationsImpl extends WrapperImpl implements Notifications { + private final ApiManagementManager manager; + + NotificationsImpl(ApiManagementManager manager) { + super(manager.inner().notifications()); + this.manager = manager; + } + + public ApiManagementManager manager() { + return this.manager; + } + + @Override + public NotificationContractImpl define(String name) { + return wrapModel(name); + } + + private NotificationContractImpl wrapModel(NotificationContractInner inner) { + return new NotificationContractImpl(inner, manager()); + } + + private NotificationContractImpl wrapModel(String name) { + return new NotificationContractImpl(name, this.manager()); + } + + @Override + public Observable listByServiceAsync(final String resourceGroupName, final String serviceName) { + NotificationsInner client = this.inner(); + return client.listByServiceAsync(resourceGroupName, serviceName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public NotificationContract call(NotificationContractInner inner) { + return new NotificationContractImpl(inner, manager()); + } + }); + } + + @Override + public Observable getAsync(String resourceGroupName, String serviceName, NotificationName notificationName) { + NotificationsInner client = this.inner(); + return client.getAsync(resourceGroupName, serviceName, notificationName) + .map(new Func1() { + @Override + public NotificationContract call(NotificationContractInner inner) { + return new NotificationContractImpl(inner, manager()); + } + }); + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/NotificationsInner.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/NotificationsInner.java new file mode 100644 index 0000000000000..70c0a3ab34744 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/NotificationsInner.java @@ -0,0 +1,719 @@ +/** + * 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.apimanagement.v2019_01_01.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.apimanagement.v2019_01_01.ErrorResponseException; +import com.microsoft.azure.management.apimanagement.v2019_01_01.NotificationName; +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.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Path; +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 Notifications. + */ +public class NotificationsInner { + /** The Retrofit service to perform REST calls. */ + private NotificationsService service; + /** The service client containing this operation class. */ + private ApiManagementClientImpl client; + + /** + * Initializes an instance of NotificationsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public NotificationsInner(Retrofit retrofit, ApiManagementClientImpl client) { + this.service = retrofit.create(NotificationsService.class); + this.client = client; + } + + /** + * The interface defining all the services for Notifications to be + * used by Retrofit to perform actually REST calls. + */ + interface NotificationsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.apimanagement.v2019_01_01.Notifications listByService" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/notifications") + Observable> listByService(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("subscriptionId") String subscriptionId, @Query("$top") Integer top, @Query("$skip") Integer skip, @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.apimanagement.v2019_01_01.Notifications get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/notifications/{notificationName}") + Observable> get(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("notificationName") NotificationName notificationName1, @Path("subscriptionId") String subscriptionId, @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.apimanagement.v2019_01_01.Notifications createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/notifications/{notificationName}") + Observable> createOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("notificationName") NotificationName notificationName1, @Path("subscriptionId") String subscriptionId, @Header("If-Match") String ifMatch, @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.apimanagement.v2019_01_01.Notifications listByServiceNext" }) + @GET + Observable> listByServiceNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Lists a collection of properties defined within a service instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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<NotificationContractInner> object if successful. + */ + public PagedList listByService(final String resourceGroupName, final String serviceName) { + ServiceResponse> response = listByServiceSinglePageAsync(resourceGroupName, serviceName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByServiceNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists a collection of properties defined within a service instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @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> listByServiceAsync(final String resourceGroupName, final String serviceName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByServiceSinglePageAsync(resourceGroupName, serviceName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByServiceNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists a collection of properties defined within a service instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<NotificationContractInner> object + */ + public Observable> listByServiceAsync(final String resourceGroupName, final String serviceName) { + return listByServiceWithServiceResponseAsync(resourceGroupName, serviceName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists a collection of properties defined within a service instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<NotificationContractInner> object + */ + public Observable>> listByServiceWithServiceResponseAsync(final String resourceGroupName, final String serviceName) { + return listByServiceSinglePageAsync(resourceGroupName, serviceName) + .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(listByServiceNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists a collection of properties defined within a service instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<NotificationContractInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByServiceSinglePageAsync(final String resourceGroupName, final String serviceName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + 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 Integer top = null; + final Integer skip = null; + return service.listByService(resourceGroupName, serviceName, this.client.subscriptionId(), top, skip, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByServiceDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Lists a collection of properties defined within a service instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param top Number of records to return. + * @param skip Number of records to skip. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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<NotificationContractInner> object if successful. + */ + public PagedList listByService(final String resourceGroupName, final String serviceName, final Integer top, final Integer skip) { + ServiceResponse> response = listByServiceSinglePageAsync(resourceGroupName, serviceName, top, skip).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByServiceNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists a collection of properties defined within a service instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param top Number of records to return. + * @param skip Number of records to skip. + * @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> listByServiceAsync(final String resourceGroupName, final String serviceName, final Integer top, final Integer skip, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByServiceSinglePageAsync(resourceGroupName, serviceName, top, skip), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByServiceNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists a collection of properties defined within a service instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param top Number of records to return. + * @param skip Number of records to skip. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<NotificationContractInner> object + */ + public Observable> listByServiceAsync(final String resourceGroupName, final String serviceName, final Integer top, final Integer skip) { + return listByServiceWithServiceResponseAsync(resourceGroupName, serviceName, top, skip) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists a collection of properties defined within a service instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param top Number of records to return. + * @param skip Number of records to skip. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<NotificationContractInner> object + */ + public Observable>> listByServiceWithServiceResponseAsync(final String resourceGroupName, final String serviceName, final Integer top, final Integer skip) { + return listByServiceSinglePageAsync(resourceGroupName, serviceName, top, skip) + .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(listByServiceNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists a collection of properties defined within a service instance. + * + ServiceResponse> * @param resourceGroupName The name of the resource group. + ServiceResponse> * @param serviceName The name of the API Management service. + ServiceResponse> * @param top Number of records to return. + ServiceResponse> * @param skip Number of records to skip. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<NotificationContractInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByServiceSinglePageAsync(final String resourceGroupName, final String serviceName, final Integer top, final Integer skip) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + 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.listByService(resourceGroupName, serviceName, this.client.subscriptionId(), top, skip, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByServiceDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByServiceDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Gets the details of the Notification specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param notificationName Notification Name Identifier. Possible values include: 'RequestPublisherNotificationMessage', 'PurchasePublisherNotificationMessage', 'NewApplicationNotificationMessage', 'BCC', 'NewIssuePublisherNotificationMessage', 'AccountClosedPublisher', 'QuotaLimitApproachingPublisherNotificationMessage' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the NotificationContractInner object if successful. + */ + public NotificationContractInner get(String resourceGroupName, String serviceName, NotificationName notificationName) { + return getWithServiceResponseAsync(resourceGroupName, serviceName, notificationName).toBlocking().single().body(); + } + + /** + * Gets the details of the Notification specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param notificationName Notification Name Identifier. Possible values include: 'RequestPublisherNotificationMessage', 'PurchasePublisherNotificationMessage', 'NewApplicationNotificationMessage', 'BCC', 'NewIssuePublisherNotificationMessage', 'AccountClosedPublisher', 'QuotaLimitApproachingPublisherNotificationMessage' + * @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 getAsync(String resourceGroupName, String serviceName, NotificationName notificationName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroupName, serviceName, notificationName), serviceCallback); + } + + /** + * Gets the details of the Notification specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param notificationName Notification Name Identifier. Possible values include: 'RequestPublisherNotificationMessage', 'PurchasePublisherNotificationMessage', 'NewApplicationNotificationMessage', 'BCC', 'NewIssuePublisherNotificationMessage', 'AccountClosedPublisher', 'QuotaLimitApproachingPublisherNotificationMessage' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the NotificationContractInner object + */ + public Observable getAsync(String resourceGroupName, String serviceName, NotificationName notificationName) { + return getWithServiceResponseAsync(resourceGroupName, serviceName, notificationName).map(new Func1, NotificationContractInner>() { + @Override + public NotificationContractInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets the details of the Notification specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param notificationName Notification Name Identifier. Possible values include: 'RequestPublisherNotificationMessage', 'PurchasePublisherNotificationMessage', 'NewApplicationNotificationMessage', 'BCC', 'NewIssuePublisherNotificationMessage', 'AccountClosedPublisher', 'QuotaLimitApproachingPublisherNotificationMessage' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the NotificationContractInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String serviceName, NotificationName notificationName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (notificationName == null) { + throw new IllegalArgumentException("Parameter notificationName is required and cannot be null."); + } + 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.get(resourceGroupName, serviceName, notificationName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Create or Update API Management publisher notification. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param notificationName Notification Name Identifier. Possible values include: 'RequestPublisherNotificationMessage', 'PurchasePublisherNotificationMessage', 'NewApplicationNotificationMessage', 'BCC', 'NewIssuePublisherNotificationMessage', 'AccountClosedPublisher', 'QuotaLimitApproachingPublisherNotificationMessage' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the NotificationContractInner object if successful. + */ + public NotificationContractInner createOrUpdate(String resourceGroupName, String serviceName, NotificationName notificationName) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serviceName, notificationName).toBlocking().single().body(); + } + + /** + * Create or Update API Management publisher notification. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param notificationName Notification Name Identifier. Possible values include: 'RequestPublisherNotificationMessage', 'PurchasePublisherNotificationMessage', 'NewApplicationNotificationMessage', 'BCC', 'NewIssuePublisherNotificationMessage', 'AccountClosedPublisher', 'QuotaLimitApproachingPublisherNotificationMessage' + * @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 createOrUpdateAsync(String resourceGroupName, String serviceName, NotificationName notificationName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, serviceName, notificationName), serviceCallback); + } + + /** + * Create or Update API Management publisher notification. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param notificationName Notification Name Identifier. Possible values include: 'RequestPublisherNotificationMessage', 'PurchasePublisherNotificationMessage', 'NewApplicationNotificationMessage', 'BCC', 'NewIssuePublisherNotificationMessage', 'AccountClosedPublisher', 'QuotaLimitApproachingPublisherNotificationMessage' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the NotificationContractInner object + */ + public Observable createOrUpdateAsync(String resourceGroupName, String serviceName, NotificationName notificationName) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serviceName, notificationName).map(new Func1, NotificationContractInner>() { + @Override + public NotificationContractInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Create or Update API Management publisher notification. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param notificationName Notification Name Identifier. Possible values include: 'RequestPublisherNotificationMessage', 'PurchasePublisherNotificationMessage', 'NewApplicationNotificationMessage', 'BCC', 'NewIssuePublisherNotificationMessage', 'AccountClosedPublisher', 'QuotaLimitApproachingPublisherNotificationMessage' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the NotificationContractInner object + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String serviceName, NotificationName notificationName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (notificationName == null) { + throw new IllegalArgumentException("Parameter notificationName is required and cannot be null."); + } + 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 ifMatch = null; + return service.createOrUpdate(resourceGroupName, serviceName, notificationName, this.client.subscriptionId(), ifMatch, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = createOrUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Create or Update API Management publisher notification. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param notificationName Notification Name Identifier. Possible values include: 'RequestPublisherNotificationMessage', 'PurchasePublisherNotificationMessage', 'NewApplicationNotificationMessage', 'BCC', 'NewIssuePublisherNotificationMessage', 'AccountClosedPublisher', 'QuotaLimitApproachingPublisherNotificationMessage' + * @param ifMatch ETag of the Entity. Not required when creating an entity, but required when updating an entity. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the NotificationContractInner object if successful. + */ + public NotificationContractInner createOrUpdate(String resourceGroupName, String serviceName, NotificationName notificationName, String ifMatch) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serviceName, notificationName, ifMatch).toBlocking().single().body(); + } + + /** + * Create or Update API Management publisher notification. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param notificationName Notification Name Identifier. Possible values include: 'RequestPublisherNotificationMessage', 'PurchasePublisherNotificationMessage', 'NewApplicationNotificationMessage', 'BCC', 'NewIssuePublisherNotificationMessage', 'AccountClosedPublisher', 'QuotaLimitApproachingPublisherNotificationMessage' + * @param ifMatch ETag of the Entity. Not required when creating an entity, but required when updating an entity. + * @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 createOrUpdateAsync(String resourceGroupName, String serviceName, NotificationName notificationName, String ifMatch, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, serviceName, notificationName, ifMatch), serviceCallback); + } + + /** + * Create or Update API Management publisher notification. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param notificationName Notification Name Identifier. Possible values include: 'RequestPublisherNotificationMessage', 'PurchasePublisherNotificationMessage', 'NewApplicationNotificationMessage', 'BCC', 'NewIssuePublisherNotificationMessage', 'AccountClosedPublisher', 'QuotaLimitApproachingPublisherNotificationMessage' + * @param ifMatch ETag of the Entity. Not required when creating an entity, but required when updating an entity. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the NotificationContractInner object + */ + public Observable createOrUpdateAsync(String resourceGroupName, String serviceName, NotificationName notificationName, String ifMatch) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serviceName, notificationName, ifMatch).map(new Func1, NotificationContractInner>() { + @Override + public NotificationContractInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Create or Update API Management publisher notification. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param notificationName Notification Name Identifier. Possible values include: 'RequestPublisherNotificationMessage', 'PurchasePublisherNotificationMessage', 'NewApplicationNotificationMessage', 'BCC', 'NewIssuePublisherNotificationMessage', 'AccountClosedPublisher', 'QuotaLimitApproachingPublisherNotificationMessage' + * @param ifMatch ETag of the Entity. Not required when creating an entity, but required when updating an entity. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the NotificationContractInner object + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String serviceName, NotificationName notificationName, String ifMatch) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (notificationName == null) { + throw new IllegalArgumentException("Parameter notificationName is required and cannot be null."); + } + 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.createOrUpdate(resourceGroupName, serviceName, notificationName, this.client.subscriptionId(), ifMatch, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = createOrUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse createOrUpdateDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists a collection of properties defined within a service instance. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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<NotificationContractInner> object if successful. + */ + public PagedList listByServiceNext(final String nextPageLink) { + ServiceResponse> response = listByServiceNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByServiceNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists a collection of properties defined within a service instance. + * + * @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> listByServiceNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByServiceNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByServiceNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists a collection of properties defined within a service instance. + * + * @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<NotificationContractInner> object + */ + public Observable> listByServiceNextAsync(final String nextPageLink) { + return listByServiceNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists a collection of properties defined within a service instance. + * + * @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<NotificationContractInner> object + */ + public Observable>> listByServiceNextWithServiceResponseAsync(final String nextPageLink) { + return listByServiceNextSinglePageAsync(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(listByServiceNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists a collection of properties defined within a service instance. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<NotificationContractInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByServiceNextSinglePageAsync(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.listByServiceNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByServiceNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByServiceNextDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/OpenIdConnectProvidersImpl.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/OpenIdConnectProvidersImpl.java new file mode 100644 index 0000000000000..5316f854a56f4 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/OpenIdConnectProvidersImpl.java @@ -0,0 +1,87 @@ +/** + * 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. + * jkl + */ + +package com.microsoft.azure.management.apimanagement.v2019_01_01.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.apimanagement.v2019_01_01.OpenIdConnectProviders; +import rx.Completable; +import rx.functions.Func1; +import rx.Observable; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.apimanagement.v2019_01_01.OpenidConnectProviderContract; + +class OpenIdConnectProvidersImpl extends WrapperImpl implements OpenIdConnectProviders { + private final ApiManagementManager manager; + + OpenIdConnectProvidersImpl(ApiManagementManager manager) { + super(manager.inner().openIdConnectProviders()); + this.manager = manager; + } + + public ApiManagementManager manager() { + return this.manager; + } + + @Override + public OpenidConnectProviderContractImpl define(String name) { + return wrapModel(name); + } + + private OpenidConnectProviderContractImpl wrapModel(OpenidConnectProviderContractInner inner) { + return new OpenidConnectProviderContractImpl(inner, manager()); + } + + private OpenidConnectProviderContractImpl wrapModel(String name) { + return new OpenidConnectProviderContractImpl(name, this.manager()); + } + + @Override + public Observable listByServiceAsync(final String resourceGroupName, final String serviceName) { + OpenIdConnectProvidersInner client = this.inner(); + return client.listByServiceAsync(resourceGroupName, serviceName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public OpenidConnectProviderContract call(OpenidConnectProviderContractInner inner) { + return new OpenidConnectProviderContractImpl(inner, manager()); + } + }); + } + + @Override + public Completable getEntityTagAsync(String resourceGroupName, String serviceName, String opid) { + OpenIdConnectProvidersInner client = this.inner(); + return client.getEntityTagAsync(resourceGroupName, serviceName, opid).toCompletable(); + } + + @Override + public Observable getAsync(String resourceGroupName, String serviceName, String opid) { + OpenIdConnectProvidersInner client = this.inner(); + return client.getAsync(resourceGroupName, serviceName, opid) + .map(new Func1() { + @Override + public OpenidConnectProviderContract call(OpenidConnectProviderContractInner inner) { + return new OpenidConnectProviderContractImpl(inner, manager()); + } + }); + } + + @Override + public Completable deleteAsync(String resourceGroupName, String serviceName, String opid, String ifMatch) { + OpenIdConnectProvidersInner client = this.inner(); + return client.deleteAsync(resourceGroupName, serviceName, opid, ifMatch).toCompletable(); + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/OpenIdConnectProvidersInner.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/OpenIdConnectProvidersInner.java new file mode 100644 index 0000000000000..4fe41c9b5e88d --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/OpenIdConnectProvidersInner.java @@ -0,0 +1,1062 @@ +/** + * 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.apimanagement.v2019_01_01.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.apimanagement.v2019_01_01.ErrorResponseException; +import com.microsoft.azure.management.apimanagement.v2019_01_01.OpenIdConnectProviderCreateOrUpdateHeaders; +import com.microsoft.azure.management.apimanagement.v2019_01_01.OpenIdConnectProviderGetEntityTagHeaders; +import com.microsoft.azure.management.apimanagement.v2019_01_01.OpenIdConnectProviderGetHeaders; +import com.microsoft.azure.management.apimanagement.v2019_01_01.OpenidConnectProviderUpdateContract; +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.ServiceResponseWithHeaders; +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.HEAD; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.HTTP; +import retrofit2.http.PATCH; +import retrofit2.http.Path; +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 OpenIdConnectProviders. + */ +public class OpenIdConnectProvidersInner { + /** The Retrofit service to perform REST calls. */ + private OpenIdConnectProvidersService service; + /** The service client containing this operation class. */ + private ApiManagementClientImpl client; + + /** + * Initializes an instance of OpenIdConnectProvidersInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public OpenIdConnectProvidersInner(Retrofit retrofit, ApiManagementClientImpl client) { + this.service = retrofit.create(OpenIdConnectProvidersService.class); + this.client = client; + } + + /** + * The interface defining all the services for OpenIdConnectProviders to be + * used by Retrofit to perform actually REST calls. + */ + interface OpenIdConnectProvidersService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.apimanagement.v2019_01_01.OpenIdConnectProviders listByService" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/openidConnectProviders") + Observable> listByService(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("subscriptionId") String subscriptionId, @Query("$filter") String filter, @Query("$top") Integer top, @Query("$skip") Integer skip, @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.apimanagement.v2019_01_01.OpenIdConnectProviders getEntityTag" }) + @HEAD("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/openidConnectProviders/{opid}") + Observable> getEntityTag(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("opid") String opid, @Path("subscriptionId") String subscriptionId, @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.apimanagement.v2019_01_01.OpenIdConnectProviders get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/openidConnectProviders/{opid}") + Observable> get(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("opid") String opid, @Path("subscriptionId") String subscriptionId, @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.apimanagement.v2019_01_01.OpenIdConnectProviders createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/openidConnectProviders/{opid}") + Observable> createOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("opid") String opid, @Path("subscriptionId") String subscriptionId, @Body OpenidConnectProviderContractInner parameters, @Header("If-Match") String ifMatch, @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.apimanagement.v2019_01_01.OpenIdConnectProviders update" }) + @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/openidConnectProviders/{opid}") + Observable> update(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("opid") String opid, @Path("subscriptionId") String subscriptionId, @Body OpenidConnectProviderUpdateContract parameters, @Header("If-Match") String ifMatch, @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.apimanagement.v2019_01_01.OpenIdConnectProviders delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/openidConnectProviders/{opid}", method = "DELETE", hasBody = true) + Observable> delete(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("opid") String opid, @Path("subscriptionId") String subscriptionId, @Header("If-Match") String ifMatch, @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.apimanagement.v2019_01_01.OpenIdConnectProviders listByServiceNext" }) + @GET + Observable> listByServiceNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Lists of all the OpenId Connect Providers. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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<OpenidConnectProviderContractInner> object if successful. + */ + public PagedList listByService(final String resourceGroupName, final String serviceName) { + ServiceResponse> response = listByServiceSinglePageAsync(resourceGroupName, serviceName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByServiceNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists of all the OpenId Connect Providers. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @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> listByServiceAsync(final String resourceGroupName, final String serviceName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByServiceSinglePageAsync(resourceGroupName, serviceName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByServiceNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists of all the OpenId Connect Providers. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<OpenidConnectProviderContractInner> object + */ + public Observable> listByServiceAsync(final String resourceGroupName, final String serviceName) { + return listByServiceWithServiceResponseAsync(resourceGroupName, serviceName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists of all the OpenId Connect Providers. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<OpenidConnectProviderContractInner> object + */ + public Observable>> listByServiceWithServiceResponseAsync(final String resourceGroupName, final String serviceName) { + return listByServiceSinglePageAsync(resourceGroupName, serviceName) + .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(listByServiceNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists of all the OpenId Connect Providers. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<OpenidConnectProviderContractInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByServiceSinglePageAsync(final String resourceGroupName, final String serviceName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + 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 filter = null; + final Integer top = null; + final Integer skip = null; + return service.listByService(resourceGroupName, serviceName, this.client.subscriptionId(), filter, top, skip, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByServiceDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Lists of all the OpenId Connect Providers. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br> + * @param top Number of records to return. + * @param skip Number of records to skip. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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<OpenidConnectProviderContractInner> object if successful. + */ + public PagedList listByService(final String resourceGroupName, final String serviceName, final String filter, final Integer top, final Integer skip) { + ServiceResponse> response = listByServiceSinglePageAsync(resourceGroupName, serviceName, filter, top, skip).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByServiceNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists of all the OpenId Connect Providers. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br> + * @param top Number of records to return. + * @param skip Number of records to skip. + * @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> listByServiceAsync(final String resourceGroupName, final String serviceName, final String filter, final Integer top, final Integer skip, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByServiceSinglePageAsync(resourceGroupName, serviceName, filter, top, skip), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByServiceNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists of all the OpenId Connect Providers. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br> + * @param top Number of records to return. + * @param skip Number of records to skip. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<OpenidConnectProviderContractInner> object + */ + public Observable> listByServiceAsync(final String resourceGroupName, final String serviceName, final String filter, final Integer top, final Integer skip) { + return listByServiceWithServiceResponseAsync(resourceGroupName, serviceName, filter, top, skip) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists of all the OpenId Connect Providers. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br> + * @param top Number of records to return. + * @param skip Number of records to skip. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<OpenidConnectProviderContractInner> object + */ + public Observable>> listByServiceWithServiceResponseAsync(final String resourceGroupName, final String serviceName, final String filter, final Integer top, final Integer skip) { + return listByServiceSinglePageAsync(resourceGroupName, serviceName, filter, top, skip) + .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(listByServiceNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists of all the OpenId Connect Providers. + * + ServiceResponse> * @param resourceGroupName The name of the resource group. + ServiceResponse> * @param serviceName The name of the API Management service. + ServiceResponse> * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br> + ServiceResponse> * @param top Number of records to return. + ServiceResponse> * @param skip Number of records to skip. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<OpenidConnectProviderContractInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByServiceSinglePageAsync(final String resourceGroupName, final String serviceName, final String filter, final Integer top, final Integer skip) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + 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.listByService(resourceGroupName, serviceName, this.client.subscriptionId(), filter, top, skip, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByServiceDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByServiceDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Gets the entity state (Etag) version of the openIdConnectProvider specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param opid Identifier of the OpenID Connect Provider. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void getEntityTag(String resourceGroupName, String serviceName, String opid) { + getEntityTagWithServiceResponseAsync(resourceGroupName, serviceName, opid).toBlocking().single().body(); + } + + /** + * Gets the entity state (Etag) version of the openIdConnectProvider specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param opid Identifier of the OpenID Connect 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 getEntityTagAsync(String resourceGroupName, String serviceName, String opid, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(getEntityTagWithServiceResponseAsync(resourceGroupName, serviceName, opid), serviceCallback); + } + + /** + * Gets the entity state (Etag) version of the openIdConnectProvider specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param opid Identifier of the OpenID Connect Provider. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public Observable getEntityTagAsync(String resourceGroupName, String serviceName, String opid) { + return getEntityTagWithServiceResponseAsync(resourceGroupName, serviceName, opid).map(new Func1, Void>() { + @Override + public Void call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Gets the entity state (Etag) version of the openIdConnectProvider specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param opid Identifier of the OpenID Connect Provider. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public Observable> getEntityTagWithServiceResponseAsync(String resourceGroupName, String serviceName, String opid) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (opid == null) { + throw new IllegalArgumentException("Parameter opid is required and cannot be null."); + } + 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.getEntityTag(resourceGroupName, serviceName, opid, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = getEntityTagDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponseWithHeaders getEntityTagDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .buildEmptyWithHeaders(response, OpenIdConnectProviderGetEntityTagHeaders.class); + } + + /** + * Gets specific OpenID Connect Provider. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param opid Identifier of the OpenID Connect Provider. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the OpenidConnectProviderContractInner object if successful. + */ + public OpenidConnectProviderContractInner get(String resourceGroupName, String serviceName, String opid) { + return getWithServiceResponseAsync(resourceGroupName, serviceName, opid).toBlocking().single().body(); + } + + /** + * Gets specific OpenID Connect Provider. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param opid Identifier of the OpenID Connect 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 getAsync(String resourceGroupName, String serviceName, String opid, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(getWithServiceResponseAsync(resourceGroupName, serviceName, opid), serviceCallback); + } + + /** + * Gets specific OpenID Connect Provider. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param opid Identifier of the OpenID Connect Provider. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the OpenidConnectProviderContractInner object + */ + public Observable getAsync(String resourceGroupName, String serviceName, String opid) { + return getWithServiceResponseAsync(resourceGroupName, serviceName, opid).map(new Func1, OpenidConnectProviderContractInner>() { + @Override + public OpenidConnectProviderContractInner call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Gets specific OpenID Connect Provider. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param opid Identifier of the OpenID Connect Provider. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the OpenidConnectProviderContractInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String serviceName, String opid) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (opid == null) { + throw new IllegalArgumentException("Parameter opid is required and cannot be null."); + } + 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.get(resourceGroupName, serviceName, opid, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = getDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponseWithHeaders getDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .buildWithHeaders(response, OpenIdConnectProviderGetHeaders.class); + } + + /** + * Creates or updates the OpenID Connect Provider. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param opid Identifier of the OpenID Connect Provider. + * @param parameters Create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the OpenidConnectProviderContractInner object if successful. + */ + public OpenidConnectProviderContractInner createOrUpdate(String resourceGroupName, String serviceName, String opid, OpenidConnectProviderContractInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serviceName, opid, parameters).toBlocking().single().body(); + } + + /** + * Creates or updates the OpenID Connect Provider. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param opid Identifier of the OpenID Connect Provider. + * @param parameters Create parameters. + * @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 createOrUpdateAsync(String resourceGroupName, String serviceName, String opid, OpenidConnectProviderContractInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, serviceName, opid, parameters), serviceCallback); + } + + /** + * Creates or updates the OpenID Connect Provider. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param opid Identifier of the OpenID Connect Provider. + * @param parameters Create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the OpenidConnectProviderContractInner object + */ + public Observable createOrUpdateAsync(String resourceGroupName, String serviceName, String opid, OpenidConnectProviderContractInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serviceName, opid, parameters).map(new Func1, OpenidConnectProviderContractInner>() { + @Override + public OpenidConnectProviderContractInner call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Creates or updates the OpenID Connect Provider. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param opid Identifier of the OpenID Connect Provider. + * @param parameters Create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the OpenidConnectProviderContractInner object + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String serviceName, String opid, OpenidConnectProviderContractInner parameters) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (opid == null) { + throw new IllegalArgumentException("Parameter opid is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(parameters); + final String ifMatch = null; + return service.createOrUpdate(resourceGroupName, serviceName, opid, this.client.subscriptionId(), parameters, ifMatch, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = createOrUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Creates or updates the OpenID Connect Provider. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param opid Identifier of the OpenID Connect Provider. + * @param parameters Create parameters. + * @param ifMatch ETag of the Entity. Not required when creating an entity, but required when updating an entity. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the OpenidConnectProviderContractInner object if successful. + */ + public OpenidConnectProviderContractInner createOrUpdate(String resourceGroupName, String serviceName, String opid, OpenidConnectProviderContractInner parameters, String ifMatch) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serviceName, opid, parameters, ifMatch).toBlocking().single().body(); + } + + /** + * Creates or updates the OpenID Connect Provider. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param opid Identifier of the OpenID Connect Provider. + * @param parameters Create parameters. + * @param ifMatch ETag of the Entity. Not required when creating an entity, but required when updating an entity. + * @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 createOrUpdateAsync(String resourceGroupName, String serviceName, String opid, OpenidConnectProviderContractInner parameters, String ifMatch, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, serviceName, opid, parameters, ifMatch), serviceCallback); + } + + /** + * Creates or updates the OpenID Connect Provider. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param opid Identifier of the OpenID Connect Provider. + * @param parameters Create parameters. + * @param ifMatch ETag of the Entity. Not required when creating an entity, but required when updating an entity. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the OpenidConnectProviderContractInner object + */ + public Observable createOrUpdateAsync(String resourceGroupName, String serviceName, String opid, OpenidConnectProviderContractInner parameters, String ifMatch) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serviceName, opid, parameters, ifMatch).map(new Func1, OpenidConnectProviderContractInner>() { + @Override + public OpenidConnectProviderContractInner call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Creates or updates the OpenID Connect Provider. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param opid Identifier of the OpenID Connect Provider. + * @param parameters Create parameters. + * @param ifMatch ETag of the Entity. Not required when creating an entity, but required when updating an entity. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the OpenidConnectProviderContractInner object + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String serviceName, String opid, OpenidConnectProviderContractInner parameters, String ifMatch) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (opid == null) { + throw new IllegalArgumentException("Parameter opid is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(parameters); + return service.createOrUpdate(resourceGroupName, serviceName, opid, this.client.subscriptionId(), parameters, ifMatch, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = createOrUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponseWithHeaders createOrUpdateDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(201, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .buildWithHeaders(response, OpenIdConnectProviderCreateOrUpdateHeaders.class); + } + + /** + * Updates the specific OpenID Connect Provider. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param opid Identifier of the OpenID Connect Provider. + * @param parameters Update parameters. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void update(String resourceGroupName, String serviceName, String opid, OpenidConnectProviderUpdateContract parameters, String ifMatch) { + updateWithServiceResponseAsync(resourceGroupName, serviceName, opid, parameters, ifMatch).toBlocking().single().body(); + } + + /** + * Updates the specific OpenID Connect Provider. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param opid Identifier of the OpenID Connect Provider. + * @param parameters Update parameters. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @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 serviceName, String opid, OpenidConnectProviderUpdateContract parameters, String ifMatch, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateWithServiceResponseAsync(resourceGroupName, serviceName, opid, parameters, ifMatch), serviceCallback); + } + + /** + * Updates the specific OpenID Connect Provider. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param opid Identifier of the OpenID Connect Provider. + * @param parameters Update parameters. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable updateAsync(String resourceGroupName, String serviceName, String opid, OpenidConnectProviderUpdateContract parameters, String ifMatch) { + return updateWithServiceResponseAsync(resourceGroupName, serviceName, opid, parameters, ifMatch).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates the specific OpenID Connect Provider. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param opid Identifier of the OpenID Connect Provider. + * @param parameters Update parameters. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> updateWithServiceResponseAsync(String resourceGroupName, String serviceName, String opid, OpenidConnectProviderUpdateContract parameters, String ifMatch) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (opid == null) { + throw new IllegalArgumentException("Parameter opid is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + if (ifMatch == null) { + throw new IllegalArgumentException("Parameter ifMatch is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(parameters); + return service.update(resourceGroupName, serviceName, opid, this.client.subscriptionId(), parameters, ifMatch, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = updateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse updateDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(204, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Deletes specific OpenID Connect Provider of the API Management service instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param opid Identifier of the OpenID Connect Provider. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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 serviceName, String opid, String ifMatch) { + deleteWithServiceResponseAsync(resourceGroupName, serviceName, opid, ifMatch).toBlocking().single().body(); + } + + /** + * Deletes specific OpenID Connect Provider of the API Management service instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param opid Identifier of the OpenID Connect Provider. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @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 serviceName, String opid, String ifMatch, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, serviceName, opid, ifMatch), serviceCallback); + } + + /** + * Deletes specific OpenID Connect Provider of the API Management service instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param opid Identifier of the OpenID Connect Provider. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable deleteAsync(String resourceGroupName, String serviceName, String opid, String ifMatch) { + return deleteWithServiceResponseAsync(resourceGroupName, serviceName, opid, ifMatch).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes specific OpenID Connect Provider of the API Management service instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param opid Identifier of the OpenID Connect Provider. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> deleteWithServiceResponseAsync(String resourceGroupName, String serviceName, String opid, String ifMatch) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (opid == null) { + throw new IllegalArgumentException("Parameter opid is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (ifMatch == null) { + throw new IllegalArgumentException("Parameter ifMatch 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.delete(resourceGroupName, serviceName, opid, this.client.subscriptionId(), ifMatch, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = deleteDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse deleteDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(204, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists of all the OpenId Connect Providers. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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<OpenidConnectProviderContractInner> object if successful. + */ + public PagedList listByServiceNext(final String nextPageLink) { + ServiceResponse> response = listByServiceNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByServiceNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists of all the OpenId Connect Providers. + * + * @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> listByServiceNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByServiceNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByServiceNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists of all the OpenId Connect Providers. + * + * @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<OpenidConnectProviderContractInner> object + */ + public Observable> listByServiceNextAsync(final String nextPageLink) { + return listByServiceNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists of all the OpenId Connect Providers. + * + * @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<OpenidConnectProviderContractInner> object + */ + public Observable>> listByServiceNextWithServiceResponseAsync(final String nextPageLink) { + return listByServiceNextSinglePageAsync(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(listByServiceNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists of all the OpenId Connect Providers. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<OpenidConnectProviderContractInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByServiceNextSinglePageAsync(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.listByServiceNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByServiceNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByServiceNextDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/OpenidConnectProviderContractImpl.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/OpenidConnectProviderContractImpl.java new file mode 100644 index 0000000000000..48484bf1a8bbf --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/OpenidConnectProviderContractImpl.java @@ -0,0 +1,167 @@ +/** + * 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.apimanagement.v2019_01_01.implementation; + +import com.microsoft.azure.management.apimanagement.v2019_01_01.OpenidConnectProviderContract; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; + +class OpenidConnectProviderContractImpl extends CreatableUpdatableImpl implements OpenidConnectProviderContract, OpenidConnectProviderContract.Definition, OpenidConnectProviderContract.Update { + private String resourceGroupName; + private String serviceName; + private String opid; + private String cifMatch; + private String uifMatch; + private final ApiManagementManager manager; + + OpenidConnectProviderContractImpl(String name, ApiManagementManager manager) { + super(name, new OpenidConnectProviderContractInner()); + this.manager = manager; + // Set resource name + this.opid = name; + // + } + + OpenidConnectProviderContractImpl(OpenidConnectProviderContractInner inner, ApiManagementManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.opid = inner.name(); + // set resource ancestor and positional variables + this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourceGroups"); + this.serviceName = IdParsingUtils.getValueFromIdByName(inner.id(), "service"); + this.opid = IdParsingUtils.getValueFromIdByName(inner.id(), "openidConnectProviders"); + // set other parameters for create and update + } + + @Override + public ApiManagementManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + OpenIdConnectProvidersInner client = this.manager().inner().openIdConnectProviders(); + return client.createOrUpdateAsync(this.resourceGroupName, this.serviceName, this.opid, this.inner(), this.cifMatch) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + OpenIdConnectProvidersInner client = this.manager().inner().openIdConnectProviders(); + return client.createOrUpdateAsync(this.resourceGroupName, this.serviceName, this.opid, this.inner(), this.uifMatch) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + OpenIdConnectProvidersInner client = this.manager().inner().openIdConnectProviders(); + return null; // NOP getInnerAsync implementation as get is not supported + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + + @Override + public String clientId() { + return this.inner().clientId(); + } + + @Override + public String clientSecret() { + return this.inner().clientSecret(); + } + + @Override + public String description() { + return this.inner().description(); + } + + @Override + public String displayName() { + return this.inner().displayName(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String metadataEndpoint() { + return this.inner().metadataEndpoint(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public OpenidConnectProviderContractImpl withResourceGroupName(String resourceGroupName) { + this.resourceGroupName = resourceGroupName; + return this; + } + + @Override + public OpenidConnectProviderContractImpl withServiceName(String serviceName) { + this.serviceName = serviceName; + return this; + } + + @Override + public OpenidConnectProviderContractImpl withClientId(String clientId) { + this.inner().withClientId(clientId); + return this; + } + + @Override + public OpenidConnectProviderContractImpl withDisplayName(String displayName) { + this.inner().withDisplayName(displayName); + return this; + } + + @Override + public OpenidConnectProviderContractImpl withMetadataEndpoint(String metadataEndpoint) { + this.inner().withMetadataEndpoint(metadataEndpoint); + return this; + } + + @Override + public OpenidConnectProviderContractImpl withIfMatch(String ifMatch) { + if (isInCreateMode()) { + this.cifMatch = ifMatch; + } else { + this.uifMatch = ifMatch; + } + return this; + } + + @Override + public OpenidConnectProviderContractImpl withClientSecret(String clientSecret) { + this.inner().withClientSecret(clientSecret); + return this; + } + + @Override + public OpenidConnectProviderContractImpl withDescription(String description) { + this.inner().withDescription(description); + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/OpenidConnectProviderContractInner.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/OpenidConnectProviderContractInner.java new file mode 100644 index 0000000000000..a022c83c9d91b --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/OpenidConnectProviderContractInner.java @@ -0,0 +1,150 @@ +/** + * 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.apimanagement.v2019_01_01.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * OpenId Connect Provider details. + */ +@JsonFlatten +public class OpenidConnectProviderContractInner extends ProxyResource { + /** + * User-friendly OpenID Connect Provider name. + */ + @JsonProperty(value = "properties.displayName", required = true) + private String displayName; + + /** + * User-friendly description of OpenID Connect Provider. + */ + @JsonProperty(value = "properties.description") + private String description; + + /** + * Metadata endpoint URI. + */ + @JsonProperty(value = "properties.metadataEndpoint", required = true) + private String metadataEndpoint; + + /** + * Client ID of developer console which is the client application. + */ + @JsonProperty(value = "properties.clientId", required = true) + private String clientId; + + /** + * Client Secret of developer console which is the client application. + */ + @JsonProperty(value = "properties.clientSecret") + private String clientSecret; + + /** + * Get user-friendly OpenID Connect Provider name. + * + * @return the displayName value + */ + public String displayName() { + return this.displayName; + } + + /** + * Set user-friendly OpenID Connect Provider name. + * + * @param displayName the displayName value to set + * @return the OpenidConnectProviderContractInner object itself. + */ + public OpenidConnectProviderContractInner withDisplayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Get user-friendly description of OpenID Connect Provider. + * + * @return the description value + */ + public String description() { + return this.description; + } + + /** + * Set user-friendly description of OpenID Connect Provider. + * + * @param description the description value to set + * @return the OpenidConnectProviderContractInner object itself. + */ + public OpenidConnectProviderContractInner withDescription(String description) { + this.description = description; + return this; + } + + /** + * Get metadata endpoint URI. + * + * @return the metadataEndpoint value + */ + public String metadataEndpoint() { + return this.metadataEndpoint; + } + + /** + * Set metadata endpoint URI. + * + * @param metadataEndpoint the metadataEndpoint value to set + * @return the OpenidConnectProviderContractInner object itself. + */ + public OpenidConnectProviderContractInner withMetadataEndpoint(String metadataEndpoint) { + this.metadataEndpoint = metadataEndpoint; + return this; + } + + /** + * Get client ID of developer console which is the client application. + * + * @return the clientId value + */ + public String clientId() { + return this.clientId; + } + + /** + * Set client ID of developer console which is the client application. + * + * @param clientId the clientId value to set + * @return the OpenidConnectProviderContractInner object itself. + */ + public OpenidConnectProviderContractInner withClientId(String clientId) { + this.clientId = clientId; + return this; + } + + /** + * Get client Secret of developer console which is the client application. + * + * @return the clientSecret value + */ + public String clientSecret() { + return this.clientSecret; + } + + /** + * Set client Secret of developer console which is the client application. + * + * @param clientSecret the clientSecret value to set + * @return the OpenidConnectProviderContractInner object itself. + */ + public OpenidConnectProviderContractInner withClientSecret(String clientSecret) { + this.clientSecret = clientSecret; + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/OperationApiPolicyContractImpl.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/OperationApiPolicyContractImpl.java new file mode 100644 index 0000000000000..4f4769383bb2b --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/OperationApiPolicyContractImpl.java @@ -0,0 +1,133 @@ +/** + * 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.apimanagement.v2019_01_01.implementation; + +import com.microsoft.azure.management.apimanagement.v2019_01_01.OperationApiPolicyContract; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import com.microsoft.azure.management.apimanagement.v2019_01_01.PolicyContentFormat; + +class OperationApiPolicyContractImpl extends CreatableUpdatableImpl implements OperationApiPolicyContract, OperationApiPolicyContract.Definition, OperationApiPolicyContract.Update { + private final ApiManagementManager manager; + private String resourceGroupName; + private String serviceName; + private String apiId; + private String operationId; + private String cifMatch; + private String uifMatch; + + OperationApiPolicyContractImpl(String name, ApiManagementManager manager) { + super(name, new PolicyContractInner()); + this.manager = manager; + // Set resource name + this.operationId = name; + // + } + + OperationApiPolicyContractImpl(PolicyContractInner inner, ApiManagementManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.operationId = inner.name(); + // set resource ancestor and positional variables + this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourceGroups"); + this.serviceName = IdParsingUtils.getValueFromIdByName(inner.id(), "service"); + this.apiId = IdParsingUtils.getValueFromIdByName(inner.id(), "apis"); + this.operationId = IdParsingUtils.getValueFromIdByName(inner.id(), "operations"); + // + } + + @Override + public ApiManagementManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + ApiOperationPolicysInner client = this.manager().inner().apiOperationPolicys(); + return client.createOrUpdateAsync(this.resourceGroupName, this.serviceName, this.apiId, this.operationId, this.inner(), this.cifMatch) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + ApiOperationPolicysInner client = this.manager().inner().apiOperationPolicys(); + return client.createOrUpdateAsync(this.resourceGroupName, this.serviceName, this.apiId, this.operationId, this.inner(), this.uifMatch) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + ApiOperationPolicysInner client = this.manager().inner().apiOperationPolicys(); + return client.getAsync(this.resourceGroupName, this.serviceName, this.apiId, this.operationId); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + + @Override + public PolicyContentFormat format() { + return this.inner().format(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public String value() { + return this.inner().value(); + } + + @Override + public OperationApiPolicyContractImpl withExistingOperation(String resourceGroupName, String serviceName, String apiId, String operationId) { + this.resourceGroupName = resourceGroupName; + this.serviceName = serviceName; + this.apiId = apiId; + this.operationId = operationId; + return this; + } + + @Override + public OperationApiPolicyContractImpl withValue(String value) { + this.inner().withValue(value); + return this; + } + + @Override + public OperationApiPolicyContractImpl withIfMatch(String ifMatch) { + if (isInCreateMode()) { + this.cifMatch = ifMatch; + } else { + this.uifMatch = ifMatch; + } + return this; + } + + @Override + public OperationApiPolicyContractImpl withFormat(PolicyContentFormat format) { + this.inner().withFormat(format); + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/OperationContractImpl.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/OperationContractImpl.java new file mode 100644 index 0000000000000..36864ef6abd6e --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/OperationContractImpl.java @@ -0,0 +1,201 @@ +/** + * 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.apimanagement.v2019_01_01.implementation; + +import com.microsoft.azure.management.apimanagement.v2019_01_01.OperationContract; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import java.util.List; +import com.microsoft.azure.management.apimanagement.v2019_01_01.ParameterContract; +import com.microsoft.azure.management.apimanagement.v2019_01_01.RequestContract; +import com.microsoft.azure.management.apimanagement.v2019_01_01.ResponseContract; + +class OperationContractImpl extends CreatableUpdatableImpl implements OperationContract, OperationContract.Definition, OperationContract.Update { + private final ApiManagementManager manager; + private String resourceGroupName; + private String serviceName; + private String apiId; + private String operationId; + private String cifMatch; + private String uifMatch; + + OperationContractImpl(String name, ApiManagementManager manager) { + super(name, new OperationContractInner()); + this.manager = manager; + // Set resource name + this.operationId = name; + // + } + + OperationContractImpl(OperationContractInner inner, ApiManagementManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.operationId = inner.name(); + // set resource ancestor and positional variables + this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourceGroups"); + this.serviceName = IdParsingUtils.getValueFromIdByName(inner.id(), "service"); + this.apiId = IdParsingUtils.getValueFromIdByName(inner.id(), "apis"); + this.operationId = IdParsingUtils.getValueFromIdByName(inner.id(), "operations"); + // + } + + @Override + public ApiManagementManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + ApiOperationsInner client = this.manager().inner().apiOperations(); + return client.createOrUpdateAsync(this.resourceGroupName, this.serviceName, this.apiId, this.operationId, this.inner(), this.cifMatch) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + ApiOperationsInner client = this.manager().inner().apiOperations(); + return client.createOrUpdateAsync(this.resourceGroupName, this.serviceName, this.apiId, this.operationId, this.inner(), this.uifMatch) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + ApiOperationsInner client = this.manager().inner().apiOperations(); + return client.getAsync(this.resourceGroupName, this.serviceName, this.apiId, this.operationId); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + + @Override + public String description() { + return this.inner().description(); + } + + @Override + public String displayName() { + return this.inner().displayName(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String method() { + return this.inner().method(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public String policies() { + return this.inner().policies(); + } + + @Override + public RequestContract request() { + return this.inner().request(); + } + + @Override + public List responses() { + return this.inner().responses(); + } + + @Override + public List templateParameters() { + return this.inner().templateParameters(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public String urlTemplate() { + return this.inner().urlTemplate(); + } + + @Override + public OperationContractImpl withExistingApi(String resourceGroupName, String serviceName, String apiId) { + this.resourceGroupName = resourceGroupName; + this.serviceName = serviceName; + this.apiId = apiId; + return this; + } + + @Override + public OperationContractImpl withDisplayName(String displayName) { + this.inner().withDisplayName(displayName); + return this; + } + + @Override + public OperationContractImpl withMethod(String method) { + this.inner().withMethod(method); + return this; + } + + @Override + public OperationContractImpl withUrlTemplate(String urlTemplate) { + this.inner().withUrlTemplate(urlTemplate); + return this; + } + + @Override + public OperationContractImpl withIfMatch(String ifMatch) { + if (isInCreateMode()) { + this.cifMatch = ifMatch; + } else { + this.uifMatch = ifMatch; + } + return this; + } + + @Override + public OperationContractImpl withDescription(String description) { + this.inner().withDescription(description); + return this; + } + + @Override + public OperationContractImpl withPolicies(String policies) { + this.inner().withPolicies(policies); + return this; + } + + @Override + public OperationContractImpl withRequest(RequestContract request) { + this.inner().withRequest(request); + return this; + } + + @Override + public OperationContractImpl withResponses(List responses) { + this.inner().withResponses(responses); + return this; + } + + @Override + public OperationContractImpl withTemplateParameters(List templateParameters) { + this.inner().withTemplateParameters(templateParameters); + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/OperationContractInner.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/OperationContractInner.java new file mode 100644 index 0000000000000..ba851b4cca5d6 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/OperationContractInner.java @@ -0,0 +1,235 @@ +/** + * 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.apimanagement.v2019_01_01.implementation; + +import java.util.List; +import com.microsoft.azure.management.apimanagement.v2019_01_01.ParameterContract; +import com.microsoft.azure.management.apimanagement.v2019_01_01.RequestContract; +import com.microsoft.azure.management.apimanagement.v2019_01_01.ResponseContract; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * Api Operation details. + */ +@JsonFlatten +public class OperationContractInner extends ProxyResource { + /** + * Collection of URL template parameters. + */ + @JsonProperty(value = "properties.templateParameters") + private List templateParameters; + + /** + * Description of the operation. May include HTML formatting tags. + */ + @JsonProperty(value = "properties.description") + private String description; + + /** + * An entity containing request details. + */ + @JsonProperty(value = "properties.request") + private RequestContract request; + + /** + * Array of Operation responses. + */ + @JsonProperty(value = "properties.responses") + private List responses; + + /** + * Operation Policies. + */ + @JsonProperty(value = "properties.policies") + private String policies; + + /** + * Operation Name. + */ + @JsonProperty(value = "properties.displayName", required = true) + private String displayName; + + /** + * A Valid HTTP Operation Method. Typical Http Methods like GET, PUT, POST + * but not limited by only them. + */ + @JsonProperty(value = "properties.method", required = true) + private String method; + + /** + * Relative URL template identifying the target resource for this + * operation. May include parameters. Example: + * /customers/{cid}/orders/{oid}/?date={date}. + */ + @JsonProperty(value = "properties.urlTemplate", required = true) + private String urlTemplate; + + /** + * Get collection of URL template parameters. + * + * @return the templateParameters value + */ + public List templateParameters() { + return this.templateParameters; + } + + /** + * Set collection of URL template parameters. + * + * @param templateParameters the templateParameters value to set + * @return the OperationContractInner object itself. + */ + public OperationContractInner withTemplateParameters(List templateParameters) { + this.templateParameters = templateParameters; + return this; + } + + /** + * Get description of the operation. May include HTML formatting tags. + * + * @return the description value + */ + public String description() { + return this.description; + } + + /** + * Set description of the operation. May include HTML formatting tags. + * + * @param description the description value to set + * @return the OperationContractInner object itself. + */ + public OperationContractInner withDescription(String description) { + this.description = description; + return this; + } + + /** + * Get an entity containing request details. + * + * @return the request value + */ + public RequestContract request() { + return this.request; + } + + /** + * Set an entity containing request details. + * + * @param request the request value to set + * @return the OperationContractInner object itself. + */ + public OperationContractInner withRequest(RequestContract request) { + this.request = request; + return this; + } + + /** + * Get array of Operation responses. + * + * @return the responses value + */ + public List responses() { + return this.responses; + } + + /** + * Set array of Operation responses. + * + * @param responses the responses value to set + * @return the OperationContractInner object itself. + */ + public OperationContractInner withResponses(List responses) { + this.responses = responses; + return this; + } + + /** + * Get operation Policies. + * + * @return the policies value + */ + public String policies() { + return this.policies; + } + + /** + * Set operation Policies. + * + * @param policies the policies value to set + * @return the OperationContractInner object itself. + */ + public OperationContractInner withPolicies(String policies) { + this.policies = policies; + return this; + } + + /** + * Get operation Name. + * + * @return the displayName value + */ + public String displayName() { + return this.displayName; + } + + /** + * Set operation Name. + * + * @param displayName the displayName value to set + * @return the OperationContractInner object itself. + */ + public OperationContractInner withDisplayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Get a Valid HTTP Operation Method. Typical Http Methods like GET, PUT, POST but not limited by only them. + * + * @return the method value + */ + public String method() { + return this.method; + } + + /** + * Set a Valid HTTP Operation Method. Typical Http Methods like GET, PUT, POST but not limited by only them. + * + * @param method the method value to set + * @return the OperationContractInner object itself. + */ + public OperationContractInner withMethod(String method) { + this.method = method; + return this; + } + + /** + * Get relative URL template identifying the target resource for this operation. May include parameters. Example: /customers/{cid}/orders/{oid}/?date={date}. + * + * @return the urlTemplate value + */ + public String urlTemplate() { + return this.urlTemplate; + } + + /** + * Set relative URL template identifying the target resource for this operation. May include parameters. Example: /customers/{cid}/orders/{oid}/?date={date}. + * + * @param urlTemplate the urlTemplate value to set + * @return the OperationContractInner object itself. + */ + public OperationContractInner withUrlTemplate(String urlTemplate) { + this.urlTemplate = urlTemplate; + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/OperationImpl.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/OperationImpl.java new file mode 100644 index 0000000000000..02b2118c73cc3 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/OperationImpl.java @@ -0,0 +1,47 @@ +/** + * 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.apimanagement.v2019_01_01.implementation; + +import com.microsoft.azure.management.apimanagement.v2019_01_01.Operation; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.apimanagement.v2019_01_01.OperationDisplay; + +class OperationImpl extends WrapperImpl implements Operation { + private final ApiManagementManager manager; + OperationImpl(OperationInner inner, ApiManagementManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public ApiManagementManager manager() { + return this.manager; + } + + @Override + public OperationDisplay display() { + return this.inner().display(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public String origin() { + return this.inner().origin(); + } + + @Override + public Object properties() { + return this.inner().properties(); + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/OperationInner.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/OperationInner.java new file mode 100644 index 0000000000000..25363bfd15542 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/OperationInner.java @@ -0,0 +1,122 @@ +/** + * 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.apimanagement.v2019_01_01.implementation; + +import com.microsoft.azure.management.apimanagement.v2019_01_01.OperationDisplay; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * REST API operation. + */ +public class OperationInner { + /** + * Operation name: {provider}/{resource}/{operation}. + */ + @JsonProperty(value = "name") + private String name; + + /** + * The object that describes the operation. + */ + @JsonProperty(value = "display") + private OperationDisplay display; + + /** + * The operation origin. + */ + @JsonProperty(value = "origin") + private String origin; + + /** + * The operation properties. + */ + @JsonProperty(value = "properties") + private Object properties; + + /** + * 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 OperationInner object itself. + */ + public OperationInner withName(String name) { + this.name = name; + return this; + } + + /** + * Get the object that describes the operation. + * + * @return the display value + */ + public OperationDisplay display() { + return this.display; + } + + /** + * Set the object that describes the operation. + * + * @param display the display value to set + * @return the OperationInner object itself. + */ + public OperationInner withDisplay(OperationDisplay display) { + this.display = display; + return this; + } + + /** + * Get the operation origin. + * + * @return the origin value + */ + public String origin() { + return this.origin; + } + + /** + * Set the operation origin. + * + * @param origin the origin value to set + * @return the OperationInner object itself. + */ + public OperationInner withOrigin(String origin) { + this.origin = origin; + return this; + } + + /** + * Get the operation properties. + * + * @return the properties value + */ + public Object properties() { + return this.properties; + } + + /** + * Set the operation properties. + * + * @param properties the properties value to set + * @return the OperationInner object itself. + */ + public OperationInner withProperties(Object properties) { + this.properties = properties; + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/OperationResultContractImpl.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/OperationResultContractImpl.java new file mode 100644 index 0000000000000..bfafc3697bd66 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/OperationResultContractImpl.java @@ -0,0 +1,66 @@ +/** + * 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.apimanagement.v2019_01_01.implementation; + +import com.microsoft.azure.management.apimanagement.v2019_01_01.OperationResultContract; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import java.util.List; +import com.microsoft.azure.management.apimanagement.v2019_01_01.OperationResultLogItemContract; +import com.microsoft.azure.management.apimanagement.v2019_01_01.ErrorResponseBody; +import org.joda.time.DateTime; +import com.microsoft.azure.management.apimanagement.v2019_01_01.AsyncOperationStatus; + +class OperationResultContractImpl extends WrapperImpl implements OperationResultContract { + private final ApiManagementManager manager; + OperationResultContractImpl(OperationResultContractInner inner, ApiManagementManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public ApiManagementManager manager() { + return this.manager; + } + + @Override + public List actionLog() { + return this.inner().actionLog(); + } + + @Override + public ErrorResponseBody error() { + return this.inner().error(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String resultInfo() { + return this.inner().resultInfo(); + } + + @Override + public DateTime started() { + return this.inner().started(); + } + + @Override + public AsyncOperationStatus status() { + return this.inner().status(); + } + + @Override + public DateTime updated() { + return this.inner().updated(); + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/OperationResultContractInner.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/OperationResultContractInner.java new file mode 100644 index 0000000000000..3a87bd2531fc4 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/OperationResultContractInner.java @@ -0,0 +1,200 @@ +/** + * 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.apimanagement.v2019_01_01.implementation; + +import com.microsoft.azure.management.apimanagement.v2019_01_01.AsyncOperationStatus; +import org.joda.time.DateTime; +import com.microsoft.azure.management.apimanagement.v2019_01_01.ErrorResponseBody; +import java.util.List; +import com.microsoft.azure.management.apimanagement.v2019_01_01.OperationResultLogItemContract; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Operation Result. + */ +public class OperationResultContractInner { + /** + * Operation result identifier. + */ + @JsonProperty(value = "id") + private String id; + + /** + * Status of an async operation. Possible values include: 'Started', + * 'InProgress', 'Succeeded', 'Failed'. + */ + @JsonProperty(value = "status") + private AsyncOperationStatus status; + + /** + * Start time of an async operation. The date conforms to the following + * format: `yyyy-MM-ddTHH:mm:ssZ` as specified by the ISO 8601 standard. + */ + @JsonProperty(value = "started") + private DateTime started; + + /** + * Last update time of an async operation. The date conforms to the + * following format: `yyyy-MM-ddTHH:mm:ssZ` as specified by the ISO 8601 + * standard. + */ + @JsonProperty(value = "updated") + private DateTime updated; + + /** + * Optional result info. + */ + @JsonProperty(value = "resultInfo") + private String resultInfo; + + /** + * Error Body Contract. + */ + @JsonProperty(value = "error") + private ErrorResponseBody error; + + /** + * This property if only provided as part of the + * TenantConfiguration_Validate operation. It contains the log the entities + * which will be updated/created/deleted as part of the + * TenantConfiguration_Deploy operation. + */ + @JsonProperty(value = "actionLog", access = JsonProperty.Access.WRITE_ONLY) + private List actionLog; + + /** + * Get operation result identifier. + * + * @return the id value + */ + public String id() { + return this.id; + } + + /** + * Set operation result identifier. + * + * @param id the id value to set + * @return the OperationResultContractInner object itself. + */ + public OperationResultContractInner withId(String id) { + this.id = id; + return this; + } + + /** + * Get status of an async operation. Possible values include: 'Started', 'InProgress', 'Succeeded', 'Failed'. + * + * @return the status value + */ + public AsyncOperationStatus status() { + return this.status; + } + + /** + * Set status of an async operation. Possible values include: 'Started', 'InProgress', 'Succeeded', 'Failed'. + * + * @param status the status value to set + * @return the OperationResultContractInner object itself. + */ + public OperationResultContractInner withStatus(AsyncOperationStatus status) { + this.status = status; + return this; + } + + /** + * Get start time of an async operation. The date conforms to the following format: `yyyy-MM-ddTHH:mm:ssZ` as specified by the ISO 8601 standard. + * + * @return the started value + */ + public DateTime started() { + return this.started; + } + + /** + * Set start time of an async operation. The date conforms to the following format: `yyyy-MM-ddTHH:mm:ssZ` as specified by the ISO 8601 standard. + * + * @param started the started value to set + * @return the OperationResultContractInner object itself. + */ + public OperationResultContractInner withStarted(DateTime started) { + this.started = started; + return this; + } + + /** + * Get last update time of an async operation. The date conforms to the following format: `yyyy-MM-ddTHH:mm:ssZ` as specified by the ISO 8601 standard. + * + * @return the updated value + */ + public DateTime updated() { + return this.updated; + } + + /** + * Set last update time of an async operation. The date conforms to the following format: `yyyy-MM-ddTHH:mm:ssZ` as specified by the ISO 8601 standard. + * + * @param updated the updated value to set + * @return the OperationResultContractInner object itself. + */ + public OperationResultContractInner withUpdated(DateTime updated) { + this.updated = updated; + return this; + } + + /** + * Get optional result info. + * + * @return the resultInfo value + */ + public String resultInfo() { + return this.resultInfo; + } + + /** + * Set optional result info. + * + * @param resultInfo the resultInfo value to set + * @return the OperationResultContractInner object itself. + */ + public OperationResultContractInner withResultInfo(String resultInfo) { + this.resultInfo = resultInfo; + return this; + } + + /** + * Get error Body Contract. + * + * @return the error value + */ + public ErrorResponseBody error() { + return this.error; + } + + /** + * Set error Body Contract. + * + * @param error the error value to set + * @return the OperationResultContractInner object itself. + */ + public OperationResultContractInner withError(ErrorResponseBody error) { + this.error = error; + return this; + } + + /** + * Get this property if only provided as part of the TenantConfiguration_Validate operation. It contains the log the entities which will be updated/created/deleted as part of the TenantConfiguration_Deploy operation. + * + * @return the actionLog value + */ + public List actionLog() { + return this.actionLog; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/OperationsImpl.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/OperationsImpl.java new file mode 100644 index 0000000000000..0f43562a38d6f --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/OperationsImpl.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.apimanagement.v2019_01_01.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.apimanagement.v2019_01_01.Operations; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.apimanagement.v2019_01_01.TagResourceContract; + +class OperationsImpl extends WrapperImpl implements Operations { + private final ApiManagementManager manager; + + OperationsImpl(ApiManagementManager manager) { + super(manager.inner().operations()); + this.manager = manager; + } + + public ApiManagementManager manager() { + return this.manager; + } + + private TagResourceContractImpl wrapModel(TagResourceContractInner inner) { + return new TagResourceContractImpl(inner, manager()); + } + + @Override + public Observable listByTagsAsync(final String resourceGroupName, final String serviceName, final String apiId) { + OperationsInner client = this.inner(); + return client.listByTagsAsync(resourceGroupName, serviceName, apiId) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public TagResourceContract call(TagResourceContractInner inner) { + return wrapModel(inner); + } + }); + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/OperationsInner.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/OperationsInner.java new file mode 100644 index 0000000000000..28555c87d482d --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/OperationsInner.java @@ -0,0 +1,459 @@ +/** + * 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.apimanagement.v2019_01_01.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.CloudException; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Path; +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 ApiManagementClientImpl 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, ApiManagementClientImpl 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.apimanagement.v2019_01_01.Operations listByTags" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/operationsByTags") + Observable> listByTags(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("apiId") String apiId, @Path("subscriptionId") String subscriptionId, @Query("$filter") String filter, @Query("$top") Integer top, @Query("$skip") Integer skip, @Query("includeNotTaggedOperations") Boolean includeNotTaggedOperations, @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.apimanagement.v2019_01_01.Operations listByTagsNext" }) + @GET + Observable> listByTagsNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Lists a collection of operations associated with tags. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException 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<TagResourceContractInner> object if successful. + */ + public PagedList listByTags(final String resourceGroupName, final String serviceName, final String apiId) { + ServiceResponse> response = listByTagsSinglePageAsync(resourceGroupName, serviceName, apiId).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByTagsNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists a collection of operations associated with tags. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @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> listByTagsAsync(final String resourceGroupName, final String serviceName, final String apiId, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByTagsSinglePageAsync(resourceGroupName, serviceName, apiId), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByTagsNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists a collection of operations associated with tags. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<TagResourceContractInner> object + */ + public Observable> listByTagsAsync(final String resourceGroupName, final String serviceName, final String apiId) { + return listByTagsWithServiceResponseAsync(resourceGroupName, serviceName, apiId) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists a collection of operations associated with tags. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<TagResourceContractInner> object + */ + public Observable>> listByTagsWithServiceResponseAsync(final String resourceGroupName, final String serviceName, final String apiId) { + return listByTagsSinglePageAsync(resourceGroupName, serviceName, apiId) + .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(listByTagsNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists a collection of operations associated with tags. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<TagResourceContractInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByTagsSinglePageAsync(final String resourceGroupName, final String serviceName, final String apiId) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (apiId == null) { + throw new IllegalArgumentException("Parameter apiId is required and cannot be null."); + } + 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 filter = null; + final Integer top = null; + final Integer skip = null; + final Boolean includeNotTaggedOperations = null; + return service.listByTags(resourceGroupName, serviceName, apiId, this.client.subscriptionId(), filter, top, skip, includeNotTaggedOperations, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByTagsDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Lists a collection of operations associated with tags. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| apiName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| method | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| urlTemplate | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br> + * @param top Number of records to return. + * @param skip Number of records to skip. + * @param includeNotTaggedOperations Include not tagged Operations. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException 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<TagResourceContractInner> object if successful. + */ + public PagedList listByTags(final String resourceGroupName, final String serviceName, final String apiId, final String filter, final Integer top, final Integer skip, final Boolean includeNotTaggedOperations) { + ServiceResponse> response = listByTagsSinglePageAsync(resourceGroupName, serviceName, apiId, filter, top, skip, includeNotTaggedOperations).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByTagsNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists a collection of operations associated with tags. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| apiName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| method | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| urlTemplate | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br> + * @param top Number of records to return. + * @param skip Number of records to skip. + * @param includeNotTaggedOperations Include not tagged Operations. + * @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> listByTagsAsync(final String resourceGroupName, final String serviceName, final String apiId, final String filter, final Integer top, final Integer skip, final Boolean includeNotTaggedOperations, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByTagsSinglePageAsync(resourceGroupName, serviceName, apiId, filter, top, skip, includeNotTaggedOperations), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByTagsNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists a collection of operations associated with tags. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| apiName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| method | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| urlTemplate | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br> + * @param top Number of records to return. + * @param skip Number of records to skip. + * @param includeNotTaggedOperations Include not tagged Operations. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<TagResourceContractInner> object + */ + public Observable> listByTagsAsync(final String resourceGroupName, final String serviceName, final String apiId, final String filter, final Integer top, final Integer skip, final Boolean includeNotTaggedOperations) { + return listByTagsWithServiceResponseAsync(resourceGroupName, serviceName, apiId, filter, top, skip, includeNotTaggedOperations) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists a collection of operations associated with tags. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| apiName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| method | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| urlTemplate | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br> + * @param top Number of records to return. + * @param skip Number of records to skip. + * @param includeNotTaggedOperations Include not tagged Operations. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<TagResourceContractInner> object + */ + public Observable>> listByTagsWithServiceResponseAsync(final String resourceGroupName, final String serviceName, final String apiId, final String filter, final Integer top, final Integer skip, final Boolean includeNotTaggedOperations) { + return listByTagsSinglePageAsync(resourceGroupName, serviceName, apiId, filter, top, skip, includeNotTaggedOperations) + .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(listByTagsNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists a collection of operations associated with tags. + * + ServiceResponse> * @param resourceGroupName The name of the resource group. + ServiceResponse> * @param serviceName The name of the API Management service. + ServiceResponse> * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + ServiceResponse> * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| apiName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| method | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| urlTemplate | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br> + ServiceResponse> * @param top Number of records to return. + ServiceResponse> * @param skip Number of records to skip. + ServiceResponse> * @param includeNotTaggedOperations Include not tagged Operations. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<TagResourceContractInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByTagsSinglePageAsync(final String resourceGroupName, final String serviceName, final String apiId, final String filter, final Integer top, final Integer skip, final Boolean includeNotTaggedOperations) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (apiId == null) { + throw new IllegalArgumentException("Parameter apiId is required and cannot be null."); + } + 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.listByTags(resourceGroupName, serviceName, apiId, this.client.subscriptionId(), filter, top, skip, includeNotTaggedOperations, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByTagsDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByTagsDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Lists a collection of operations associated with tags. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException 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<TagResourceContractInner> object if successful. + */ + public PagedList listByTagsNext(final String nextPageLink) { + ServiceResponse> response = listByTagsNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByTagsNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists a collection of operations associated with tags. + * + * @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> listByTagsNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByTagsNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByTagsNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists a collection of operations associated with tags. + * + * @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<TagResourceContractInner> object + */ + public Observable> listByTagsNextAsync(final String nextPageLink) { + return listByTagsNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists a collection of operations associated with tags. + * + * @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<TagResourceContractInner> object + */ + public Observable>> listByTagsNextWithServiceResponseAsync(final String nextPageLink) { + return listByTagsNextSinglePageAsync(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(listByTagsNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists a collection of operations associated with tags. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<TagResourceContractInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByTagsNextSinglePageAsync(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.listByTagsNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByTagsNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByTagsNextDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/PageImpl.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/PageImpl.java new file mode 100644 index 0000000000000..3296ba6580d0d --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/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.apimanagement.v2019_01_01.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/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/PageImpl1.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/PageImpl1.java new file mode 100644 index 0000000000000..d61b21f653a70 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/PageImpl1.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.apimanagement.v2019_01_01.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 PageImpl1 implements Page { + /** + * The link to the next page. + */ + @JsonProperty("") + 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 PageImpl1 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 PageImpl1 setItems(List items) { + this.items = items; + return this; + } +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/PolicyCollectionImpl.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/PolicyCollectionImpl.java new file mode 100644 index 0000000000000..4f1d16651ae07 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/PolicyCollectionImpl.java @@ -0,0 +1,37 @@ +/** + * 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.apimanagement.v2019_01_01.implementation; + +import com.microsoft.azure.management.apimanagement.v2019_01_01.PolicyCollection; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import java.util.List; + +class PolicyCollectionImpl extends WrapperImpl implements PolicyCollection { + private final ApiManagementManager manager; + PolicyCollectionImpl(PolicyCollectionInner inner, ApiManagementManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public ApiManagementManager manager() { + return this.manager; + } + + @Override + public String nextLink() { + return this.inner().nextLink(); + } + + @Override + public List value() { + return this.inner().value(); + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/PolicyCollectionInner.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/PolicyCollectionInner.java new file mode 100644 index 0000000000000..2b8d1343fc18b --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/PolicyCollectionInner.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.apimanagement.v2019_01_01.implementation; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The response of the list policy operation. + */ +public class PolicyCollectionInner { + /** + * Policy Contract value. + */ + @JsonProperty(value = "value") + private List value; + + /** + * Next page link if any. + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** + * Get policy Contract value. + * + * @return the value value + */ + public List value() { + return this.value; + } + + /** + * Set policy Contract value. + * + * @param value the value value to set + * @return the PolicyCollectionInner object itself. + */ + public PolicyCollectionInner withValue(List value) { + this.value = value; + return this; + } + + /** + * Get next page link if any. + * + * @return the nextLink value + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set next page link if any. + * + * @param nextLink the nextLink value to set + * @return the PolicyCollectionInner object itself. + */ + public PolicyCollectionInner withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/PolicyContractImpl.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/PolicyContractImpl.java new file mode 100644 index 0000000000000..6bdda2f8ec737 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/PolicyContractImpl.java @@ -0,0 +1,133 @@ +/** + * 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.apimanagement.v2019_01_01.implementation; + +import com.microsoft.azure.management.apimanagement.v2019_01_01.PolicyContract; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import com.microsoft.azure.management.apimanagement.v2019_01_01.PolicyContentFormat; + +class PolicyContractImpl extends CreatableUpdatableImpl implements PolicyContract, PolicyContract.Definition, PolicyContract.Update { + private String resourceGroupName; + private String serviceName; + private String cifMatch; + private String uifMatch; + private final ApiManagementManager manager; + + PolicyContractImpl(String name, ApiManagementManager manager) { + super(name, new PolicyContractInner()); + this.manager = manager; + // Set resource name + this.serviceName = name; + // + } + + PolicyContractImpl(PolicyContractInner inner, ApiManagementManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.serviceName = inner.name(); + // set resource ancestor and positional variables + this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourceGroups"); + this.serviceName = IdParsingUtils.getValueFromIdByName(inner.id(), "service"); + // set other parameters for create and update + } + + @Override + public ApiManagementManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + PolicysInner client = this.manager().inner().policys(); + return client.createOrUpdateAsync(this.resourceGroupName, this.serviceName, this.inner(), this.cifMatch) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + PolicysInner client = this.manager().inner().policys(); + return client.createOrUpdateAsync(this.resourceGroupName, this.serviceName, this.inner(), this.uifMatch) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + PolicysInner client = this.manager().inner().policys(); + return null; // NOP getInnerAsync implementation as get is not supported + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + + @Override + public PolicyContentFormat format() { + return this.inner().format(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public String value() { + return this.inner().value(); + } + + @Override + public PolicyContractImpl withResourceGroupName(String resourceGroupName) { + this.resourceGroupName = resourceGroupName; + return this; + } + + @Override + public PolicyContractImpl withServiceName(String serviceName) { + this.serviceName = serviceName; + return this; + } + + @Override + public PolicyContractImpl withValue(String value) { + this.inner().withValue(value); + return this; + } + + @Override + public PolicyContractImpl withIfMatch(String ifMatch) { + if (isInCreateMode()) { + this.cifMatch = ifMatch; + } else { + this.uifMatch = ifMatch; + } + return this; + } + + @Override + public PolicyContractImpl withFormat(PolicyContentFormat format) { + this.inner().withFormat(format); + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/PolicyContractInner.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/PolicyContractInner.java new file mode 100644 index 0000000000000..e13f6d7dfc569 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/PolicyContractInner.java @@ -0,0 +1,74 @@ +/** + * 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.apimanagement.v2019_01_01.implementation; + +import com.microsoft.azure.management.apimanagement.v2019_01_01.PolicyContentFormat; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * Policy Contract details. + */ +@JsonFlatten +public class PolicyContractInner extends ProxyResource { + /** + * Contents of the Policy as defined by the format. + */ + @JsonProperty(value = "properties.value", required = true) + private String value; + + /** + * Format of the policyContent. Possible values include: 'xml', 'xml-link', + * 'rawxml', 'rawxml-link'. + */ + @JsonProperty(value = "properties.format") + private PolicyContentFormat format; + + /** + * Get contents of the Policy as defined by the format. + * + * @return the value value + */ + public String value() { + return this.value; + } + + /** + * Set contents of the Policy as defined by the format. + * + * @param value the value value to set + * @return the PolicyContractInner object itself. + */ + public PolicyContractInner withValue(String value) { + this.value = value; + return this; + } + + /** + * Get format of the policyContent. Possible values include: 'xml', 'xml-link', 'rawxml', 'rawxml-link'. + * + * @return the format value + */ + public PolicyContentFormat format() { + return this.format; + } + + /** + * Set format of the policyContent. Possible values include: 'xml', 'xml-link', 'rawxml', 'rawxml-link'. + * + * @param format the format value to set + * @return the PolicyContractInner object itself. + */ + public PolicyContractInner withFormat(PolicyContentFormat format) { + this.format = format; + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/PolicySnippetsCollectionImpl.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/PolicySnippetsCollectionImpl.java new file mode 100644 index 0000000000000..a3b872f415cf1 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/PolicySnippetsCollectionImpl.java @@ -0,0 +1,33 @@ +/** + * 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.apimanagement.v2019_01_01.implementation; + +import com.microsoft.azure.management.apimanagement.v2019_01_01.PolicySnippetsCollection; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import java.util.List; +import com.microsoft.azure.management.apimanagement.v2019_01_01.PolicySnippetContract; + +class PolicySnippetsCollectionImpl extends WrapperImpl implements PolicySnippetsCollection { + private final ApiManagementManager manager; + PolicySnippetsCollectionImpl(PolicySnippetsCollectionInner inner, ApiManagementManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public ApiManagementManager manager() { + return this.manager; + } + + @Override + public List value() { + return this.inner().value(); + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/PolicySnippetsCollectionInner.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/PolicySnippetsCollectionInner.java new file mode 100644 index 0000000000000..38c7f0aa46922 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/PolicySnippetsCollectionInner.java @@ -0,0 +1,45 @@ +/** + * 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.apimanagement.v2019_01_01.implementation; + +import java.util.List; +import com.microsoft.azure.management.apimanagement.v2019_01_01.PolicySnippetContract; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The response of the list policy snippets operation. + */ +public class PolicySnippetsCollectionInner { + /** + * Policy snippet value. + */ + @JsonProperty(value = "value") + private List value; + + /** + * Get policy snippet value. + * + * @return the value value + */ + public List value() { + return this.value; + } + + /** + * Set policy snippet value. + * + * @param value the value value to set + * @return the PolicySnippetsCollectionInner object itself. + */ + public PolicySnippetsCollectionInner withValue(List value) { + this.value = value; + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/PolicySnippetsImpl.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/PolicySnippetsImpl.java new file mode 100644 index 0000000000000..e7f75d9fdfd12 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/PolicySnippetsImpl.java @@ -0,0 +1,42 @@ +/** + * 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. + * abc + */ + +package com.microsoft.azure.management.apimanagement.v2019_01_01.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.apimanagement.v2019_01_01.PolicySnippets; +import rx.functions.Func1; +import rx.Observable; +import com.microsoft.azure.management.apimanagement.v2019_01_01.PolicySnippetsCollection; + +class PolicySnippetsImpl extends WrapperImpl implements PolicySnippets { + private final ApiManagementManager manager; + + PolicySnippetsImpl(ApiManagementManager manager) { + super(manager.inner().policySnippets()); + this.manager = manager; + } + + public ApiManagementManager manager() { + return this.manager; + } + + @Override + public Observable listByServiceAsync(String resourceGroupName, String serviceName) { + PolicySnippetsInner client = this.inner(); + return client.listByServiceAsync(resourceGroupName, serviceName) + .map(new Func1() { + @Override + public PolicySnippetsCollection call(PolicySnippetsCollectionInner inner) { + return new PolicySnippetsCollectionImpl(inner, manager()); + } + }); + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/PolicySnippetsInner.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/PolicySnippetsInner.java new file mode 100644 index 0000000000000..fbf9908dcc787 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/PolicySnippetsInner.java @@ -0,0 +1,231 @@ +/** + * 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.apimanagement.v2019_01_01.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.management.apimanagement.v2019_01_01.ErrorResponseException; +import com.microsoft.azure.management.apimanagement.v2019_01_01.PolicyScopeContract; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import java.io.IOException; +import okhttp3.ResponseBody; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Path; +import retrofit2.http.Query; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in PolicySnippets. + */ +public class PolicySnippetsInner { + /** The Retrofit service to perform REST calls. */ + private PolicySnippetsService service; + /** The service client containing this operation class. */ + private ApiManagementClientImpl client; + + /** + * Initializes an instance of PolicySnippetsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public PolicySnippetsInner(Retrofit retrofit, ApiManagementClientImpl client) { + this.service = retrofit.create(PolicySnippetsService.class); + this.client = client; + } + + /** + * The interface defining all the services for PolicySnippets to be + * used by Retrofit to perform actually REST calls. + */ + interface PolicySnippetsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.apimanagement.v2019_01_01.PolicySnippets listByService" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/policySnippets") + Observable> listByService(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("subscriptionId") String subscriptionId, @Query("scope") PolicyScopeContract scope, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Lists all policy snippets. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PolicySnippetsCollectionInner object if successful. + */ + public PolicySnippetsCollectionInner listByService(String resourceGroupName, String serviceName) { + return listByServiceWithServiceResponseAsync(resourceGroupName, serviceName).toBlocking().single().body(); + } + + /** + * Lists all policy snippets. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @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 listByServiceAsync(String resourceGroupName, String serviceName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(listByServiceWithServiceResponseAsync(resourceGroupName, serviceName), serviceCallback); + } + + /** + * Lists all policy snippets. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PolicySnippetsCollectionInner object + */ + public Observable listByServiceAsync(String resourceGroupName, String serviceName) { + return listByServiceWithServiceResponseAsync(resourceGroupName, serviceName).map(new Func1, PolicySnippetsCollectionInner>() { + @Override + public PolicySnippetsCollectionInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Lists all policy snippets. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PolicySnippetsCollectionInner object + */ + public Observable> listByServiceWithServiceResponseAsync(String resourceGroupName, String serviceName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + 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 PolicyScopeContract scope = null; + return service.listByService(resourceGroupName, serviceName, this.client.subscriptionId(), scope, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = listByServiceDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Lists all policy snippets. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param scope Policy scope. Possible values include: 'Tenant', 'Product', 'Api', 'Operation', 'All' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PolicySnippetsCollectionInner object if successful. + */ + public PolicySnippetsCollectionInner listByService(String resourceGroupName, String serviceName, PolicyScopeContract scope) { + return listByServiceWithServiceResponseAsync(resourceGroupName, serviceName, scope).toBlocking().single().body(); + } + + /** + * Lists all policy snippets. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param scope Policy scope. Possible values include: 'Tenant', 'Product', 'Api', 'Operation', 'All' + * @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 listByServiceAsync(String resourceGroupName, String serviceName, PolicyScopeContract scope, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(listByServiceWithServiceResponseAsync(resourceGroupName, serviceName, scope), serviceCallback); + } + + /** + * Lists all policy snippets. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param scope Policy scope. Possible values include: 'Tenant', 'Product', 'Api', 'Operation', 'All' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PolicySnippetsCollectionInner object + */ + public Observable listByServiceAsync(String resourceGroupName, String serviceName, PolicyScopeContract scope) { + return listByServiceWithServiceResponseAsync(resourceGroupName, serviceName, scope).map(new Func1, PolicySnippetsCollectionInner>() { + @Override + public PolicySnippetsCollectionInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Lists all policy snippets. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param scope Policy scope. Possible values include: 'Tenant', 'Product', 'Api', 'Operation', 'All' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PolicySnippetsCollectionInner object + */ + public Observable> listByServiceWithServiceResponseAsync(String resourceGroupName, String serviceName, PolicyScopeContract scope) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + 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.listByService(resourceGroupName, serviceName, this.client.subscriptionId(), scope, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = listByServiceDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse listByServiceDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/PolicysImpl.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/PolicysImpl.java new file mode 100644 index 0000000000000..2762762c34491 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/PolicysImpl.java @@ -0,0 +1,81 @@ +/** + * 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. + * jkl + */ + +package com.microsoft.azure.management.apimanagement.v2019_01_01.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.apimanagement.v2019_01_01.Policys; +import rx.Completable; +import rx.functions.Func1; +import rx.Observable; +import com.microsoft.azure.management.apimanagement.v2019_01_01.PolicyCollection; +import com.microsoft.azure.management.apimanagement.v2019_01_01.OperationApiPolicyContract; + +class PolicysImpl extends WrapperImpl implements Policys { + private final ApiManagementManager manager; + + PolicysImpl(ApiManagementManager manager) { + super(manager.inner().policys()); + this.manager = manager; + } + + public ApiManagementManager manager() { + return this.manager; + } + + @Override + public PolicyContractImpl define(String name) { + return wrapModel(name); + } + + private PolicyContractImpl wrapModel(PolicyContractInner inner) { + return new PolicyContractImpl(inner, manager()); + } + + private PolicyContractImpl wrapModel(String name) { + return new PolicyContractImpl(name, this.manager()); + } + + @Override + public Observable listByServiceAsync(String resourceGroupName, String serviceName) { + PolicysInner client = this.inner(); + return client.listByServiceAsync(resourceGroupName, serviceName) + .map(new Func1() { + @Override + public PolicyCollection call(PolicyCollectionInner inner) { + return new PolicyCollectionImpl(inner, manager()); + } + }); + } + + @Override + public Completable getEntityTagAsync(String resourceGroupName, String serviceName) { + PolicysInner client = this.inner(); + return client.getEntityTagAsync(resourceGroupName, serviceName).toCompletable(); + } + + @Override + public Observable getAsync(String resourceGroupName, String serviceName) { + PolicysInner client = this.inner(); + return client.getAsync(resourceGroupName, serviceName) + .map(new Func1() { + @Override + public OperationApiPolicyContract call(PolicyContractInner inner) { + return new OperationApiPolicyContractImpl(inner, manager()); + } + }); + } + + @Override + public Completable deleteAsync(String resourceGroupName, String serviceName, String ifMatch) { + PolicysInner client = this.inner(); + return client.deleteAsync(resourceGroupName, serviceName, ifMatch).toCompletable(); + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/PolicysInner.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/PolicysInner.java new file mode 100644 index 0000000000000..ef578652f1bbe --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/PolicysInner.java @@ -0,0 +1,713 @@ +/** + * 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.apimanagement.v2019_01_01.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.management.apimanagement.v2019_01_01.ErrorResponseException; +import com.microsoft.azure.management.apimanagement.v2019_01_01.PolicyCreateOrUpdateHeaders; +import com.microsoft.azure.management.apimanagement.v2019_01_01.PolicyExportFormat; +import com.microsoft.azure.management.apimanagement.v2019_01_01.PolicyGetEntityTagHeaders; +import com.microsoft.azure.management.apimanagement.v2019_01_01.PolicyGetHeaders; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import com.microsoft.rest.ServiceResponseWithHeaders; +import com.microsoft.rest.Validator; +import java.io.IOException; +import okhttp3.ResponseBody; +import retrofit2.http.Body; +import retrofit2.http.GET; +import retrofit2.http.HEAD; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.HTTP; +import retrofit2.http.Path; +import retrofit2.http.PUT; +import retrofit2.http.Query; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in Policys. + */ +public class PolicysInner { + /** The Retrofit service to perform REST calls. */ + private PolicysService service; + /** The service client containing this operation class. */ + private ApiManagementClientImpl client; + + /** + * Initializes an instance of PolicysInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public PolicysInner(Retrofit retrofit, ApiManagementClientImpl client) { + this.service = retrofit.create(PolicysService.class); + this.client = client; + } + + /** + * The interface defining all the services for Policys to be + * used by Retrofit to perform actually REST calls. + */ + interface PolicysService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.apimanagement.v2019_01_01.Policys listByService" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/policies") + Observable> listByService(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("subscriptionId") String subscriptionId, @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.apimanagement.v2019_01_01.Policys getEntityTag" }) + @HEAD("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/policies/{policyId}") + Observable> getEntityTag(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("policyId") String policyId, @Path("subscriptionId") String subscriptionId, @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.apimanagement.v2019_01_01.Policys get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/policies/{policyId}") + Observable> get(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("policyId") String policyId, @Path("subscriptionId") String subscriptionId, @Query("format") PolicyExportFormat format, @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.apimanagement.v2019_01_01.Policys createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/policies/{policyId}") + Observable> createOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("policyId") String policyId, @Path("subscriptionId") String subscriptionId, @Body PolicyContractInner parameters, @Header("If-Match") String ifMatch, @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.apimanagement.v2019_01_01.Policys delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/policies/{policyId}", method = "DELETE", hasBody = true) + Observable> delete(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("policyId") String policyId, @Path("subscriptionId") String subscriptionId, @Header("If-Match") String ifMatch, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Lists all the Global Policy definitions of the Api Management service. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PolicyCollectionInner object if successful. + */ + public PolicyCollectionInner listByService(String resourceGroupName, String serviceName) { + return listByServiceWithServiceResponseAsync(resourceGroupName, serviceName).toBlocking().single().body(); + } + + /** + * Lists all the Global Policy definitions of the Api Management service. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @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 listByServiceAsync(String resourceGroupName, String serviceName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(listByServiceWithServiceResponseAsync(resourceGroupName, serviceName), serviceCallback); + } + + /** + * Lists all the Global Policy definitions of the Api Management service. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PolicyCollectionInner object + */ + public Observable listByServiceAsync(String resourceGroupName, String serviceName) { + return listByServiceWithServiceResponseAsync(resourceGroupName, serviceName).map(new Func1, PolicyCollectionInner>() { + @Override + public PolicyCollectionInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Lists all the Global Policy definitions of the Api Management service. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PolicyCollectionInner object + */ + public Observable> listByServiceWithServiceResponseAsync(String resourceGroupName, String serviceName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + 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.listByService(resourceGroupName, serviceName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = listByServiceDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse listByServiceDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Gets the entity state (Etag) version of the Global policy definition in the Api Management service. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void getEntityTag(String resourceGroupName, String serviceName) { + getEntityTagWithServiceResponseAsync(resourceGroupName, serviceName).toBlocking().single().body(); + } + + /** + * Gets the entity state (Etag) version of the Global policy definition in the Api Management service. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @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 getEntityTagAsync(String resourceGroupName, String serviceName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(getEntityTagWithServiceResponseAsync(resourceGroupName, serviceName), serviceCallback); + } + + /** + * Gets the entity state (Etag) version of the Global policy definition in the Api Management service. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public Observable getEntityTagAsync(String resourceGroupName, String serviceName) { + return getEntityTagWithServiceResponseAsync(resourceGroupName, serviceName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Gets the entity state (Etag) version of the Global policy definition in the Api Management service. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public Observable> getEntityTagWithServiceResponseAsync(String resourceGroupName, String serviceName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + 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 policyId = "policy"; + return service.getEntityTag(resourceGroupName, serviceName, policyId, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = getEntityTagDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponseWithHeaders getEntityTagDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .buildEmptyWithHeaders(response, PolicyGetEntityTagHeaders.class); + } + + /** + * Get the Global policy definition of the Api Management service. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PolicyContractInner object if successful. + */ + public PolicyContractInner get(String resourceGroupName, String serviceName) { + return getWithServiceResponseAsync(resourceGroupName, serviceName).toBlocking().single().body(); + } + + /** + * Get the Global policy definition of the Api Management service. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @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 getAsync(String resourceGroupName, String serviceName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(getWithServiceResponseAsync(resourceGroupName, serviceName), serviceCallback); + } + + /** + * Get the Global policy definition of the Api Management service. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PolicyContractInner object + */ + public Observable getAsync(String resourceGroupName, String serviceName) { + return getWithServiceResponseAsync(resourceGroupName, serviceName).map(new Func1, PolicyContractInner>() { + @Override + public PolicyContractInner call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Get the Global policy definition of the Api Management service. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PolicyContractInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String serviceName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + 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 policyId = "policy"; + final PolicyExportFormat format = null; + return service.get(resourceGroupName, serviceName, policyId, this.client.subscriptionId(), format, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = getDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Get the Global policy definition of the Api Management service. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param format Policy Export Format. Possible values include: 'xml', 'rawxml' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PolicyContractInner object if successful. + */ + public PolicyContractInner get(String resourceGroupName, String serviceName, PolicyExportFormat format) { + return getWithServiceResponseAsync(resourceGroupName, serviceName, format).toBlocking().single().body(); + } + + /** + * Get the Global policy definition of the Api Management service. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param format Policy Export Format. Possible values include: 'xml', 'rawxml' + * @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 getAsync(String resourceGroupName, String serviceName, PolicyExportFormat format, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(getWithServiceResponseAsync(resourceGroupName, serviceName, format), serviceCallback); + } + + /** + * Get the Global policy definition of the Api Management service. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param format Policy Export Format. Possible values include: 'xml', 'rawxml' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PolicyContractInner object + */ + public Observable getAsync(String resourceGroupName, String serviceName, PolicyExportFormat format) { + return getWithServiceResponseAsync(resourceGroupName, serviceName, format).map(new Func1, PolicyContractInner>() { + @Override + public PolicyContractInner call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Get the Global policy definition of the Api Management service. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param format Policy Export Format. Possible values include: 'xml', 'rawxml' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PolicyContractInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String serviceName, PolicyExportFormat format) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + 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 policyId = "policy"; + return service.get(resourceGroupName, serviceName, policyId, this.client.subscriptionId(), format, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = getDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponseWithHeaders getDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .buildWithHeaders(response, PolicyGetHeaders.class); + } + + /** + * Creates or updates the global policy configuration of the Api Management service. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param parameters The policy contents to apply. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PolicyContractInner object if successful. + */ + public PolicyContractInner createOrUpdate(String resourceGroupName, String serviceName, PolicyContractInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serviceName, parameters).toBlocking().single().body(); + } + + /** + * Creates or updates the global policy configuration of the Api Management service. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param parameters The policy contents to apply. + * @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 createOrUpdateAsync(String resourceGroupName, String serviceName, PolicyContractInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, serviceName, parameters), serviceCallback); + } + + /** + * Creates or updates the global policy configuration of the Api Management service. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param parameters The policy contents to apply. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PolicyContractInner object + */ + public Observable createOrUpdateAsync(String resourceGroupName, String serviceName, PolicyContractInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serviceName, parameters).map(new Func1, PolicyContractInner>() { + @Override + public PolicyContractInner call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Creates or updates the global policy configuration of the Api Management service. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param parameters The policy contents to apply. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PolicyContractInner object + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String serviceName, PolicyContractInner parameters) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(parameters); + final String policyId = "policy"; + final String ifMatch = null; + return service.createOrUpdate(resourceGroupName, serviceName, policyId, this.client.subscriptionId(), parameters, ifMatch, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = createOrUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Creates or updates the global policy configuration of the Api Management service. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param parameters The policy contents to apply. + * @param ifMatch ETag of the Entity. Not required when creating an entity, but required when updating an entity. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PolicyContractInner object if successful. + */ + public PolicyContractInner createOrUpdate(String resourceGroupName, String serviceName, PolicyContractInner parameters, String ifMatch) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serviceName, parameters, ifMatch).toBlocking().single().body(); + } + + /** + * Creates or updates the global policy configuration of the Api Management service. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param parameters The policy contents to apply. + * @param ifMatch ETag of the Entity. Not required when creating an entity, but required when updating an entity. + * @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 createOrUpdateAsync(String resourceGroupName, String serviceName, PolicyContractInner parameters, String ifMatch, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, serviceName, parameters, ifMatch), serviceCallback); + } + + /** + * Creates or updates the global policy configuration of the Api Management service. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param parameters The policy contents to apply. + * @param ifMatch ETag of the Entity. Not required when creating an entity, but required when updating an entity. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PolicyContractInner object + */ + public Observable createOrUpdateAsync(String resourceGroupName, String serviceName, PolicyContractInner parameters, String ifMatch) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serviceName, parameters, ifMatch).map(new Func1, PolicyContractInner>() { + @Override + public PolicyContractInner call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Creates or updates the global policy configuration of the Api Management service. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param parameters The policy contents to apply. + * @param ifMatch ETag of the Entity. Not required when creating an entity, but required when updating an entity. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PolicyContractInner object + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String serviceName, PolicyContractInner parameters, String ifMatch) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(parameters); + final String policyId = "policy"; + return service.createOrUpdate(resourceGroupName, serviceName, policyId, this.client.subscriptionId(), parameters, ifMatch, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = createOrUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponseWithHeaders createOrUpdateDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(201, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .buildWithHeaders(response, PolicyCreateOrUpdateHeaders.class); + } + + /** + * Deletes the global policy configuration of the Api Management Service. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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 serviceName, String ifMatch) { + deleteWithServiceResponseAsync(resourceGroupName, serviceName, ifMatch).toBlocking().single().body(); + } + + /** + * Deletes the global policy configuration of the Api Management Service. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @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 serviceName, String ifMatch, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, serviceName, ifMatch), serviceCallback); + } + + /** + * Deletes the global policy configuration of the Api Management Service. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable deleteAsync(String resourceGroupName, String serviceName, String ifMatch) { + return deleteWithServiceResponseAsync(resourceGroupName, serviceName, ifMatch).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes the global policy configuration of the Api Management Service. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> deleteWithServiceResponseAsync(String resourceGroupName, String serviceName, String ifMatch) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (ifMatch == null) { + throw new IllegalArgumentException("Parameter ifMatch 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 policyId = "policy"; + return service.delete(resourceGroupName, serviceName, policyId, this.client.subscriptionId(), ifMatch, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = deleteDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse deleteDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(204, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/PortalDelegationSettingsImpl.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/PortalDelegationSettingsImpl.java new file mode 100644 index 0000000000000..25a3daa731a90 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/PortalDelegationSettingsImpl.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.apimanagement.v2019_01_01.implementation; + +import com.microsoft.azure.management.apimanagement.v2019_01_01.PortalDelegationSettings; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.apimanagement.v2019_01_01.SubscriptionsDelegationSettingsProperties; +import com.microsoft.azure.management.apimanagement.v2019_01_01.RegistrationDelegationSettingsProperties; + +class PortalDelegationSettingsImpl extends WrapperImpl implements PortalDelegationSettings { + private final ApiManagementManager manager; + PortalDelegationSettingsImpl(PortalDelegationSettingsInner inner, ApiManagementManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public ApiManagementManager manager() { + return this.manager; + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public SubscriptionsDelegationSettingsProperties subscriptions() { + return this.inner().subscriptions(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public String url() { + return this.inner().url(); + } + + @Override + public RegistrationDelegationSettingsProperties userRegistration() { + return this.inner().userRegistration(); + } + + @Override + public String validationKey() { + return this.inner().validationKey(); + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/PortalDelegationSettingsInner.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/PortalDelegationSettingsInner.java new file mode 100644 index 0000000000000..0f60f840ba85a --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/PortalDelegationSettingsInner.java @@ -0,0 +1,127 @@ +/** + * 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.apimanagement.v2019_01_01.implementation; + +import com.microsoft.azure.management.apimanagement.v2019_01_01.SubscriptionsDelegationSettingsProperties; +import com.microsoft.azure.management.apimanagement.v2019_01_01.RegistrationDelegationSettingsProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * Delegation settings for a developer portal. + */ +@JsonFlatten +public class PortalDelegationSettingsInner extends ProxyResource { + /** + * A delegation Url. + */ + @JsonProperty(value = "properties.url") + private String url; + + /** + * A base64-encoded validation key to validate, that a request is coming + * from Azure API Management. + */ + @JsonProperty(value = "properties.validationKey") + private String validationKey; + + /** + * Subscriptions delegation settings. + */ + @JsonProperty(value = "properties.subscriptions") + private SubscriptionsDelegationSettingsProperties subscriptions; + + /** + * User registration delegation settings. + */ + @JsonProperty(value = "properties.userRegistration") + private RegistrationDelegationSettingsProperties userRegistration; + + /** + * Get a delegation Url. + * + * @return the url value + */ + public String url() { + return this.url; + } + + /** + * Set a delegation Url. + * + * @param url the url value to set + * @return the PortalDelegationSettingsInner object itself. + */ + public PortalDelegationSettingsInner withUrl(String url) { + this.url = url; + return this; + } + + /** + * Get a base64-encoded validation key to validate, that a request is coming from Azure API Management. + * + * @return the validationKey value + */ + public String validationKey() { + return this.validationKey; + } + + /** + * Set a base64-encoded validation key to validate, that a request is coming from Azure API Management. + * + * @param validationKey the validationKey value to set + * @return the PortalDelegationSettingsInner object itself. + */ + public PortalDelegationSettingsInner withValidationKey(String validationKey) { + this.validationKey = validationKey; + return this; + } + + /** + * Get subscriptions delegation settings. + * + * @return the subscriptions value + */ + public SubscriptionsDelegationSettingsProperties subscriptions() { + return this.subscriptions; + } + + /** + * Set subscriptions delegation settings. + * + * @param subscriptions the subscriptions value to set + * @return the PortalDelegationSettingsInner object itself. + */ + public PortalDelegationSettingsInner withSubscriptions(SubscriptionsDelegationSettingsProperties subscriptions) { + this.subscriptions = subscriptions; + return this; + } + + /** + * Get user registration delegation settings. + * + * @return the userRegistration value + */ + public RegistrationDelegationSettingsProperties userRegistration() { + return this.userRegistration; + } + + /** + * Set user registration delegation settings. + * + * @param userRegistration the userRegistration value to set + * @return the PortalDelegationSettingsInner object itself. + */ + public PortalDelegationSettingsInner withUserRegistration(RegistrationDelegationSettingsProperties userRegistration) { + this.userRegistration = userRegistration; + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/PortalSigninSettingsImpl.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/PortalSigninSettingsImpl.java new file mode 100644 index 0000000000000..6870eb4409f14 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/PortalSigninSettingsImpl.java @@ -0,0 +1,46 @@ +/** + * 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.apimanagement.v2019_01_01.implementation; + +import com.microsoft.azure.management.apimanagement.v2019_01_01.PortalSigninSettings; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; + +class PortalSigninSettingsImpl extends WrapperImpl implements PortalSigninSettings { + private final ApiManagementManager manager; + PortalSigninSettingsImpl(PortalSigninSettingsInner inner, ApiManagementManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public ApiManagementManager manager() { + return this.manager; + } + + @Override + public Boolean enabled() { + return this.inner().enabled(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public String type() { + return this.inner().type(); + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/PortalSigninSettingsInner.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/PortalSigninSettingsInner.java new file mode 100644 index 0000000000000..5935f3f3cbd91 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/PortalSigninSettingsInner.java @@ -0,0 +1,46 @@ +/** + * 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.apimanagement.v2019_01_01.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * Sign-In settings for the Developer Portal. + */ +@JsonFlatten +public class PortalSigninSettingsInner extends ProxyResource { + /** + * Redirect Anonymous users to the Sign-In page. + */ + @JsonProperty(value = "properties.enabled") + private Boolean enabled; + + /** + * Get redirect Anonymous users to the Sign-In page. + * + * @return the enabled value + */ + public Boolean enabled() { + return this.enabled; + } + + /** + * Set redirect Anonymous users to the Sign-In page. + * + * @param enabled the enabled value to set + * @return the PortalSigninSettingsInner object itself. + */ + public PortalSigninSettingsInner withEnabled(Boolean enabled) { + this.enabled = enabled; + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/PortalSignupSettingsImpl.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/PortalSignupSettingsImpl.java new file mode 100644 index 0000000000000..a868a59a3f779 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/PortalSignupSettingsImpl.java @@ -0,0 +1,52 @@ +/** + * 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.apimanagement.v2019_01_01.implementation; + +import com.microsoft.azure.management.apimanagement.v2019_01_01.PortalSignupSettings; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.apimanagement.v2019_01_01.TermsOfServiceProperties; + +class PortalSignupSettingsImpl extends WrapperImpl implements PortalSignupSettings { + private final ApiManagementManager manager; + PortalSignupSettingsImpl(PortalSignupSettingsInner inner, ApiManagementManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public ApiManagementManager manager() { + return this.manager; + } + + @Override + public Boolean enabled() { + return this.inner().enabled(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public TermsOfServiceProperties termsOfService() { + return this.inner().termsOfService(); + } + + @Override + public String type() { + return this.inner().type(); + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/PortalSignupSettingsInner.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/PortalSignupSettingsInner.java new file mode 100644 index 0000000000000..da7b83aad2089 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/PortalSignupSettingsInner.java @@ -0,0 +1,73 @@ +/** + * 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.apimanagement.v2019_01_01.implementation; + +import com.microsoft.azure.management.apimanagement.v2019_01_01.TermsOfServiceProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * Sign-Up settings for a developer portal. + */ +@JsonFlatten +public class PortalSignupSettingsInner extends ProxyResource { + /** + * Allow users to sign up on a developer portal. + */ + @JsonProperty(value = "properties.enabled") + private Boolean enabled; + + /** + * Terms of service contract properties. + */ + @JsonProperty(value = "properties.termsOfService") + private TermsOfServiceProperties termsOfService; + + /** + * Get allow users to sign up on a developer portal. + * + * @return the enabled value + */ + public Boolean enabled() { + return this.enabled; + } + + /** + * Set allow users to sign up on a developer portal. + * + * @param enabled the enabled value to set + * @return the PortalSignupSettingsInner object itself. + */ + public PortalSignupSettingsInner withEnabled(Boolean enabled) { + this.enabled = enabled; + return this; + } + + /** + * Get terms of service contract properties. + * + * @return the termsOfService value + */ + public TermsOfServiceProperties termsOfService() { + return this.termsOfService; + } + + /** + * Set terms of service contract properties. + * + * @param termsOfService the termsOfService value to set + * @return the PortalSignupSettingsInner object itself. + */ + public PortalSignupSettingsInner withTermsOfService(TermsOfServiceProperties termsOfService) { + this.termsOfService = termsOfService; + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ProductApiContractImpl.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ProductApiContractImpl.java new file mode 100644 index 0000000000000..46b0ddd66a70c --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ProductApiContractImpl.java @@ -0,0 +1,193 @@ +/** + * 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.apimanagement.v2019_01_01.implementation; + +import com.microsoft.azure.management.apimanagement.v2019_01_01.ProductApiContract; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import com.microsoft.azure.management.apimanagement.v2019_01_01.ApiType; +import com.microsoft.azure.management.apimanagement.v2019_01_01.ApiVersionSetContractDetails; +import com.microsoft.azure.management.apimanagement.v2019_01_01.AuthenticationSettingsContract; +import java.util.List; +import com.microsoft.azure.management.apimanagement.v2019_01_01.Protocol; +import com.microsoft.azure.management.apimanagement.v2019_01_01.SubscriptionKeyParameterNamesContract; + +class ProductApiContractImpl extends CreatableUpdatableImpl implements ProductApiContract, ProductApiContract.Definition, ProductApiContract.Update { + private final ApiManagementManager manager; + private String resourceGroupName; + private String serviceName; + private String productId; + private String apiId; + + ProductApiContractImpl(String name, ApiManagementManager manager) { + super(name, new ApiContractInner()); + this.manager = manager; + // Set resource name + this.apiId = name; + // + } + + ProductApiContractImpl(ApiContractInner inner, ApiManagementManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.apiId = inner.name(); + // set resource ancestor and positional variables + this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourceGroups"); + this.serviceName = IdParsingUtils.getValueFromIdByName(inner.id(), "service"); + this.productId = IdParsingUtils.getValueFromIdByName(inner.id(), "products"); + this.apiId = IdParsingUtils.getValueFromIdByName(inner.id(), "apis"); + // + } + + @Override + public ApiManagementManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + ProductApisInner client = this.manager().inner().productApis(); + return client.createOrUpdateAsync(this.resourceGroupName, this.serviceName, this.productId, this.apiId) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + ProductApisInner client = this.manager().inner().productApis(); + return client.createOrUpdateAsync(this.resourceGroupName, this.serviceName, this.productId, this.apiId) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + ProductApisInner client = this.manager().inner().productApis(); + return null; // NOP getInnerAsync implementation as get is not supported + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + + @Override + public String apiRevision() { + return this.inner().apiRevision(); + } + + @Override + public String apiRevisionDescription() { + return this.inner().apiRevisionDescription(); + } + + @Override + public ApiType apiType() { + return this.inner().apiType(); + } + + @Override + public String apiVersion() { + return this.inner().apiVersion(); + } + + @Override + public String apiVersionDescription() { + return this.inner().apiVersionDescription(); + } + + @Override + public ApiVersionSetContractDetails apiVersionSet() { + return this.inner().apiVersionSet(); + } + + @Override + public String apiVersionSetId() { + return this.inner().apiVersionSetId(); + } + + @Override + public AuthenticationSettingsContract authenticationSettings() { + return this.inner().authenticationSettings(); + } + + @Override + public String description() { + return this.inner().description(); + } + + @Override + public String displayName() { + return this.inner().displayName(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public Boolean isCurrent() { + return this.inner().isCurrent(); + } + + @Override + public Boolean isOnline() { + return this.inner().isOnline(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public String path() { + return this.inner().path(); + } + + @Override + public List protocols() { + return this.inner().protocols(); + } + + @Override + public String serviceUrl() { + return this.inner().serviceUrl(); + } + + @Override + public String sourceApiId() { + return this.inner().sourceApiId(); + } + + @Override + public SubscriptionKeyParameterNamesContract subscriptionKeyParameterNames() { + return this.inner().subscriptionKeyParameterNames(); + } + + @Override + public Boolean subscriptionRequired() { + return this.inner().subscriptionRequired(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public ProductApiContractImpl withExistingProduct(String resourceGroupName, String serviceName, String productId) { + this.resourceGroupName = resourceGroupName; + this.serviceName = serviceName; + this.productId = productId; + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ProductApisImpl.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ProductApisImpl.java new file mode 100644 index 0000000000000..302f1c8524455 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ProductApisImpl.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.apimanagement.v2019_01_01.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.apimanagement.v2019_01_01.ProductApis; +import rx.Completable; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.apimanagement.v2019_01_01.ProductApiContract; + +class ProductApisImpl extends WrapperImpl implements ProductApis { + private final ApiManagementManager manager; + + ProductApisImpl(ApiManagementManager manager) { + super(manager.inner().productApis()); + this.manager = manager; + } + + public ApiManagementManager manager() { + return this.manager; + } + + @Override + public ProductApiContractImpl define(String name) { + return wrapModel(name); + } + + private ProductApiContractImpl wrapModel(ApiContractInner inner) { + return new ProductApiContractImpl(inner, manager()); + } + + private ProductApiContractImpl wrapModel(String name) { + return new ProductApiContractImpl(name, this.manager()); + } + + @Override + public Completable checkEntityExistsAsync(String resourceGroupName, String serviceName, String productId, String apiId) { + ProductApisInner client = this.inner(); + return client.checkEntityExistsAsync(resourceGroupName, serviceName, productId, apiId).toCompletable(); + } + + @Override + public Observable listByProductAsync(final String resourceGroupName, final String serviceName, final String productId) { + ProductApisInner client = this.inner(); + return client.listByProductAsync(resourceGroupName, serviceName, productId) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public ProductApiContract call(ApiContractInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Completable deleteAsync(String resourceGroupName, String serviceName, String productId, String apiId) { + ProductApisInner client = this.inner(); + return client.deleteAsync(resourceGroupName, serviceName, productId, apiId).toCompletable(); + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ProductApisInner.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ProductApisInner.java new file mode 100644 index 0000000000000..36b9615eb324a --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ProductApisInner.java @@ -0,0 +1,769 @@ +/** + * 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.apimanagement.v2019_01_01.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.apimanagement.v2019_01_01.ErrorResponseException; +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.GET; +import retrofit2.http.HEAD; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.HTTP; +import retrofit2.http.Path; +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 ProductApis. + */ +public class ProductApisInner { + /** The Retrofit service to perform REST calls. */ + private ProductApisService service; + /** The service client containing this operation class. */ + private ApiManagementClientImpl client; + + /** + * Initializes an instance of ProductApisInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public ProductApisInner(Retrofit retrofit, ApiManagementClientImpl client) { + this.service = retrofit.create(ProductApisService.class); + this.client = client; + } + + /** + * The interface defining all the services for ProductApis to be + * used by Retrofit to perform actually REST calls. + */ + interface ProductApisService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.apimanagement.v2019_01_01.ProductApis listByProduct" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/apis") + Observable> listByProduct(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("productId") String productId, @Path("subscriptionId") String subscriptionId, @Query("$filter") String filter, @Query("$top") Integer top, @Query("$skip") Integer skip, @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.apimanagement.v2019_01_01.ProductApis checkEntityExists" }) + @HEAD("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/apis/{apiId}") + Observable> checkEntityExists(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("productId") String productId, @Path("apiId") String apiId, @Path("subscriptionId") String subscriptionId, @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.apimanagement.v2019_01_01.ProductApis createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/apis/{apiId}") + Observable> createOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("productId") String productId, @Path("apiId") String apiId, @Path("subscriptionId") String subscriptionId, @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.apimanagement.v2019_01_01.ProductApis delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/apis/{apiId}", method = "DELETE", hasBody = true) + Observable> delete(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("productId") String productId, @Path("apiId") String apiId, @Path("subscriptionId") String subscriptionId, @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.apimanagement.v2019_01_01.ProductApis listByProductNext" }) + @GET + Observable> listByProductNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Lists a collection of the APIs associated with a product. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param productId Product identifier. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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<ApiContractInner> object if successful. + */ + public PagedList listByProduct(final String resourceGroupName, final String serviceName, final String productId) { + ServiceResponse> response = listByProductSinglePageAsync(resourceGroupName, serviceName, productId).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByProductNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists a collection of the APIs associated with a product. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param productId Product identifier. Must be unique in the current API Management service instance. + * @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> listByProductAsync(final String resourceGroupName, final String serviceName, final String productId, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByProductSinglePageAsync(resourceGroupName, serviceName, productId), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByProductNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists a collection of the APIs associated with a product. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param productId Product identifier. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ApiContractInner> object + */ + public Observable> listByProductAsync(final String resourceGroupName, final String serviceName, final String productId) { + return listByProductWithServiceResponseAsync(resourceGroupName, serviceName, productId) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists a collection of the APIs associated with a product. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param productId Product identifier. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ApiContractInner> object + */ + public Observable>> listByProductWithServiceResponseAsync(final String resourceGroupName, final String serviceName, final String productId) { + return listByProductSinglePageAsync(resourceGroupName, serviceName, productId) + .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(listByProductNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists a collection of the APIs associated with a product. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param productId Product identifier. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ApiContractInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByProductSinglePageAsync(final String resourceGroupName, final String serviceName, final String productId) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (productId == null) { + throw new IllegalArgumentException("Parameter productId is required and cannot be null."); + } + 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 filter = null; + final Integer top = null; + final Integer skip = null; + return service.listByProduct(resourceGroupName, serviceName, productId, this.client.subscriptionId(), filter, top, skip, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByProductDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Lists a collection of the APIs associated with a product. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param productId Product identifier. Must be unique in the current API Management service instance. + * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| serviceUrl | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| path | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br> + * @param top Number of records to return. + * @param skip Number of records to skip. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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<ApiContractInner> object if successful. + */ + public PagedList listByProduct(final String resourceGroupName, final String serviceName, final String productId, final String filter, final Integer top, final Integer skip) { + ServiceResponse> response = listByProductSinglePageAsync(resourceGroupName, serviceName, productId, filter, top, skip).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByProductNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists a collection of the APIs associated with a product. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param productId Product identifier. Must be unique in the current API Management service instance. + * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| serviceUrl | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| path | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br> + * @param top Number of records to return. + * @param skip Number of records to skip. + * @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> listByProductAsync(final String resourceGroupName, final String serviceName, final String productId, final String filter, final Integer top, final Integer skip, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByProductSinglePageAsync(resourceGroupName, serviceName, productId, filter, top, skip), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByProductNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists a collection of the APIs associated with a product. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param productId Product identifier. Must be unique in the current API Management service instance. + * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| serviceUrl | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| path | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br> + * @param top Number of records to return. + * @param skip Number of records to skip. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ApiContractInner> object + */ + public Observable> listByProductAsync(final String resourceGroupName, final String serviceName, final String productId, final String filter, final Integer top, final Integer skip) { + return listByProductWithServiceResponseAsync(resourceGroupName, serviceName, productId, filter, top, skip) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists a collection of the APIs associated with a product. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param productId Product identifier. Must be unique in the current API Management service instance. + * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| serviceUrl | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| path | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br> + * @param top Number of records to return. + * @param skip Number of records to skip. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ApiContractInner> object + */ + public Observable>> listByProductWithServiceResponseAsync(final String resourceGroupName, final String serviceName, final String productId, final String filter, final Integer top, final Integer skip) { + return listByProductSinglePageAsync(resourceGroupName, serviceName, productId, filter, top, skip) + .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(listByProductNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists a collection of the APIs associated with a product. + * + ServiceResponse> * @param resourceGroupName The name of the resource group. + ServiceResponse> * @param serviceName The name of the API Management service. + ServiceResponse> * @param productId Product identifier. Must be unique in the current API Management service instance. + ServiceResponse> * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| serviceUrl | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| path | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br> + ServiceResponse> * @param top Number of records to return. + ServiceResponse> * @param skip Number of records to skip. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ApiContractInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByProductSinglePageAsync(final String resourceGroupName, final String serviceName, final String productId, final String filter, final Integer top, final Integer skip) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (productId == null) { + throw new IllegalArgumentException("Parameter productId is required and cannot be null."); + } + 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.listByProduct(resourceGroupName, serviceName, productId, this.client.subscriptionId(), filter, top, skip, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByProductDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByProductDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Checks that API entity specified by identifier is associated with the Product entity. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param productId Product identifier. Must be unique in the current API Management service instance. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void checkEntityExists(String resourceGroupName, String serviceName, String productId, String apiId) { + checkEntityExistsWithServiceResponseAsync(resourceGroupName, serviceName, productId, apiId).toBlocking().single().body(); + } + + /** + * Checks that API entity specified by identifier is associated with the Product entity. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param productId Product identifier. Must be unique in the current API Management service instance. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @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 checkEntityExistsAsync(String resourceGroupName, String serviceName, String productId, String apiId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(checkEntityExistsWithServiceResponseAsync(resourceGroupName, serviceName, productId, apiId), serviceCallback); + } + + /** + * Checks that API entity specified by identifier is associated with the Product entity. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param productId Product identifier. Must be unique in the current API Management service instance. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable checkEntityExistsAsync(String resourceGroupName, String serviceName, String productId, String apiId) { + return checkEntityExistsWithServiceResponseAsync(resourceGroupName, serviceName, productId, apiId).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Checks that API entity specified by identifier is associated with the Product entity. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param productId Product identifier. Must be unique in the current API Management service instance. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> checkEntityExistsWithServiceResponseAsync(String resourceGroupName, String serviceName, String productId, String apiId) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (productId == null) { + throw new IllegalArgumentException("Parameter productId is required and cannot be null."); + } + if (apiId == null) { + throw new IllegalArgumentException("Parameter apiId is required and cannot be null."); + } + 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.checkEntityExists(resourceGroupName, serviceName, productId, apiId, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = checkEntityExistsDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse checkEntityExistsDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(204, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .buildEmpty(response); + } + + /** + * Adds an API to the specified product. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param productId Product identifier. Must be unique in the current API Management service instance. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ApiContractInner object if successful. + */ + public ApiContractInner createOrUpdate(String resourceGroupName, String serviceName, String productId, String apiId) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serviceName, productId, apiId).toBlocking().single().body(); + } + + /** + * Adds an API to the specified product. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param productId Product identifier. Must be unique in the current API Management service instance. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @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 createOrUpdateAsync(String resourceGroupName, String serviceName, String productId, String apiId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, serviceName, productId, apiId), serviceCallback); + } + + /** + * Adds an API to the specified product. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param productId Product identifier. Must be unique in the current API Management service instance. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ApiContractInner object + */ + public Observable createOrUpdateAsync(String resourceGroupName, String serviceName, String productId, String apiId) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serviceName, productId, apiId).map(new Func1, ApiContractInner>() { + @Override + public ApiContractInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Adds an API to the specified product. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param productId Product identifier. Must be unique in the current API Management service instance. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ApiContractInner object + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String serviceName, String productId, String apiId) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (productId == null) { + throw new IllegalArgumentException("Parameter productId is required and cannot be null."); + } + if (apiId == null) { + throw new IllegalArgumentException("Parameter apiId is required and cannot be null."); + } + 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.createOrUpdate(resourceGroupName, serviceName, productId, apiId, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = createOrUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse createOrUpdateDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(201, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Deletes the specified API from the specified product. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param productId Product identifier. Must be unique in the current API Management service instance. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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 serviceName, String productId, String apiId) { + deleteWithServiceResponseAsync(resourceGroupName, serviceName, productId, apiId).toBlocking().single().body(); + } + + /** + * Deletes the specified API from the specified product. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param productId Product identifier. Must be unique in the current API Management service instance. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @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 serviceName, String productId, String apiId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, serviceName, productId, apiId), serviceCallback); + } + + /** + * Deletes the specified API from the specified product. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param productId Product identifier. Must be unique in the current API Management service instance. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable deleteAsync(String resourceGroupName, String serviceName, String productId, String apiId) { + return deleteWithServiceResponseAsync(resourceGroupName, serviceName, productId, apiId).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes the specified API from the specified product. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param productId Product identifier. Must be unique in the current API Management service instance. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> deleteWithServiceResponseAsync(String resourceGroupName, String serviceName, String productId, String apiId) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (productId == null) { + throw new IllegalArgumentException("Parameter productId is required and cannot be null."); + } + if (apiId == null) { + throw new IllegalArgumentException("Parameter apiId is required and cannot be null."); + } + 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.delete(resourceGroupName, serviceName, productId, apiId, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = deleteDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse deleteDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(204, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists a collection of the APIs associated with a product. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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<ApiContractInner> object if successful. + */ + public PagedList listByProductNext(final String nextPageLink) { + ServiceResponse> response = listByProductNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByProductNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists a collection of the APIs associated with a product. + * + * @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> listByProductNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByProductNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByProductNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists a collection of the APIs associated with a product. + * + * @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<ApiContractInner> object + */ + public Observable> listByProductNextAsync(final String nextPageLink) { + return listByProductNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists a collection of the APIs associated with a product. + * + * @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<ApiContractInner> object + */ + public Observable>> listByProductNextWithServiceResponseAsync(final String nextPageLink) { + return listByProductNextSinglePageAsync(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(listByProductNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists a collection of the APIs associated with a product. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ApiContractInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByProductNextSinglePageAsync(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.listByProductNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByProductNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByProductNextDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ProductContractImpl.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ProductContractImpl.java new file mode 100644 index 0000000000000..e3375b38b13e8 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ProductContractImpl.java @@ -0,0 +1,190 @@ +/** + * 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.apimanagement.v2019_01_01.implementation; + +import com.microsoft.azure.management.apimanagement.v2019_01_01.ProductContract; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import com.microsoft.azure.management.apimanagement.v2019_01_01.ProductState; + +class ProductContractImpl extends CreatableUpdatableImpl implements ProductContract, ProductContract.Definition, ProductContract.Update { + private String resourceGroupName; + private String serviceName; + private String productId; + private String cifMatch; + private String uifMatch; + private final ApiManagementManager manager; + + ProductContractImpl(String name, ApiManagementManager manager) { + super(name, new ProductContractInner()); + this.manager = manager; + // Set resource name + this.productId = name; + // + } + + ProductContractImpl(ProductContractInner inner, ApiManagementManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.productId = inner.name(); + // set resource ancestor and positional variables + this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourceGroups"); + this.serviceName = IdParsingUtils.getValueFromIdByName(inner.id(), "service"); + this.productId = IdParsingUtils.getValueFromIdByName(inner.id(), "products"); + // set other parameters for create and update + } + + @Override + public ApiManagementManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + ProductsInner client = this.manager().inner().products(); + return client.createOrUpdateAsync(this.resourceGroupName, this.serviceName, this.productId, this.inner(), this.cifMatch) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + ProductsInner client = this.manager().inner().products(); + return client.createOrUpdateAsync(this.resourceGroupName, this.serviceName, this.productId, this.inner(), this.uifMatch) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + ProductsInner client = this.manager().inner().products(); + return null; // NOP getInnerAsync implementation as get is not supported + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + + @Override + public Boolean approvalRequired() { + return this.inner().approvalRequired(); + } + + @Override + public String description() { + return this.inner().description(); + } + + @Override + public String displayName() { + return this.inner().displayName(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public ProductState state() { + return this.inner().state(); + } + + @Override + public Boolean subscriptionRequired() { + return this.inner().subscriptionRequired(); + } + + @Override + public Integer subscriptionsLimit() { + return this.inner().subscriptionsLimit(); + } + + @Override + public String terms() { + return this.inner().terms(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public ProductContractImpl withResourceGroupName(String resourceGroupName) { + this.resourceGroupName = resourceGroupName; + return this; + } + + @Override + public ProductContractImpl withServiceName(String serviceName) { + this.serviceName = serviceName; + return this; + } + + @Override + public ProductContractImpl withDisplayName(String displayName) { + this.inner().withDisplayName(displayName); + return this; + } + + @Override + public ProductContractImpl withIfMatch(String ifMatch) { + if (isInCreateMode()) { + this.cifMatch = ifMatch; + } else { + this.uifMatch = ifMatch; + } + return this; + } + + @Override + public ProductContractImpl withApprovalRequired(Boolean approvalRequired) { + this.inner().withApprovalRequired(approvalRequired); + return this; + } + + @Override + public ProductContractImpl withDescription(String description) { + this.inner().withDescription(description); + return this; + } + + @Override + public ProductContractImpl withState(ProductState state) { + this.inner().withState(state); + return this; + } + + @Override + public ProductContractImpl withSubscriptionRequired(Boolean subscriptionRequired) { + this.inner().withSubscriptionRequired(subscriptionRequired); + return this; + } + + @Override + public ProductContractImpl withSubscriptionsLimit(Integer subscriptionsLimit) { + this.inner().withSubscriptionsLimit(subscriptionsLimit); + return this; + } + + @Override + public ProductContractImpl withTerms(String terms) { + this.inner().withTerms(terms); + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ProductContractInner.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ProductContractInner.java new file mode 100644 index 0000000000000..7c70f88303513 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ProductContractInner.java @@ -0,0 +1,222 @@ +/** + * 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.apimanagement.v2019_01_01.implementation; + +import com.microsoft.azure.management.apimanagement.v2019_01_01.ProductState; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * Product details. + */ +@JsonFlatten +public class ProductContractInner extends ProxyResource { + /** + * Product description. May include HTML formatting tags. + */ + @JsonProperty(value = "properties.description") + private String description; + + /** + * Product terms of use. Developers trying to subscribe to the product will + * be presented and required to accept these terms before they can complete + * the subscription process. + */ + @JsonProperty(value = "properties.terms") + private String terms; + + /** + * Whether a product subscription is required for accessing APIs included + * in this product. If true, the product is referred to as "protected" and + * a valid subscription key is required for a request to an API included in + * the product to succeed. If false, the product is referred to as "open" + * and requests to an API included in the product can be made without a + * subscription key. If property is omitted when creating a new product + * it's value is assumed to be true. + */ + @JsonProperty(value = "properties.subscriptionRequired") + private Boolean subscriptionRequired; + + /** + * whether subscription approval is required. If false, new subscriptions + * will be approved automatically enabling developers to call the product’s + * APIs immediately after subscribing. If true, administrators must + * manually approve the subscription before the developer can any of the + * product’s APIs. Can be present only if subscriptionRequired property is + * present and has a value of false. + */ + @JsonProperty(value = "properties.approvalRequired") + private Boolean approvalRequired; + + /** + * Whether the number of subscriptions a user can have to this product at + * the same time. Set to null or omit to allow unlimited per user + * subscriptions. Can be present only if subscriptionRequired property is + * present and has a value of false. + */ + @JsonProperty(value = "properties.subscriptionsLimit") + private Integer subscriptionsLimit; + + /** + * whether product is published or not. Published products are discoverable + * by users of developer portal. Non published products are visible only to + * administrators. Default state of Product is notPublished. Possible + * values include: 'notPublished', 'published'. + */ + @JsonProperty(value = "properties.state") + private ProductState state; + + /** + * Product name. + */ + @JsonProperty(value = "properties.displayName", required = true) + private String displayName; + + /** + * Get product description. May include HTML formatting tags. + * + * @return the description value + */ + public String description() { + return this.description; + } + + /** + * Set product description. May include HTML formatting tags. + * + * @param description the description value to set + * @return the ProductContractInner object itself. + */ + public ProductContractInner withDescription(String description) { + this.description = description; + return this; + } + + /** + * Get product terms of use. Developers trying to subscribe to the product will be presented and required to accept these terms before they can complete the subscription process. + * + * @return the terms value + */ + public String terms() { + return this.terms; + } + + /** + * Set product terms of use. Developers trying to subscribe to the product will be presented and required to accept these terms before they can complete the subscription process. + * + * @param terms the terms value to set + * @return the ProductContractInner object itself. + */ + public ProductContractInner withTerms(String terms) { + this.terms = terms; + return this; + } + + /** + * Get whether a product subscription is required for accessing APIs included in this product. If true, the product is referred to as "protected" and a valid subscription key is required for a request to an API included in the product to succeed. If false, the product is referred to as "open" and requests to an API included in the product can be made without a subscription key. If property is omitted when creating a new product it's value is assumed to be true. + * + * @return the subscriptionRequired value + */ + public Boolean subscriptionRequired() { + return this.subscriptionRequired; + } + + /** + * Set whether a product subscription is required for accessing APIs included in this product. If true, the product is referred to as "protected" and a valid subscription key is required for a request to an API included in the product to succeed. If false, the product is referred to as "open" and requests to an API included in the product can be made without a subscription key. If property is omitted when creating a new product it's value is assumed to be true. + * + * @param subscriptionRequired the subscriptionRequired value to set + * @return the ProductContractInner object itself. + */ + public ProductContractInner withSubscriptionRequired(Boolean subscriptionRequired) { + this.subscriptionRequired = subscriptionRequired; + return this; + } + + /** + * Get whether subscription approval is required. If false, new subscriptions will be approved automatically enabling developers to call the product’s APIs immediately after subscribing. If true, administrators must manually approve the subscription before the developer can any of the product’s APIs. Can be present only if subscriptionRequired property is present and has a value of false. + * + * @return the approvalRequired value + */ + public Boolean approvalRequired() { + return this.approvalRequired; + } + + /** + * Set whether subscription approval is required. If false, new subscriptions will be approved automatically enabling developers to call the product’s APIs immediately after subscribing. If true, administrators must manually approve the subscription before the developer can any of the product’s APIs. Can be present only if subscriptionRequired property is present and has a value of false. + * + * @param approvalRequired the approvalRequired value to set + * @return the ProductContractInner object itself. + */ + public ProductContractInner withApprovalRequired(Boolean approvalRequired) { + this.approvalRequired = approvalRequired; + return this; + } + + /** + * Get whether the number of subscriptions a user can have to this product at the same time. Set to null or omit to allow unlimited per user subscriptions. Can be present only if subscriptionRequired property is present and has a value of false. + * + * @return the subscriptionsLimit value + */ + public Integer subscriptionsLimit() { + return this.subscriptionsLimit; + } + + /** + * Set whether the number of subscriptions a user can have to this product at the same time. Set to null or omit to allow unlimited per user subscriptions. Can be present only if subscriptionRequired property is present and has a value of false. + * + * @param subscriptionsLimit the subscriptionsLimit value to set + * @return the ProductContractInner object itself. + */ + public ProductContractInner withSubscriptionsLimit(Integer subscriptionsLimit) { + this.subscriptionsLimit = subscriptionsLimit; + return this; + } + + /** + * Get whether product is published or not. Published products are discoverable by users of developer portal. Non published products are visible only to administrators. Default state of Product is notPublished. Possible values include: 'notPublished', 'published'. + * + * @return the state value + */ + public ProductState state() { + return this.state; + } + + /** + * Set whether product is published or not. Published products are discoverable by users of developer portal. Non published products are visible only to administrators. Default state of Product is notPublished. Possible values include: 'notPublished', 'published'. + * + * @param state the state value to set + * @return the ProductContractInner object itself. + */ + public ProductContractInner withState(ProductState state) { + this.state = state; + return this; + } + + /** + * Get product name. + * + * @return the displayName value + */ + public String displayName() { + return this.displayName; + } + + /** + * Set product name. + * + * @param displayName the displayName value to set + * @return the ProductContractInner object itself. + */ + public ProductContractInner withDisplayName(String displayName) { + this.displayName = displayName; + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ProductGroupContractImpl.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ProductGroupContractImpl.java new file mode 100644 index 0000000000000..f634655fe3312 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ProductGroupContractImpl.java @@ -0,0 +1,123 @@ +/** + * 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.apimanagement.v2019_01_01.implementation; + +import com.microsoft.azure.management.apimanagement.v2019_01_01.ProductGroupContract; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import com.microsoft.azure.management.apimanagement.v2019_01_01.GroupType; + +class ProductGroupContractImpl extends CreatableUpdatableImpl implements ProductGroupContract, ProductGroupContract.Definition, ProductGroupContract.Update { + private final ApiManagementManager manager; + private String resourceGroupName; + private String serviceName; + private String productId; + private String groupId; + + ProductGroupContractImpl(String name, ApiManagementManager manager) { + super(name, new GroupContractInner()); + this.manager = manager; + // Set resource name + this.groupId = name; + // + } + + ProductGroupContractImpl(GroupContractInner inner, ApiManagementManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.groupId = inner.name(); + // set resource ancestor and positional variables + this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourceGroups"); + this.serviceName = IdParsingUtils.getValueFromIdByName(inner.id(), "service"); + this.productId = IdParsingUtils.getValueFromIdByName(inner.id(), "products"); + this.groupId = IdParsingUtils.getValueFromIdByName(inner.id(), "groups"); + // + } + + @Override + public ApiManagementManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + ProductGroupsInner client = this.manager().inner().productGroups(); + return client.createOrUpdateAsync(this.resourceGroupName, this.serviceName, this.productId, this.groupId) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + ProductGroupsInner client = this.manager().inner().productGroups(); + return client.createOrUpdateAsync(this.resourceGroupName, this.serviceName, this.productId, this.groupId) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + ProductGroupsInner client = this.manager().inner().productGroups(); + return null; // NOP getInnerAsync implementation as get is not supported + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + + @Override + public Boolean builtIn() { + return this.inner().builtIn(); + } + + @Override + public String description() { + return this.inner().description(); + } + + @Override + public String displayName() { + return this.inner().displayName(); + } + + @Override + public String externalId() { + return this.inner().externalId(); + } + + @Override + public GroupType groupContractType() { + return this.inner().groupContractType(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public ProductGroupContractImpl withExistingProduct(String resourceGroupName, String serviceName, String productId) { + this.resourceGroupName = resourceGroupName; + this.serviceName = serviceName; + this.productId = productId; + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ProductGroupsImpl.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ProductGroupsImpl.java new file mode 100644 index 0000000000000..74060c7909517 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ProductGroupsImpl.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.apimanagement.v2019_01_01.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.apimanagement.v2019_01_01.ProductGroups; +import rx.Completable; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.apimanagement.v2019_01_01.ProductGroupContract; + +class ProductGroupsImpl extends WrapperImpl implements ProductGroups { + private final ApiManagementManager manager; + + ProductGroupsImpl(ApiManagementManager manager) { + super(manager.inner().productGroups()); + this.manager = manager; + } + + public ApiManagementManager manager() { + return this.manager; + } + + @Override + public ProductGroupContractImpl define(String name) { + return wrapModel(name); + } + + private ProductGroupContractImpl wrapModel(GroupContractInner inner) { + return new ProductGroupContractImpl(inner, manager()); + } + + private ProductGroupContractImpl wrapModel(String name) { + return new ProductGroupContractImpl(name, this.manager()); + } + + @Override + public Completable checkEntityExistsAsync(String resourceGroupName, String serviceName, String productId, String groupId) { + ProductGroupsInner client = this.inner(); + return client.checkEntityExistsAsync(resourceGroupName, serviceName, productId, groupId).toCompletable(); + } + + @Override + public Observable listByProductAsync(final String resourceGroupName, final String serviceName, final String productId) { + ProductGroupsInner client = this.inner(); + return client.listByProductAsync(resourceGroupName, serviceName, productId) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public ProductGroupContract call(GroupContractInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Completable deleteAsync(String resourceGroupName, String serviceName, String productId, String groupId) { + ProductGroupsInner client = this.inner(); + return client.deleteAsync(resourceGroupName, serviceName, productId, groupId).toCompletable(); + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ProductGroupsInner.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ProductGroupsInner.java new file mode 100644 index 0000000000000..76f07d089b7e9 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ProductGroupsInner.java @@ -0,0 +1,769 @@ +/** + * 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.apimanagement.v2019_01_01.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.apimanagement.v2019_01_01.ErrorResponseException; +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.GET; +import retrofit2.http.HEAD; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.HTTP; +import retrofit2.http.Path; +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 ProductGroups. + */ +public class ProductGroupsInner { + /** The Retrofit service to perform REST calls. */ + private ProductGroupsService service; + /** The service client containing this operation class. */ + private ApiManagementClientImpl client; + + /** + * Initializes an instance of ProductGroupsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public ProductGroupsInner(Retrofit retrofit, ApiManagementClientImpl client) { + this.service = retrofit.create(ProductGroupsService.class); + this.client = client; + } + + /** + * The interface defining all the services for ProductGroups to be + * used by Retrofit to perform actually REST calls. + */ + interface ProductGroupsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.apimanagement.v2019_01_01.ProductGroups listByProduct" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/groups") + Observable> listByProduct(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("productId") String productId, @Path("subscriptionId") String subscriptionId, @Query("$filter") String filter, @Query("$top") Integer top, @Query("$skip") Integer skip, @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.apimanagement.v2019_01_01.ProductGroups checkEntityExists" }) + @HEAD("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/groups/{groupId}") + Observable> checkEntityExists(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("productId") String productId, @Path("groupId") String groupId, @Path("subscriptionId") String subscriptionId, @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.apimanagement.v2019_01_01.ProductGroups createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/groups/{groupId}") + Observable> createOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("productId") String productId, @Path("groupId") String groupId, @Path("subscriptionId") String subscriptionId, @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.apimanagement.v2019_01_01.ProductGroups delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/groups/{groupId}", method = "DELETE", hasBody = true) + Observable> delete(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("productId") String productId, @Path("groupId") String groupId, @Path("subscriptionId") String subscriptionId, @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.apimanagement.v2019_01_01.ProductGroups listByProductNext" }) + @GET + Observable> listByProductNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Lists the collection of developer groups associated with the specified product. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param productId Product identifier. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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<GroupContractInner> object if successful. + */ + public PagedList listByProduct(final String resourceGroupName, final String serviceName, final String productId) { + ServiceResponse> response = listByProductSinglePageAsync(resourceGroupName, serviceName, productId).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByProductNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the collection of developer groups associated with the specified product. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param productId Product identifier. Must be unique in the current API Management service instance. + * @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> listByProductAsync(final String resourceGroupName, final String serviceName, final String productId, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByProductSinglePageAsync(resourceGroupName, serviceName, productId), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByProductNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the collection of developer groups associated with the specified product. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param productId Product identifier. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<GroupContractInner> object + */ + public Observable> listByProductAsync(final String resourceGroupName, final String serviceName, final String productId) { + return listByProductWithServiceResponseAsync(resourceGroupName, serviceName, productId) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the collection of developer groups associated with the specified product. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param productId Product identifier. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<GroupContractInner> object + */ + public Observable>> listByProductWithServiceResponseAsync(final String resourceGroupName, final String serviceName, final String productId) { + return listByProductSinglePageAsync(resourceGroupName, serviceName, productId) + .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(listByProductNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the collection of developer groups associated with the specified product. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param productId Product identifier. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<GroupContractInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByProductSinglePageAsync(final String resourceGroupName, final String serviceName, final String productId) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (productId == null) { + throw new IllegalArgumentException("Parameter productId is required and cannot be null."); + } + 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 filter = null; + final Integer top = null; + final Integer skip = null; + return service.listByProduct(resourceGroupName, serviceName, productId, this.client.subscriptionId(), filter, top, skip, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByProductDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Lists the collection of developer groups associated with the specified product. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param productId Product identifier. Must be unique in the current API Management service instance. + * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | | </br>| displayName | filter | eq, ne | | </br>| description | filter | eq, ne | | </br> + * @param top Number of records to return. + * @param skip Number of records to skip. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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<GroupContractInner> object if successful. + */ + public PagedList listByProduct(final String resourceGroupName, final String serviceName, final String productId, final String filter, final Integer top, final Integer skip) { + ServiceResponse> response = listByProductSinglePageAsync(resourceGroupName, serviceName, productId, filter, top, skip).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByProductNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the collection of developer groups associated with the specified product. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param productId Product identifier. Must be unique in the current API Management service instance. + * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | | </br>| displayName | filter | eq, ne | | </br>| description | filter | eq, ne | | </br> + * @param top Number of records to return. + * @param skip Number of records to skip. + * @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> listByProductAsync(final String resourceGroupName, final String serviceName, final String productId, final String filter, final Integer top, final Integer skip, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByProductSinglePageAsync(resourceGroupName, serviceName, productId, filter, top, skip), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByProductNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the collection of developer groups associated with the specified product. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param productId Product identifier. Must be unique in the current API Management service instance. + * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | | </br>| displayName | filter | eq, ne | | </br>| description | filter | eq, ne | | </br> + * @param top Number of records to return. + * @param skip Number of records to skip. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<GroupContractInner> object + */ + public Observable> listByProductAsync(final String resourceGroupName, final String serviceName, final String productId, final String filter, final Integer top, final Integer skip) { + return listByProductWithServiceResponseAsync(resourceGroupName, serviceName, productId, filter, top, skip) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the collection of developer groups associated with the specified product. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param productId Product identifier. Must be unique in the current API Management service instance. + * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | | </br>| displayName | filter | eq, ne | | </br>| description | filter | eq, ne | | </br> + * @param top Number of records to return. + * @param skip Number of records to skip. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<GroupContractInner> object + */ + public Observable>> listByProductWithServiceResponseAsync(final String resourceGroupName, final String serviceName, final String productId, final String filter, final Integer top, final Integer skip) { + return listByProductSinglePageAsync(resourceGroupName, serviceName, productId, filter, top, skip) + .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(listByProductNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the collection of developer groups associated with the specified product. + * + ServiceResponse> * @param resourceGroupName The name of the resource group. + ServiceResponse> * @param serviceName The name of the API Management service. + ServiceResponse> * @param productId Product identifier. Must be unique in the current API Management service instance. + ServiceResponse> * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | | </br>| displayName | filter | eq, ne | | </br>| description | filter | eq, ne | | </br> + ServiceResponse> * @param top Number of records to return. + ServiceResponse> * @param skip Number of records to skip. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<GroupContractInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByProductSinglePageAsync(final String resourceGroupName, final String serviceName, final String productId, final String filter, final Integer top, final Integer skip) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (productId == null) { + throw new IllegalArgumentException("Parameter productId is required and cannot be null."); + } + 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.listByProduct(resourceGroupName, serviceName, productId, this.client.subscriptionId(), filter, top, skip, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByProductDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByProductDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Checks that Group entity specified by identifier is associated with the Product entity. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param productId Product identifier. Must be unique in the current API Management service instance. + * @param groupId Group identifier. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void checkEntityExists(String resourceGroupName, String serviceName, String productId, String groupId) { + checkEntityExistsWithServiceResponseAsync(resourceGroupName, serviceName, productId, groupId).toBlocking().single().body(); + } + + /** + * Checks that Group entity specified by identifier is associated with the Product entity. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param productId Product identifier. Must be unique in the current API Management service instance. + * @param groupId Group identifier. Must be unique in the current API Management service instance. + * @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 checkEntityExistsAsync(String resourceGroupName, String serviceName, String productId, String groupId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(checkEntityExistsWithServiceResponseAsync(resourceGroupName, serviceName, productId, groupId), serviceCallback); + } + + /** + * Checks that Group entity specified by identifier is associated with the Product entity. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param productId Product identifier. Must be unique in the current API Management service instance. + * @param groupId Group identifier. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable checkEntityExistsAsync(String resourceGroupName, String serviceName, String productId, String groupId) { + return checkEntityExistsWithServiceResponseAsync(resourceGroupName, serviceName, productId, groupId).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Checks that Group entity specified by identifier is associated with the Product entity. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param productId Product identifier. Must be unique in the current API Management service instance. + * @param groupId Group identifier. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> checkEntityExistsWithServiceResponseAsync(String resourceGroupName, String serviceName, String productId, String groupId) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (productId == null) { + throw new IllegalArgumentException("Parameter productId is required and cannot be null."); + } + if (groupId == null) { + throw new IllegalArgumentException("Parameter groupId is required and cannot be null."); + } + 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.checkEntityExists(resourceGroupName, serviceName, productId, groupId, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = checkEntityExistsDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse checkEntityExistsDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(204, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .buildEmpty(response); + } + + /** + * Adds the association between the specified developer group with the specified product. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param productId Product identifier. Must be unique in the current API Management service instance. + * @param groupId Group identifier. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the GroupContractInner object if successful. + */ + public GroupContractInner createOrUpdate(String resourceGroupName, String serviceName, String productId, String groupId) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serviceName, productId, groupId).toBlocking().single().body(); + } + + /** + * Adds the association between the specified developer group with the specified product. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param productId Product identifier. Must be unique in the current API Management service instance. + * @param groupId Group identifier. Must be unique in the current API Management service instance. + * @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 createOrUpdateAsync(String resourceGroupName, String serviceName, String productId, String groupId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, serviceName, productId, groupId), serviceCallback); + } + + /** + * Adds the association between the specified developer group with the specified product. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param productId Product identifier. Must be unique in the current API Management service instance. + * @param groupId Group identifier. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the GroupContractInner object + */ + public Observable createOrUpdateAsync(String resourceGroupName, String serviceName, String productId, String groupId) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serviceName, productId, groupId).map(new Func1, GroupContractInner>() { + @Override + public GroupContractInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Adds the association between the specified developer group with the specified product. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param productId Product identifier. Must be unique in the current API Management service instance. + * @param groupId Group identifier. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the GroupContractInner object + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String serviceName, String productId, String groupId) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (productId == null) { + throw new IllegalArgumentException("Parameter productId is required and cannot be null."); + } + if (groupId == null) { + throw new IllegalArgumentException("Parameter groupId is required and cannot be null."); + } + 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.createOrUpdate(resourceGroupName, serviceName, productId, groupId, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = createOrUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse createOrUpdateDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(201, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Deletes the association between the specified group and product. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param productId Product identifier. Must be unique in the current API Management service instance. + * @param groupId Group identifier. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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 serviceName, String productId, String groupId) { + deleteWithServiceResponseAsync(resourceGroupName, serviceName, productId, groupId).toBlocking().single().body(); + } + + /** + * Deletes the association between the specified group and product. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param productId Product identifier. Must be unique in the current API Management service instance. + * @param groupId Group identifier. Must be unique in the current API Management service instance. + * @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 serviceName, String productId, String groupId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, serviceName, productId, groupId), serviceCallback); + } + + /** + * Deletes the association between the specified group and product. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param productId Product identifier. Must be unique in the current API Management service instance. + * @param groupId Group identifier. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable deleteAsync(String resourceGroupName, String serviceName, String productId, String groupId) { + return deleteWithServiceResponseAsync(resourceGroupName, serviceName, productId, groupId).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes the association between the specified group and product. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param productId Product identifier. Must be unique in the current API Management service instance. + * @param groupId Group identifier. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> deleteWithServiceResponseAsync(String resourceGroupName, String serviceName, String productId, String groupId) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (productId == null) { + throw new IllegalArgumentException("Parameter productId is required and cannot be null."); + } + if (groupId == null) { + throw new IllegalArgumentException("Parameter groupId is required and cannot be null."); + } + 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.delete(resourceGroupName, serviceName, productId, groupId, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = deleteDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse deleteDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(204, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists the collection of developer groups associated with the specified product. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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<GroupContractInner> object if successful. + */ + public PagedList listByProductNext(final String nextPageLink) { + ServiceResponse> response = listByProductNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByProductNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the collection of developer groups associated with the specified product. + * + * @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> listByProductNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByProductNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByProductNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the collection of developer groups associated with the specified product. + * + * @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<GroupContractInner> object + */ + public Observable> listByProductNextAsync(final String nextPageLink) { + return listByProductNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the collection of developer groups associated with the specified product. + * + * @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<GroupContractInner> object + */ + public Observable>> listByProductNextWithServiceResponseAsync(final String nextPageLink) { + return listByProductNextSinglePageAsync(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(listByProductNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the collection of developer groups associated with the specified product. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<GroupContractInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByProductNextSinglePageAsync(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.listByProductNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByProductNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByProductNextDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ProductPolicyContractImpl.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ProductPolicyContractImpl.java new file mode 100644 index 0000000000000..880749c5efc35 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ProductPolicyContractImpl.java @@ -0,0 +1,130 @@ +/** + * 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.apimanagement.v2019_01_01.implementation; + +import com.microsoft.azure.management.apimanagement.v2019_01_01.ProductPolicyContract; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import com.microsoft.azure.management.apimanagement.v2019_01_01.PolicyContentFormat; + +class ProductPolicyContractImpl extends CreatableUpdatableImpl implements ProductPolicyContract, ProductPolicyContract.Definition, ProductPolicyContract.Update { + private final ApiManagementManager manager; + private String resourceGroupName; + private String serviceName; + private String productId; + private String cifMatch; + private String uifMatch; + + ProductPolicyContractImpl(String name, ApiManagementManager manager) { + super(name, new PolicyContractInner()); + this.manager = manager; + // Set resource name + this.productId = name; + // + } + + ProductPolicyContractImpl(PolicyContractInner inner, ApiManagementManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.productId = inner.name(); + // set resource ancestor and positional variables + this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourceGroups"); + this.serviceName = IdParsingUtils.getValueFromIdByName(inner.id(), "service"); + this.productId = IdParsingUtils.getValueFromIdByName(inner.id(), "products"); + // + } + + @Override + public ApiManagementManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + ProductPolicysInner client = this.manager().inner().productPolicys(); + return client.createOrUpdateAsync(this.resourceGroupName, this.serviceName, this.productId, this.inner(), this.cifMatch) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + ProductPolicysInner client = this.manager().inner().productPolicys(); + return client.createOrUpdateAsync(this.resourceGroupName, this.serviceName, this.productId, this.inner(), this.uifMatch) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + ProductPolicysInner client = this.manager().inner().productPolicys(); + return client.getAsync(this.resourceGroupName, this.serviceName, this.productId); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + + @Override + public PolicyContentFormat format() { + return this.inner().format(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public String value() { + return this.inner().value(); + } + + @Override + public ProductPolicyContractImpl withExistingProduct(String resourceGroupName, String serviceName, String productId) { + this.resourceGroupName = resourceGroupName; + this.serviceName = serviceName; + this.productId = productId; + return this; + } + + @Override + public ProductPolicyContractImpl withValue(String value) { + this.inner().withValue(value); + return this; + } + + @Override + public ProductPolicyContractImpl withIfMatch(String ifMatch) { + if (isInCreateMode()) { + this.cifMatch = ifMatch; + } else { + this.uifMatch = ifMatch; + } + return this; + } + + @Override + public ProductPolicyContractImpl withFormat(PolicyContentFormat format) { + this.inner().withFormat(format); + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ProductPolicysImpl.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ProductPolicysImpl.java new file mode 100644 index 0000000000000..771a4164c5ec3 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ProductPolicysImpl.java @@ -0,0 +1,81 @@ +/** + * 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.apimanagement.v2019_01_01.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.apimanagement.v2019_01_01.ProductPolicys; +import rx.Completable; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.management.apimanagement.v2019_01_01.PolicyCollection; +import com.microsoft.azure.management.apimanagement.v2019_01_01.ProductPolicyContract; + +class ProductPolicysImpl extends WrapperImpl implements ProductPolicys { + private final ApiManagementManager manager; + + ProductPolicysImpl(ApiManagementManager manager) { + super(manager.inner().productPolicys()); + this.manager = manager; + } + + public ApiManagementManager manager() { + return this.manager; + } + + @Override + public ProductPolicyContractImpl define(String name) { + return wrapModel(name); + } + + private ProductPolicyContractImpl wrapModel(PolicyContractInner inner) { + return new ProductPolicyContractImpl(inner, manager()); + } + + private ProductPolicyContractImpl wrapModel(String name) { + return new ProductPolicyContractImpl(name, this.manager()); + } + + @Override + public Observable listByProductAsync(String resourceGroupName, String serviceName, String productId) { + ProductPolicysInner client = this.inner(); + return client.listByProductAsync(resourceGroupName, serviceName, productId) + .map(new Func1() { + @Override + public PolicyCollection call(PolicyCollectionInner inner) { + return new PolicyCollectionImpl(inner, manager()); + } + }); + } + + @Override + public Completable getEntityTagAsync(String resourceGroupName, String serviceName, String productId) { + ProductPolicysInner client = this.inner(); + return client.getEntityTagAsync(resourceGroupName, serviceName, productId).toCompletable(); + } + + @Override + public Observable getAsync(String resourceGroupName, String serviceName, String productId) { + ProductPolicysInner client = this.inner(); + return client.getAsync(resourceGroupName, serviceName, productId) + .map(new Func1() { + @Override + public ProductPolicyContract call(PolicyContractInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Completable deleteAsync(String resourceGroupName, String serviceName, String productId, String ifMatch) { + ProductPolicysInner client = this.inner(); + return client.deleteAsync(resourceGroupName, serviceName, productId, ifMatch).toCompletable(); + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ProductPolicysInner.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ProductPolicysInner.java new file mode 100644 index 0000000000000..1dc7d43c685fc --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ProductPolicysInner.java @@ -0,0 +1,762 @@ +/** + * 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.apimanagement.v2019_01_01.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.management.apimanagement.v2019_01_01.ErrorResponseException; +import com.microsoft.azure.management.apimanagement.v2019_01_01.PolicyExportFormat; +import com.microsoft.azure.management.apimanagement.v2019_01_01.ProductPolicyCreateOrUpdateHeaders; +import com.microsoft.azure.management.apimanagement.v2019_01_01.ProductPolicyGetEntityTagHeaders; +import com.microsoft.azure.management.apimanagement.v2019_01_01.ProductPolicyGetHeaders; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import com.microsoft.rest.ServiceResponseWithHeaders; +import com.microsoft.rest.Validator; +import java.io.IOException; +import okhttp3.ResponseBody; +import retrofit2.http.Body; +import retrofit2.http.GET; +import retrofit2.http.HEAD; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.HTTP; +import retrofit2.http.Path; +import retrofit2.http.PUT; +import retrofit2.http.Query; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in ProductPolicys. + */ +public class ProductPolicysInner { + /** The Retrofit service to perform REST calls. */ + private ProductPolicysService service; + /** The service client containing this operation class. */ + private ApiManagementClientImpl client; + + /** + * Initializes an instance of ProductPolicysInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public ProductPolicysInner(Retrofit retrofit, ApiManagementClientImpl client) { + this.service = retrofit.create(ProductPolicysService.class); + this.client = client; + } + + /** + * The interface defining all the services for ProductPolicys to be + * used by Retrofit to perform actually REST calls. + */ + interface ProductPolicysService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.apimanagement.v2019_01_01.ProductPolicys listByProduct" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/policies") + Observable> listByProduct(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("productId") String productId, @Path("subscriptionId") String subscriptionId, @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.apimanagement.v2019_01_01.ProductPolicys getEntityTag" }) + @HEAD("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/policies/{policyId}") + Observable> getEntityTag(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("productId") String productId, @Path("policyId") String policyId, @Path("subscriptionId") String subscriptionId, @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.apimanagement.v2019_01_01.ProductPolicys get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/policies/{policyId}") + Observable> get(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("productId") String productId, @Path("policyId") String policyId, @Path("subscriptionId") String subscriptionId, @Query("format") PolicyExportFormat format, @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.apimanagement.v2019_01_01.ProductPolicys createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/policies/{policyId}") + Observable> createOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("productId") String productId, @Path("policyId") String policyId, @Path("subscriptionId") String subscriptionId, @Header("If-Match") String ifMatch, @Body PolicyContractInner parameters, @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.apimanagement.v2019_01_01.ProductPolicys delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/policies/{policyId}", method = "DELETE", hasBody = true) + Observable> delete(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("productId") String productId, @Path("policyId") String policyId, @Path("subscriptionId") String subscriptionId, @Header("If-Match") String ifMatch, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Get the policy configuration at the Product level. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param productId Product identifier. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PolicyCollectionInner object if successful. + */ + public PolicyCollectionInner listByProduct(String resourceGroupName, String serviceName, String productId) { + return listByProductWithServiceResponseAsync(resourceGroupName, serviceName, productId).toBlocking().single().body(); + } + + /** + * Get the policy configuration at the Product level. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param productId Product identifier. Must be unique in the current API Management service instance. + * @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 listByProductAsync(String resourceGroupName, String serviceName, String productId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(listByProductWithServiceResponseAsync(resourceGroupName, serviceName, productId), serviceCallback); + } + + /** + * Get the policy configuration at the Product level. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param productId Product identifier. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PolicyCollectionInner object + */ + public Observable listByProductAsync(String resourceGroupName, String serviceName, String productId) { + return listByProductWithServiceResponseAsync(resourceGroupName, serviceName, productId).map(new Func1, PolicyCollectionInner>() { + @Override + public PolicyCollectionInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Get the policy configuration at the Product level. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param productId Product identifier. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PolicyCollectionInner object + */ + public Observable> listByProductWithServiceResponseAsync(String resourceGroupName, String serviceName, String productId) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (productId == null) { + throw new IllegalArgumentException("Parameter productId is required and cannot be null."); + } + 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.listByProduct(resourceGroupName, serviceName, productId, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = listByProductDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse listByProductDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Get the ETag of the policy configuration at the Product level. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param productId Product identifier. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void getEntityTag(String resourceGroupName, String serviceName, String productId) { + getEntityTagWithServiceResponseAsync(resourceGroupName, serviceName, productId).toBlocking().single().body(); + } + + /** + * Get the ETag of the policy configuration at the Product level. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param productId Product identifier. Must be unique in the current API Management service instance. + * @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 getEntityTagAsync(String resourceGroupName, String serviceName, String productId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(getEntityTagWithServiceResponseAsync(resourceGroupName, serviceName, productId), serviceCallback); + } + + /** + * Get the ETag of the policy configuration at the Product level. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param productId Product identifier. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public Observable getEntityTagAsync(String resourceGroupName, String serviceName, String productId) { + return getEntityTagWithServiceResponseAsync(resourceGroupName, serviceName, productId).map(new Func1, Void>() { + @Override + public Void call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Get the ETag of the policy configuration at the Product level. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param productId Product identifier. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public Observable> getEntityTagWithServiceResponseAsync(String resourceGroupName, String serviceName, String productId) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (productId == null) { + throw new IllegalArgumentException("Parameter productId is required and cannot be null."); + } + 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 policyId = "policy"; + return service.getEntityTag(resourceGroupName, serviceName, productId, policyId, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = getEntityTagDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponseWithHeaders getEntityTagDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .buildEmptyWithHeaders(response, ProductPolicyGetEntityTagHeaders.class); + } + + /** + * Get the policy configuration at the Product level. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param productId Product identifier. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PolicyContractInner object if successful. + */ + public PolicyContractInner get(String resourceGroupName, String serviceName, String productId) { + return getWithServiceResponseAsync(resourceGroupName, serviceName, productId).toBlocking().single().body(); + } + + /** + * Get the policy configuration at the Product level. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param productId Product identifier. Must be unique in the current API Management service instance. + * @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 getAsync(String resourceGroupName, String serviceName, String productId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(getWithServiceResponseAsync(resourceGroupName, serviceName, productId), serviceCallback); + } + + /** + * Get the policy configuration at the Product level. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param productId Product identifier. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PolicyContractInner object + */ + public Observable getAsync(String resourceGroupName, String serviceName, String productId) { + return getWithServiceResponseAsync(resourceGroupName, serviceName, productId).map(new Func1, PolicyContractInner>() { + @Override + public PolicyContractInner call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Get the policy configuration at the Product level. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param productId Product identifier. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PolicyContractInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String serviceName, String productId) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (productId == null) { + throw new IllegalArgumentException("Parameter productId is required and cannot be null."); + } + 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 policyId = "policy"; + final PolicyExportFormat format = null; + return service.get(resourceGroupName, serviceName, productId, policyId, this.client.subscriptionId(), format, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = getDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Get the policy configuration at the Product level. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param productId Product identifier. Must be unique in the current API Management service instance. + * @param format Policy Export Format. Possible values include: 'xml', 'rawxml' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PolicyContractInner object if successful. + */ + public PolicyContractInner get(String resourceGroupName, String serviceName, String productId, PolicyExportFormat format) { + return getWithServiceResponseAsync(resourceGroupName, serviceName, productId, format).toBlocking().single().body(); + } + + /** + * Get the policy configuration at the Product level. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param productId Product identifier. Must be unique in the current API Management service instance. + * @param format Policy Export Format. Possible values include: 'xml', 'rawxml' + * @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 getAsync(String resourceGroupName, String serviceName, String productId, PolicyExportFormat format, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(getWithServiceResponseAsync(resourceGroupName, serviceName, productId, format), serviceCallback); + } + + /** + * Get the policy configuration at the Product level. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param productId Product identifier. Must be unique in the current API Management service instance. + * @param format Policy Export Format. Possible values include: 'xml', 'rawxml' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PolicyContractInner object + */ + public Observable getAsync(String resourceGroupName, String serviceName, String productId, PolicyExportFormat format) { + return getWithServiceResponseAsync(resourceGroupName, serviceName, productId, format).map(new Func1, PolicyContractInner>() { + @Override + public PolicyContractInner call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Get the policy configuration at the Product level. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param productId Product identifier. Must be unique in the current API Management service instance. + * @param format Policy Export Format. Possible values include: 'xml', 'rawxml' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PolicyContractInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String serviceName, String productId, PolicyExportFormat format) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (productId == null) { + throw new IllegalArgumentException("Parameter productId is required and cannot be null."); + } + 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 policyId = "policy"; + return service.get(resourceGroupName, serviceName, productId, policyId, this.client.subscriptionId(), format, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = getDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponseWithHeaders getDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .buildWithHeaders(response, ProductPolicyGetHeaders.class); + } + + /** + * Creates or updates policy configuration for the Product. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param productId Product identifier. Must be unique in the current API Management service instance. + * @param parameters The policy contents to apply. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PolicyContractInner object if successful. + */ + public PolicyContractInner createOrUpdate(String resourceGroupName, String serviceName, String productId, PolicyContractInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serviceName, productId, parameters).toBlocking().single().body(); + } + + /** + * Creates or updates policy configuration for the Product. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param productId Product identifier. Must be unique in the current API Management service instance. + * @param parameters The policy contents to apply. + * @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 createOrUpdateAsync(String resourceGroupName, String serviceName, String productId, PolicyContractInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, serviceName, productId, parameters), serviceCallback); + } + + /** + * Creates or updates policy configuration for the Product. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param productId Product identifier. Must be unique in the current API Management service instance. + * @param parameters The policy contents to apply. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PolicyContractInner object + */ + public Observable createOrUpdateAsync(String resourceGroupName, String serviceName, String productId, PolicyContractInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serviceName, productId, parameters).map(new Func1, PolicyContractInner>() { + @Override + public PolicyContractInner call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Creates or updates policy configuration for the Product. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param productId Product identifier. Must be unique in the current API Management service instance. + * @param parameters The policy contents to apply. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PolicyContractInner object + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String serviceName, String productId, PolicyContractInner parameters) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (productId == null) { + throw new IllegalArgumentException("Parameter productId is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(parameters); + final String policyId = "policy"; + final String ifMatch = null; + return service.createOrUpdate(resourceGroupName, serviceName, productId, policyId, this.client.subscriptionId(), ifMatch, parameters, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = createOrUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Creates or updates policy configuration for the Product. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param productId Product identifier. Must be unique in the current API Management service instance. + * @param parameters The policy contents to apply. + * @param ifMatch ETag of the Entity. Not required when creating an entity, but required when updating an entity. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PolicyContractInner object if successful. + */ + public PolicyContractInner createOrUpdate(String resourceGroupName, String serviceName, String productId, PolicyContractInner parameters, String ifMatch) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serviceName, productId, parameters, ifMatch).toBlocking().single().body(); + } + + /** + * Creates or updates policy configuration for the Product. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param productId Product identifier. Must be unique in the current API Management service instance. + * @param parameters The policy contents to apply. + * @param ifMatch ETag of the Entity. Not required when creating an entity, but required when updating an entity. + * @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 createOrUpdateAsync(String resourceGroupName, String serviceName, String productId, PolicyContractInner parameters, String ifMatch, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, serviceName, productId, parameters, ifMatch), serviceCallback); + } + + /** + * Creates or updates policy configuration for the Product. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param productId Product identifier. Must be unique in the current API Management service instance. + * @param parameters The policy contents to apply. + * @param ifMatch ETag of the Entity. Not required when creating an entity, but required when updating an entity. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PolicyContractInner object + */ + public Observable createOrUpdateAsync(String resourceGroupName, String serviceName, String productId, PolicyContractInner parameters, String ifMatch) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serviceName, productId, parameters, ifMatch).map(new Func1, PolicyContractInner>() { + @Override + public PolicyContractInner call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Creates or updates policy configuration for the Product. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param productId Product identifier. Must be unique in the current API Management service instance. + * @param parameters The policy contents to apply. + * @param ifMatch ETag of the Entity. Not required when creating an entity, but required when updating an entity. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PolicyContractInner object + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String serviceName, String productId, PolicyContractInner parameters, String ifMatch) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (productId == null) { + throw new IllegalArgumentException("Parameter productId is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(parameters); + final String policyId = "policy"; + return service.createOrUpdate(resourceGroupName, serviceName, productId, policyId, this.client.subscriptionId(), ifMatch, parameters, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = createOrUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponseWithHeaders createOrUpdateDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(201, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .buildWithHeaders(response, ProductPolicyCreateOrUpdateHeaders.class); + } + + /** + * Deletes the policy configuration at the Product. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param productId Product identifier. Must be unique in the current API Management service instance. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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 serviceName, String productId, String ifMatch) { + deleteWithServiceResponseAsync(resourceGroupName, serviceName, productId, ifMatch).toBlocking().single().body(); + } + + /** + * Deletes the policy configuration at the Product. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param productId Product identifier. Must be unique in the current API Management service instance. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @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 serviceName, String productId, String ifMatch, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, serviceName, productId, ifMatch), serviceCallback); + } + + /** + * Deletes the policy configuration at the Product. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param productId Product identifier. Must be unique in the current API Management service instance. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable deleteAsync(String resourceGroupName, String serviceName, String productId, String ifMatch) { + return deleteWithServiceResponseAsync(resourceGroupName, serviceName, productId, ifMatch).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes the policy configuration at the Product. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param productId Product identifier. Must be unique in the current API Management service instance. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> deleteWithServiceResponseAsync(String resourceGroupName, String serviceName, String productId, String ifMatch) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (productId == null) { + throw new IllegalArgumentException("Parameter productId is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (ifMatch == null) { + throw new IllegalArgumentException("Parameter ifMatch 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 policyId = "policy"; + return service.delete(resourceGroupName, serviceName, productId, policyId, this.client.subscriptionId(), ifMatch, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = deleteDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse deleteDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(204, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ProductSubscriptionContractImpl.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ProductSubscriptionContractImpl.java new file mode 100644 index 0000000000000..ccd83cdd3e47f --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ProductSubscriptionContractImpl.java @@ -0,0 +1,112 @@ +/** + * 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.apimanagement.v2019_01_01.implementation; + +import com.microsoft.azure.management.apimanagement.v2019_01_01.ProductSubscriptionContract; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import rx.Observable; +import org.joda.time.DateTime; +import com.microsoft.azure.management.apimanagement.v2019_01_01.SubscriptionState; + +class ProductSubscriptionContractImpl extends WrapperImpl implements ProductSubscriptionContract { + private final ApiManagementManager manager; + + ProductSubscriptionContractImpl(SubscriptionContractInner inner, ApiManagementManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public ApiManagementManager manager() { + return this.manager; + } + + + + @Override + public Boolean allowTracing() { + return this.inner().allowTracing(); + } + + @Override + public DateTime createdDate() { + return this.inner().createdDate(); + } + + @Override + public String displayName() { + return this.inner().displayName(); + } + + @Override + public DateTime endDate() { + return this.inner().endDate(); + } + + @Override + public DateTime expirationDate() { + return this.inner().expirationDate(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public DateTime notificationDate() { + return this.inner().notificationDate(); + } + + @Override + public String ownerId() { + return this.inner().ownerId(); + } + + @Override + public String primaryKey() { + return this.inner().primaryKey(); + } + + @Override + public String scope() { + return this.inner().scope(); + } + + @Override + public String secondaryKey() { + return this.inner().secondaryKey(); + } + + @Override + public DateTime startDate() { + return this.inner().startDate(); + } + + @Override + public SubscriptionState state() { + return this.inner().state(); + } + + @Override + public String stateComment() { + return this.inner().stateComment(); + } + + @Override + public String type() { + return this.inner().type(); + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ProductSubscriptionsImpl.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ProductSubscriptionsImpl.java new file mode 100644 index 0000000000000..cea8adecdd218 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ProductSubscriptionsImpl.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.apimanagement.v2019_01_01.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.apimanagement.v2019_01_01.ProductSubscriptions; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.apimanagement.v2019_01_01.ProductSubscriptionContract; + +class ProductSubscriptionsImpl extends WrapperImpl implements ProductSubscriptions { + private final ApiManagementManager manager; + + ProductSubscriptionsImpl(ApiManagementManager manager) { + super(manager.inner().productSubscriptions()); + this.manager = manager; + } + + public ApiManagementManager manager() { + return this.manager; + } + + private ProductSubscriptionContractImpl wrapModel(SubscriptionContractInner inner) { + return new ProductSubscriptionContractImpl(inner, manager()); + } + + @Override + public Observable listAsync(final String resourceGroupName, final String serviceName, final String productId) { + ProductSubscriptionsInner client = this.inner(); + return client.listAsync(resourceGroupName, serviceName, productId) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public ProductSubscriptionContract call(SubscriptionContractInner inner) { + return wrapModel(inner); + } + }); + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ProductSubscriptionsInner.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ProductSubscriptionsInner.java new file mode 100644 index 0000000000000..f2996e7029991 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ProductSubscriptionsInner.java @@ -0,0 +1,453 @@ +/** + * 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.apimanagement.v2019_01_01.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.apimanagement.v2019_01_01.ErrorResponseException; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Path; +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 ProductSubscriptions. + */ +public class ProductSubscriptionsInner { + /** The Retrofit service to perform REST calls. */ + private ProductSubscriptionsService service; + /** The service client containing this operation class. */ + private ApiManagementClientImpl client; + + /** + * Initializes an instance of ProductSubscriptionsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public ProductSubscriptionsInner(Retrofit retrofit, ApiManagementClientImpl client) { + this.service = retrofit.create(ProductSubscriptionsService.class); + this.client = client; + } + + /** + * The interface defining all the services for ProductSubscriptions to be + * used by Retrofit to perform actually REST calls. + */ + interface ProductSubscriptionsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.apimanagement.v2019_01_01.ProductSubscriptions list" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/subscriptions") + Observable> list(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("productId") String productId, @Path("subscriptionId") String subscriptionId, @Query("$filter") String filter, @Query("$top") Integer top, @Query("$skip") Integer skip, @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.apimanagement.v2019_01_01.ProductSubscriptions listNext" }) + @GET + Observable> listNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Lists the collection of subscriptions to the specified product. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param productId Product identifier. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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<SubscriptionContractInner> object if successful. + */ + public PagedList list(final String resourceGroupName, final String serviceName, final String productId) { + ServiceResponse> response = listSinglePageAsync(resourceGroupName, serviceName, productId).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the collection of subscriptions to the specified product. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param productId Product identifier. Must be unique in the current API Management service instance. + * @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 resourceGroupName, final String serviceName, final String productId, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(resourceGroupName, serviceName, productId), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the collection of subscriptions to the specified product. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param productId Product identifier. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<SubscriptionContractInner> object + */ + public Observable> listAsync(final String resourceGroupName, final String serviceName, final String productId) { + return listWithServiceResponseAsync(resourceGroupName, serviceName, productId) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the collection of subscriptions to the specified product. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param productId Product identifier. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<SubscriptionContractInner> object + */ + public Observable>> listWithServiceResponseAsync(final String resourceGroupName, final String serviceName, final String productId) { + return listSinglePageAsync(resourceGroupName, serviceName, productId) + .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 collection of subscriptions to the specified product. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param productId Product identifier. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<SubscriptionContractInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync(final String resourceGroupName, final String serviceName, final String productId) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (productId == null) { + throw new IllegalArgumentException("Parameter productId is required and cannot be null."); + } + 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 filter = null; + final Integer top = null; + final Integer skip = null; + return service.list(resourceGroupName, serviceName, productId, this.client.subscriptionId(), filter, top, skip, this.client.apiVersion(), 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 collection of subscriptions to the specified product. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param productId Product identifier. Must be unique in the current API Management service instance. + * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| stateComment | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| ownerId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| scope | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| userId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| productId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| state | filter | eq | | </br>| user | expand | | | </br> + * @param top Number of records to return. + * @param skip Number of records to skip. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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<SubscriptionContractInner> object if successful. + */ + public PagedList list(final String resourceGroupName, final String serviceName, final String productId, final String filter, final Integer top, final Integer skip) { + ServiceResponse> response = listSinglePageAsync(resourceGroupName, serviceName, productId, filter, top, skip).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the collection of subscriptions to the specified product. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param productId Product identifier. Must be unique in the current API Management service instance. + * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| stateComment | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| ownerId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| scope | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| userId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| productId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| state | filter | eq | | </br>| user | expand | | | </br> + * @param top Number of records to return. + * @param skip Number of records to skip. + * @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 resourceGroupName, final String serviceName, final String productId, final String filter, final Integer top, final Integer skip, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(resourceGroupName, serviceName, productId, filter, top, skip), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the collection of subscriptions to the specified product. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param productId Product identifier. Must be unique in the current API Management service instance. + * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| stateComment | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| ownerId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| scope | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| userId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| productId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| state | filter | eq | | </br>| user | expand | | | </br> + * @param top Number of records to return. + * @param skip Number of records to skip. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<SubscriptionContractInner> object + */ + public Observable> listAsync(final String resourceGroupName, final String serviceName, final String productId, final String filter, final Integer top, final Integer skip) { + return listWithServiceResponseAsync(resourceGroupName, serviceName, productId, filter, top, skip) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the collection of subscriptions to the specified product. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param productId Product identifier. Must be unique in the current API Management service instance. + * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| stateComment | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| ownerId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| scope | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| userId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| productId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| state | filter | eq | | </br>| user | expand | | | </br> + * @param top Number of records to return. + * @param skip Number of records to skip. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<SubscriptionContractInner> object + */ + public Observable>> listWithServiceResponseAsync(final String resourceGroupName, final String serviceName, final String productId, final String filter, final Integer top, final Integer skip) { + return listSinglePageAsync(resourceGroupName, serviceName, productId, filter, top, skip) + .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 collection of subscriptions to the specified product. + * + ServiceResponse> * @param resourceGroupName The name of the resource group. + ServiceResponse> * @param serviceName The name of the API Management service. + ServiceResponse> * @param productId Product identifier. Must be unique in the current API Management service instance. + ServiceResponse> * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| stateComment | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| ownerId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| scope | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| userId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| productId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| state | filter | eq | | </br>| user | expand | | | </br> + ServiceResponse> * @param top Number of records to return. + ServiceResponse> * @param skip Number of records to skip. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<SubscriptionContractInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync(final String resourceGroupName, final String serviceName, final String productId, final String filter, final Integer top, final Integer skip) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (productId == null) { + throw new IllegalArgumentException("Parameter productId is required and cannot be null."); + } + 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(resourceGroupName, serviceName, productId, this.client.subscriptionId(), filter, top, skip, this.client.apiVersion(), 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 ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists the collection of subscriptions to the specified product. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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<SubscriptionContractInner> 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 collection of subscriptions to the specified product. + * + * @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 collection of subscriptions to the specified product. + * + * @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<SubscriptionContractInner> 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 collection of subscriptions to the specified product. + * + * @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<SubscriptionContractInner> 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 collection of subscriptions to the specified product. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<SubscriptionContractInner> 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 ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ProductsImpl.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ProductsImpl.java new file mode 100644 index 0000000000000..30382d9811c39 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ProductsImpl.java @@ -0,0 +1,106 @@ +/** + * 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. + * jkl + */ + +package com.microsoft.azure.management.apimanagement.v2019_01_01.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.apimanagement.v2019_01_01.Products; +import rx.Completable; +import rx.functions.Func1; +import rx.Observable; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.apimanagement.v2019_01_01.ApiProductContract; +import com.microsoft.azure.management.apimanagement.v2019_01_01.TagResourceContract; + +class ProductsImpl extends WrapperImpl implements Products { + private final ApiManagementManager manager; + + ProductsImpl(ApiManagementManager manager) { + super(manager.inner().products()); + this.manager = manager; + } + + public ApiManagementManager manager() { + return this.manager; + } + + @Override + public ProductContractImpl define(String name) { + return wrapModel(name); + } + + private ProductContractImpl wrapModel(ProductContractInner inner) { + return new ProductContractImpl(inner, manager()); + } + + private ProductContractImpl wrapModel(String name) { + return new ProductContractImpl(name, this.manager()); + } + + @Override + public Observable listByServiceAsync(final String resourceGroupName, final String serviceName) { + ProductsInner client = this.inner(); + return client.listByServiceAsync(resourceGroupName, serviceName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public ApiProductContract call(ProductContractInner inner) { + return new ApiProductContractImpl(inner, manager()); + } + }); + } + + @Override + public Completable getEntityTagAsync(String resourceGroupName, String serviceName, String productId) { + ProductsInner client = this.inner(); + return client.getEntityTagAsync(resourceGroupName, serviceName, productId).toCompletable(); + } + + @Override + public Observable getAsync(String resourceGroupName, String serviceName, String productId) { + ProductsInner client = this.inner(); + return client.getAsync(resourceGroupName, serviceName, productId) + .map(new Func1() { + @Override + public ApiProductContract call(ProductContractInner inner) { + return new ApiProductContractImpl(inner, manager()); + } + }); + } + + @Override + public Completable deleteAsync(String resourceGroupName, String serviceName, String productId, String ifMatch) { + ProductsInner client = this.inner(); + return client.deleteAsync(resourceGroupName, serviceName, productId, ifMatch).toCompletable(); + } + + @Override + public Observable listByTagsAsync(final String resourceGroupName, final String serviceName) { + ProductsInner client = this.inner(); + return client.listByTagsAsync(resourceGroupName, serviceName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public TagResourceContract call(TagResourceContractInner inner) { + return new TagResourceContractImpl(inner, manager()); + } + }); + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ProductsInner.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ProductsInner.java new file mode 100644 index 0000000000000..7bbfe3641560d --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ProductsInner.java @@ -0,0 +1,1553 @@ +/** + * 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.apimanagement.v2019_01_01.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.apimanagement.v2019_01_01.ErrorResponseException; +import com.microsoft.azure.management.apimanagement.v2019_01_01.ProductCreateOrUpdateHeaders; +import com.microsoft.azure.management.apimanagement.v2019_01_01.ProductGetEntityTagHeaders; +import com.microsoft.azure.management.apimanagement.v2019_01_01.ProductGetHeaders; +import com.microsoft.azure.management.apimanagement.v2019_01_01.ProductUpdateParameters; +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.ServiceResponseWithHeaders; +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.HEAD; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.HTTP; +import retrofit2.http.PATCH; +import retrofit2.http.Path; +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 Products. + */ +public class ProductsInner { + /** The Retrofit service to perform REST calls. */ + private ProductsService service; + /** The service client containing this operation class. */ + private ApiManagementClientImpl client; + + /** + * Initializes an instance of ProductsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public ProductsInner(Retrofit retrofit, ApiManagementClientImpl client) { + this.service = retrofit.create(ProductsService.class); + this.client = client; + } + + /** + * The interface defining all the services for Products to be + * used by Retrofit to perform actually REST calls. + */ + interface ProductsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.apimanagement.v2019_01_01.Products listByService" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products") + Observable> listByService(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("subscriptionId") String subscriptionId, @Query("$filter") String filter, @Query("$top") Integer top, @Query("$skip") Integer skip, @Query("expandGroups") Boolean expandGroups, @Query("tags") String tags, @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.apimanagement.v2019_01_01.Products getEntityTag" }) + @HEAD("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}") + Observable> getEntityTag(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("productId") String productId, @Path("subscriptionId") String subscriptionId, @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.apimanagement.v2019_01_01.Products get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}") + Observable> get(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("productId") String productId, @Path("subscriptionId") String subscriptionId, @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.apimanagement.v2019_01_01.Products createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}") + Observable> createOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("productId") String productId, @Path("subscriptionId") String subscriptionId, @Body ProductContractInner parameters, @Header("If-Match") String ifMatch, @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.apimanagement.v2019_01_01.Products update" }) + @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}") + Observable> update(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("productId") String productId, @Path("subscriptionId") String subscriptionId, @Body ProductUpdateParameters parameters, @Header("If-Match") String ifMatch, @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.apimanagement.v2019_01_01.Products delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}", method = "DELETE", hasBody = true) + Observable> delete(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("productId") String productId, @Path("subscriptionId") String subscriptionId, @Header("If-Match") String ifMatch, @Query("deleteSubscriptions") Boolean deleteSubscriptions, @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.apimanagement.v2019_01_01.Products listByTags" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/productsByTags") + Observable> listByTags(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("subscriptionId") String subscriptionId, @Query("$filter") String filter, @Query("$top") Integer top, @Query("$skip") Integer skip, @Query("includeNotTaggedProducts") Boolean includeNotTaggedProducts, @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.apimanagement.v2019_01_01.Products listByServiceNext" }) + @GET + Observable> listByServiceNext(@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.apimanagement.v2019_01_01.Products listByTagsNext" }) + @GET + Observable> listByTagsNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Lists a collection of products in the specified service instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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<ProductContractInner> object if successful. + */ + public PagedList listByService(final String resourceGroupName, final String serviceName) { + ServiceResponse> response = listByServiceSinglePageAsync(resourceGroupName, serviceName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByServiceNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists a collection of products in the specified service instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @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> listByServiceAsync(final String resourceGroupName, final String serviceName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByServiceSinglePageAsync(resourceGroupName, serviceName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByServiceNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists a collection of products in the specified service instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ProductContractInner> object + */ + public Observable> listByServiceAsync(final String resourceGroupName, final String serviceName) { + return listByServiceWithServiceResponseAsync(resourceGroupName, serviceName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists a collection of products in the specified service instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ProductContractInner> object + */ + public Observable>> listByServiceWithServiceResponseAsync(final String resourceGroupName, final String serviceName) { + return listByServiceSinglePageAsync(resourceGroupName, serviceName) + .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(listByServiceNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists a collection of products in the specified service instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ProductContractInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByServiceSinglePageAsync(final String resourceGroupName, final String serviceName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + 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 filter = null; + final Integer top = null; + final Integer skip = null; + final Boolean expandGroups = null; + final String tags = null; + return service.listByService(resourceGroupName, serviceName, this.client.subscriptionId(), filter, top, skip, expandGroups, tags, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByServiceDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Lists a collection of products in the specified service instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| terms | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| state | filter | eq | | </br>| groups | expand | | | </br> + * @param top Number of records to return. + * @param skip Number of records to skip. + * @param expandGroups When set to true, the response contains an array of groups that have visibility to the product. The default is false. + * @param tags Products which are part of a specific tag. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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<ProductContractInner> object if successful. + */ + public PagedList listByService(final String resourceGroupName, final String serviceName, final String filter, final Integer top, final Integer skip, final Boolean expandGroups, final String tags) { + ServiceResponse> response = listByServiceSinglePageAsync(resourceGroupName, serviceName, filter, top, skip, expandGroups, tags).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByServiceNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists a collection of products in the specified service instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| terms | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| state | filter | eq | | </br>| groups | expand | | | </br> + * @param top Number of records to return. + * @param skip Number of records to skip. + * @param expandGroups When set to true, the response contains an array of groups that have visibility to the product. The default is false. + * @param tags Products which are part of a specific tag. + * @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> listByServiceAsync(final String resourceGroupName, final String serviceName, final String filter, final Integer top, final Integer skip, final Boolean expandGroups, final String tags, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByServiceSinglePageAsync(resourceGroupName, serviceName, filter, top, skip, expandGroups, tags), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByServiceNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists a collection of products in the specified service instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| terms | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| state | filter | eq | | </br>| groups | expand | | | </br> + * @param top Number of records to return. + * @param skip Number of records to skip. + * @param expandGroups When set to true, the response contains an array of groups that have visibility to the product. The default is false. + * @param tags Products which are part of a specific tag. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ProductContractInner> object + */ + public Observable> listByServiceAsync(final String resourceGroupName, final String serviceName, final String filter, final Integer top, final Integer skip, final Boolean expandGroups, final String tags) { + return listByServiceWithServiceResponseAsync(resourceGroupName, serviceName, filter, top, skip, expandGroups, tags) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists a collection of products in the specified service instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| terms | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| state | filter | eq | | </br>| groups | expand | | | </br> + * @param top Number of records to return. + * @param skip Number of records to skip. + * @param expandGroups When set to true, the response contains an array of groups that have visibility to the product. The default is false. + * @param tags Products which are part of a specific tag. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ProductContractInner> object + */ + public Observable>> listByServiceWithServiceResponseAsync(final String resourceGroupName, final String serviceName, final String filter, final Integer top, final Integer skip, final Boolean expandGroups, final String tags) { + return listByServiceSinglePageAsync(resourceGroupName, serviceName, filter, top, skip, expandGroups, tags) + .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(listByServiceNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists a collection of products in the specified service instance. + * + ServiceResponse> * @param resourceGroupName The name of the resource group. + ServiceResponse> * @param serviceName The name of the API Management service. + ServiceResponse> * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| terms | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| state | filter | eq | | </br>| groups | expand | | | </br> + ServiceResponse> * @param top Number of records to return. + ServiceResponse> * @param skip Number of records to skip. + ServiceResponse> * @param expandGroups When set to true, the response contains an array of groups that have visibility to the product. The default is false. + ServiceResponse> * @param tags Products which are part of a specific tag. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ProductContractInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByServiceSinglePageAsync(final String resourceGroupName, final String serviceName, final String filter, final Integer top, final Integer skip, final Boolean expandGroups, final String tags) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + 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.listByService(resourceGroupName, serviceName, this.client.subscriptionId(), filter, top, skip, expandGroups, tags, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByServiceDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByServiceDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Gets the entity state (Etag) version of the product specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param productId Product identifier. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void getEntityTag(String resourceGroupName, String serviceName, String productId) { + getEntityTagWithServiceResponseAsync(resourceGroupName, serviceName, productId).toBlocking().single().body(); + } + + /** + * Gets the entity state (Etag) version of the product specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param productId Product identifier. Must be unique in the current API Management service instance. + * @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 getEntityTagAsync(String resourceGroupName, String serviceName, String productId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(getEntityTagWithServiceResponseAsync(resourceGroupName, serviceName, productId), serviceCallback); + } + + /** + * Gets the entity state (Etag) version of the product specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param productId Product identifier. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public Observable getEntityTagAsync(String resourceGroupName, String serviceName, String productId) { + return getEntityTagWithServiceResponseAsync(resourceGroupName, serviceName, productId).map(new Func1, Void>() { + @Override + public Void call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Gets the entity state (Etag) version of the product specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param productId Product identifier. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public Observable> getEntityTagWithServiceResponseAsync(String resourceGroupName, String serviceName, String productId) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (productId == null) { + throw new IllegalArgumentException("Parameter productId is required and cannot be null."); + } + 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.getEntityTag(resourceGroupName, serviceName, productId, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = getEntityTagDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponseWithHeaders getEntityTagDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .buildEmptyWithHeaders(response, ProductGetEntityTagHeaders.class); + } + + /** + * Gets the details of the product specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param productId Product identifier. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ProductContractInner object if successful. + */ + public ProductContractInner get(String resourceGroupName, String serviceName, String productId) { + return getWithServiceResponseAsync(resourceGroupName, serviceName, productId).toBlocking().single().body(); + } + + /** + * Gets the details of the product specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param productId Product identifier. Must be unique in the current API Management service instance. + * @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 getAsync(String resourceGroupName, String serviceName, String productId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(getWithServiceResponseAsync(resourceGroupName, serviceName, productId), serviceCallback); + } + + /** + * Gets the details of the product specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param productId Product identifier. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ProductContractInner object + */ + public Observable getAsync(String resourceGroupName, String serviceName, String productId) { + return getWithServiceResponseAsync(resourceGroupName, serviceName, productId).map(new Func1, ProductContractInner>() { + @Override + public ProductContractInner call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Gets the details of the product specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param productId Product identifier. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ProductContractInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String serviceName, String productId) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (productId == null) { + throw new IllegalArgumentException("Parameter productId is required and cannot be null."); + } + 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.get(resourceGroupName, serviceName, productId, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = getDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponseWithHeaders getDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .buildWithHeaders(response, ProductGetHeaders.class); + } + + /** + * Creates or Updates a product. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param productId Product identifier. Must be unique in the current API Management service instance. + * @param parameters Create or update parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ProductContractInner object if successful. + */ + public ProductContractInner createOrUpdate(String resourceGroupName, String serviceName, String productId, ProductContractInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serviceName, productId, parameters).toBlocking().single().body(); + } + + /** + * Creates or Updates a product. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param productId Product identifier. Must be unique in the current API Management service instance. + * @param parameters Create or update parameters. + * @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 createOrUpdateAsync(String resourceGroupName, String serviceName, String productId, ProductContractInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, serviceName, productId, parameters), serviceCallback); + } + + /** + * Creates or Updates a product. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param productId Product identifier. Must be unique in the current API Management service instance. + * @param parameters Create or update parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ProductContractInner object + */ + public Observable createOrUpdateAsync(String resourceGroupName, String serviceName, String productId, ProductContractInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serviceName, productId, parameters).map(new Func1, ProductContractInner>() { + @Override + public ProductContractInner call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Creates or Updates a product. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param productId Product identifier. Must be unique in the current API Management service instance. + * @param parameters Create or update parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ProductContractInner object + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String serviceName, String productId, ProductContractInner parameters) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (productId == null) { + throw new IllegalArgumentException("Parameter productId is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(parameters); + final String ifMatch = null; + return service.createOrUpdate(resourceGroupName, serviceName, productId, this.client.subscriptionId(), parameters, ifMatch, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = createOrUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Creates or Updates a product. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param productId Product identifier. Must be unique in the current API Management service instance. + * @param parameters Create or update parameters. + * @param ifMatch ETag of the Entity. Not required when creating an entity, but required when updating an entity. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ProductContractInner object if successful. + */ + public ProductContractInner createOrUpdate(String resourceGroupName, String serviceName, String productId, ProductContractInner parameters, String ifMatch) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serviceName, productId, parameters, ifMatch).toBlocking().single().body(); + } + + /** + * Creates or Updates a product. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param productId Product identifier. Must be unique in the current API Management service instance. + * @param parameters Create or update parameters. + * @param ifMatch ETag of the Entity. Not required when creating an entity, but required when updating an entity. + * @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 createOrUpdateAsync(String resourceGroupName, String serviceName, String productId, ProductContractInner parameters, String ifMatch, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, serviceName, productId, parameters, ifMatch), serviceCallback); + } + + /** + * Creates or Updates a product. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param productId Product identifier. Must be unique in the current API Management service instance. + * @param parameters Create or update parameters. + * @param ifMatch ETag of the Entity. Not required when creating an entity, but required when updating an entity. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ProductContractInner object + */ + public Observable createOrUpdateAsync(String resourceGroupName, String serviceName, String productId, ProductContractInner parameters, String ifMatch) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serviceName, productId, parameters, ifMatch).map(new Func1, ProductContractInner>() { + @Override + public ProductContractInner call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Creates or Updates a product. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param productId Product identifier. Must be unique in the current API Management service instance. + * @param parameters Create or update parameters. + * @param ifMatch ETag of the Entity. Not required when creating an entity, but required when updating an entity. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ProductContractInner object + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String serviceName, String productId, ProductContractInner parameters, String ifMatch) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (productId == null) { + throw new IllegalArgumentException("Parameter productId is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(parameters); + return service.createOrUpdate(resourceGroupName, serviceName, productId, this.client.subscriptionId(), parameters, ifMatch, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = createOrUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponseWithHeaders createOrUpdateDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(201, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .buildWithHeaders(response, ProductCreateOrUpdateHeaders.class); + } + + /** + * Update existing product details. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param productId Product identifier. Must be unique in the current API Management service instance. + * @param parameters Update parameters. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void update(String resourceGroupName, String serviceName, String productId, ProductUpdateParameters parameters, String ifMatch) { + updateWithServiceResponseAsync(resourceGroupName, serviceName, productId, parameters, ifMatch).toBlocking().single().body(); + } + + /** + * Update existing product details. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param productId Product identifier. Must be unique in the current API Management service instance. + * @param parameters Update parameters. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @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 serviceName, String productId, ProductUpdateParameters parameters, String ifMatch, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateWithServiceResponseAsync(resourceGroupName, serviceName, productId, parameters, ifMatch), serviceCallback); + } + + /** + * Update existing product details. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param productId Product identifier. Must be unique in the current API Management service instance. + * @param parameters Update parameters. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable updateAsync(String resourceGroupName, String serviceName, String productId, ProductUpdateParameters parameters, String ifMatch) { + return updateWithServiceResponseAsync(resourceGroupName, serviceName, productId, parameters, ifMatch).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Update existing product details. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param productId Product identifier. Must be unique in the current API Management service instance. + * @param parameters Update parameters. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> updateWithServiceResponseAsync(String resourceGroupName, String serviceName, String productId, ProductUpdateParameters parameters, String ifMatch) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (productId == null) { + throw new IllegalArgumentException("Parameter productId is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + if (ifMatch == null) { + throw new IllegalArgumentException("Parameter ifMatch is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(parameters); + return service.update(resourceGroupName, serviceName, productId, this.client.subscriptionId(), parameters, ifMatch, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = updateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse updateDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(204, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Delete product. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param productId Product identifier. Must be unique in the current API Management service instance. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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 serviceName, String productId, String ifMatch) { + deleteWithServiceResponseAsync(resourceGroupName, serviceName, productId, ifMatch).toBlocking().single().body(); + } + + /** + * Delete product. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param productId Product identifier. Must be unique in the current API Management service instance. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @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 serviceName, String productId, String ifMatch, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, serviceName, productId, ifMatch), serviceCallback); + } + + /** + * Delete product. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param productId Product identifier. Must be unique in the current API Management service instance. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable deleteAsync(String resourceGroupName, String serviceName, String productId, String ifMatch) { + return deleteWithServiceResponseAsync(resourceGroupName, serviceName, productId, ifMatch).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Delete product. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param productId Product identifier. Must be unique in the current API Management service instance. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> deleteWithServiceResponseAsync(String resourceGroupName, String serviceName, String productId, String ifMatch) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (productId == null) { + throw new IllegalArgumentException("Parameter productId is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (ifMatch == null) { + throw new IllegalArgumentException("Parameter ifMatch 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 Boolean deleteSubscriptions = null; + return service.delete(resourceGroupName, serviceName, productId, this.client.subscriptionId(), ifMatch, deleteSubscriptions, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = deleteDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Delete product. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param productId Product identifier. Must be unique in the current API Management service instance. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @param deleteSubscriptions Delete existing subscriptions associated with the product or not. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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 serviceName, String productId, String ifMatch, Boolean deleteSubscriptions) { + deleteWithServiceResponseAsync(resourceGroupName, serviceName, productId, ifMatch, deleteSubscriptions).toBlocking().single().body(); + } + + /** + * Delete product. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param productId Product identifier. Must be unique in the current API Management service instance. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @param deleteSubscriptions Delete existing subscriptions associated with the product or not. + * @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 serviceName, String productId, String ifMatch, Boolean deleteSubscriptions, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, serviceName, productId, ifMatch, deleteSubscriptions), serviceCallback); + } + + /** + * Delete product. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param productId Product identifier. Must be unique in the current API Management service instance. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @param deleteSubscriptions Delete existing subscriptions associated with the product or not. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable deleteAsync(String resourceGroupName, String serviceName, String productId, String ifMatch, Boolean deleteSubscriptions) { + return deleteWithServiceResponseAsync(resourceGroupName, serviceName, productId, ifMatch, deleteSubscriptions).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Delete product. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param productId Product identifier. Must be unique in the current API Management service instance. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @param deleteSubscriptions Delete existing subscriptions associated with the product or not. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> deleteWithServiceResponseAsync(String resourceGroupName, String serviceName, String productId, String ifMatch, Boolean deleteSubscriptions) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (productId == null) { + throw new IllegalArgumentException("Parameter productId is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (ifMatch == null) { + throw new IllegalArgumentException("Parameter ifMatch 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.delete(resourceGroupName, serviceName, productId, this.client.subscriptionId(), ifMatch, deleteSubscriptions, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = deleteDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse deleteDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(204, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists a collection of products associated with tags. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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<TagResourceContractInner> object if successful. + */ + public PagedList listByTags(final String resourceGroupName, final String serviceName) { + ServiceResponse> response = listByTagsSinglePageAsync(resourceGroupName, serviceName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByTagsNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists a collection of products associated with tags. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @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> listByTagsAsync(final String resourceGroupName, final String serviceName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByTagsSinglePageAsync(resourceGroupName, serviceName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByTagsNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists a collection of products associated with tags. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<TagResourceContractInner> object + */ + public Observable> listByTagsAsync(final String resourceGroupName, final String serviceName) { + return listByTagsWithServiceResponseAsync(resourceGroupName, serviceName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists a collection of products associated with tags. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<TagResourceContractInner> object + */ + public Observable>> listByTagsWithServiceResponseAsync(final String resourceGroupName, final String serviceName) { + return listByTagsSinglePageAsync(resourceGroupName, serviceName) + .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(listByTagsNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists a collection of products associated with tags. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<TagResourceContractInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByTagsSinglePageAsync(final String resourceGroupName, final String serviceName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + 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 filter = null; + final Integer top = null; + final Integer skip = null; + final Boolean includeNotTaggedProducts = null; + return service.listByTags(resourceGroupName, serviceName, this.client.subscriptionId(), filter, top, skip, includeNotTaggedProducts, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByTagsDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Lists a collection of products associated with tags. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| terms | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| state | filter | eq | substringof, contains, startswith, endswith | </br> + * @param top Number of records to return. + * @param skip Number of records to skip. + * @param includeNotTaggedProducts Include not tagged Products. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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<TagResourceContractInner> object if successful. + */ + public PagedList listByTags(final String resourceGroupName, final String serviceName, final String filter, final Integer top, final Integer skip, final Boolean includeNotTaggedProducts) { + ServiceResponse> response = listByTagsSinglePageAsync(resourceGroupName, serviceName, filter, top, skip, includeNotTaggedProducts).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByTagsNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists a collection of products associated with tags. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| terms | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| state | filter | eq | substringof, contains, startswith, endswith | </br> + * @param top Number of records to return. + * @param skip Number of records to skip. + * @param includeNotTaggedProducts Include not tagged Products. + * @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> listByTagsAsync(final String resourceGroupName, final String serviceName, final String filter, final Integer top, final Integer skip, final Boolean includeNotTaggedProducts, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByTagsSinglePageAsync(resourceGroupName, serviceName, filter, top, skip, includeNotTaggedProducts), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByTagsNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists a collection of products associated with tags. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| terms | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| state | filter | eq | substringof, contains, startswith, endswith | </br> + * @param top Number of records to return. + * @param skip Number of records to skip. + * @param includeNotTaggedProducts Include not tagged Products. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<TagResourceContractInner> object + */ + public Observable> listByTagsAsync(final String resourceGroupName, final String serviceName, final String filter, final Integer top, final Integer skip, final Boolean includeNotTaggedProducts) { + return listByTagsWithServiceResponseAsync(resourceGroupName, serviceName, filter, top, skip, includeNotTaggedProducts) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists a collection of products associated with tags. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| terms | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| state | filter | eq | substringof, contains, startswith, endswith | </br> + * @param top Number of records to return. + * @param skip Number of records to skip. + * @param includeNotTaggedProducts Include not tagged Products. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<TagResourceContractInner> object + */ + public Observable>> listByTagsWithServiceResponseAsync(final String resourceGroupName, final String serviceName, final String filter, final Integer top, final Integer skip, final Boolean includeNotTaggedProducts) { + return listByTagsSinglePageAsync(resourceGroupName, serviceName, filter, top, skip, includeNotTaggedProducts) + .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(listByTagsNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists a collection of products associated with tags. + * + ServiceResponse> * @param resourceGroupName The name of the resource group. + ServiceResponse> * @param serviceName The name of the API Management service. + ServiceResponse> * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| terms | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| state | filter | eq | substringof, contains, startswith, endswith | </br> + ServiceResponse> * @param top Number of records to return. + ServiceResponse> * @param skip Number of records to skip. + ServiceResponse> * @param includeNotTaggedProducts Include not tagged Products. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<TagResourceContractInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByTagsSinglePageAsync(final String resourceGroupName, final String serviceName, final String filter, final Integer top, final Integer skip, final Boolean includeNotTaggedProducts) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + 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.listByTags(resourceGroupName, serviceName, this.client.subscriptionId(), filter, top, skip, includeNotTaggedProducts, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByTagsDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByTagsDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists a collection of products in the specified service instance. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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<ProductContractInner> object if successful. + */ + public PagedList listByServiceNext(final String nextPageLink) { + ServiceResponse> response = listByServiceNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByServiceNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists a collection of products in the specified service instance. + * + * @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> listByServiceNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByServiceNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByServiceNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists a collection of products in the specified service instance. + * + * @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<ProductContractInner> object + */ + public Observable> listByServiceNextAsync(final String nextPageLink) { + return listByServiceNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists a collection of products in the specified service instance. + * + * @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<ProductContractInner> object + */ + public Observable>> listByServiceNextWithServiceResponseAsync(final String nextPageLink) { + return listByServiceNextSinglePageAsync(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(listByServiceNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists a collection of products in the specified service instance. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ProductContractInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByServiceNextSinglePageAsync(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.listByServiceNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByServiceNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByServiceNextDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists a collection of products associated with tags. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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<TagResourceContractInner> object if successful. + */ + public PagedList listByTagsNext(final String nextPageLink) { + ServiceResponse> response = listByTagsNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByTagsNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists a collection of products associated with tags. + * + * @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> listByTagsNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByTagsNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByTagsNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists a collection of products associated with tags. + * + * @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<TagResourceContractInner> object + */ + public Observable> listByTagsNextAsync(final String nextPageLink) { + return listByTagsNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists a collection of products associated with tags. + * + * @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<TagResourceContractInner> object + */ + public Observable>> listByTagsNextWithServiceResponseAsync(final String nextPageLink) { + return listByTagsNextSinglePageAsync(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(listByTagsNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists a collection of products associated with tags. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<TagResourceContractInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByTagsNextSinglePageAsync(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.listByTagsNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByTagsNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByTagsNextDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/PropertyContractImpl.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/PropertyContractImpl.java new file mode 100644 index 0000000000000..30e4168d5d391 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/PropertyContractImpl.java @@ -0,0 +1,157 @@ +/** + * 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.apimanagement.v2019_01_01.implementation; + +import com.microsoft.azure.management.apimanagement.v2019_01_01.PropertyContract; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import java.util.List; + +class PropertyContractImpl extends CreatableUpdatableImpl implements PropertyContract, PropertyContract.Definition, PropertyContract.Update { + private String resourceGroupName; + private String serviceName; + private String propId; + private String cifMatch; + private String uifMatch; + private final ApiManagementManager manager; + + PropertyContractImpl(String name, ApiManagementManager manager) { + super(name, new PropertyContractInner()); + this.manager = manager; + // Set resource name + this.propId = name; + // + } + + PropertyContractImpl(PropertyContractInner inner, ApiManagementManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.propId = inner.name(); + // set resource ancestor and positional variables + this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourceGroups"); + this.serviceName = IdParsingUtils.getValueFromIdByName(inner.id(), "service"); + this.propId = IdParsingUtils.getValueFromIdByName(inner.id(), "properties"); + // set other parameters for create and update + } + + @Override + public ApiManagementManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + PropertysInner client = this.manager().inner().propertys(); + return client.createOrUpdateAsync(this.resourceGroupName, this.serviceName, this.propId, this.inner(), this.cifMatch) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + PropertysInner client = this.manager().inner().propertys(); + return client.createOrUpdateAsync(this.resourceGroupName, this.serviceName, this.propId, this.inner(), this.uifMatch) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + PropertysInner client = this.manager().inner().propertys(); + return null; // NOP getInnerAsync implementation as get is not supported + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + + @Override + public String displayName() { + return this.inner().displayName(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public Boolean secret() { + return this.inner().secret(); + } + + @Override + public List tags() { + return this.inner().tags(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public String value() { + return this.inner().value(); + } + + @Override + public PropertyContractImpl withResourceGroupName(String resourceGroupName) { + this.resourceGroupName = resourceGroupName; + return this; + } + + @Override + public PropertyContractImpl withServiceName(String serviceName) { + this.serviceName = serviceName; + return this; + } + + @Override + public PropertyContractImpl withDisplayName(String displayName) { + this.inner().withDisplayName(displayName); + return this; + } + + @Override + public PropertyContractImpl withValue(String value) { + this.inner().withValue(value); + return this; + } + + @Override + public PropertyContractImpl withIfMatch(String ifMatch) { + if (isInCreateMode()) { + this.cifMatch = ifMatch; + } else { + this.uifMatch = ifMatch; + } + return this; + } + + @Override + public PropertyContractImpl withSecret(Boolean secret) { + this.inner().withSecret(secret); + return this; + } + + @Override + public PropertyContractImpl withTags(List tags) { + this.inner().withTags(tags); + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/PropertyContractInner.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/PropertyContractInner.java new file mode 100644 index 0000000000000..943f4c065ac73 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/PropertyContractInner.java @@ -0,0 +1,129 @@ +/** + * 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.apimanagement.v2019_01_01.implementation; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * Property details. + */ +@JsonFlatten +public class PropertyContractInner extends ProxyResource { + /** + * Optional tags that when provided can be used to filter the property + * list. + */ + @JsonProperty(value = "properties.tags") + private List tags; + + /** + * Determines whether the value is a secret and should be encrypted or not. + * Default value is false. + */ + @JsonProperty(value = "properties.secret") + private Boolean secret; + + /** + * Unique name of Property. It may contain only letters, digits, period, + * dash, and underscore characters. + */ + @JsonProperty(value = "properties.displayName", required = true) + private String displayName; + + /** + * Value of the property. Can contain policy expressions. It may not be + * empty or consist only of whitespace. + */ + @JsonProperty(value = "properties.value", required = true) + private String value; + + /** + * Get optional tags that when provided can be used to filter the property list. + * + * @return the tags value + */ + public List tags() { + return this.tags; + } + + /** + * Set optional tags that when provided can be used to filter the property list. + * + * @param tags the tags value to set + * @return the PropertyContractInner object itself. + */ + public PropertyContractInner withTags(List tags) { + this.tags = tags; + return this; + } + + /** + * Get determines whether the value is a secret and should be encrypted or not. Default value is false. + * + * @return the secret value + */ + public Boolean secret() { + return this.secret; + } + + /** + * Set determines whether the value is a secret and should be encrypted or not. Default value is false. + * + * @param secret the secret value to set + * @return the PropertyContractInner object itself. + */ + public PropertyContractInner withSecret(Boolean secret) { + this.secret = secret; + return this; + } + + /** + * Get unique name of Property. It may contain only letters, digits, period, dash, and underscore characters. + * + * @return the displayName value + */ + public String displayName() { + return this.displayName; + } + + /** + * Set unique name of Property. It may contain only letters, digits, period, dash, and underscore characters. + * + * @param displayName the displayName value to set + * @return the PropertyContractInner object itself. + */ + public PropertyContractInner withDisplayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Get value of the property. Can contain policy expressions. It may not be empty or consist only of whitespace. + * + * @return the value value + */ + public String value() { + return this.value; + } + + /** + * Set value of the property. Can contain policy expressions. It may not be empty or consist only of whitespace. + * + * @param value the value value to set + * @return the PropertyContractInner object itself. + */ + public PropertyContractInner withValue(String value) { + this.value = value; + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/PropertysImpl.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/PropertysImpl.java new file mode 100644 index 0000000000000..707a49448c234 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/PropertysImpl.java @@ -0,0 +1,87 @@ +/** + * 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. + * jkl + */ + +package com.microsoft.azure.management.apimanagement.v2019_01_01.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.apimanagement.v2019_01_01.Propertys; +import rx.Completable; +import rx.functions.Func1; +import rx.Observable; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.apimanagement.v2019_01_01.PropertyContract; + +class PropertysImpl extends WrapperImpl implements Propertys { + private final ApiManagementManager manager; + + PropertysImpl(ApiManagementManager manager) { + super(manager.inner().propertys()); + this.manager = manager; + } + + public ApiManagementManager manager() { + return this.manager; + } + + @Override + public PropertyContractImpl define(String name) { + return wrapModel(name); + } + + private PropertyContractImpl wrapModel(PropertyContractInner inner) { + return new PropertyContractImpl(inner, manager()); + } + + private PropertyContractImpl wrapModel(String name) { + return new PropertyContractImpl(name, this.manager()); + } + + @Override + public Observable listByServiceAsync(final String resourceGroupName, final String serviceName) { + PropertysInner client = this.inner(); + return client.listByServiceAsync(resourceGroupName, serviceName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public PropertyContract call(PropertyContractInner inner) { + return new PropertyContractImpl(inner, manager()); + } + }); + } + + @Override + public Completable getEntityTagAsync(String resourceGroupName, String serviceName, String propId) { + PropertysInner client = this.inner(); + return client.getEntityTagAsync(resourceGroupName, serviceName, propId).toCompletable(); + } + + @Override + public Observable getAsync(String resourceGroupName, String serviceName, String propId) { + PropertysInner client = this.inner(); + return client.getAsync(resourceGroupName, serviceName, propId) + .map(new Func1() { + @Override + public PropertyContract call(PropertyContractInner inner) { + return new PropertyContractImpl(inner, manager()); + } + }); + } + + @Override + public Completable deleteAsync(String resourceGroupName, String serviceName, String propId, String ifMatch) { + PropertysInner client = this.inner(); + return client.deleteAsync(resourceGroupName, serviceName, propId, ifMatch).toCompletable(); + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/PropertysInner.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/PropertysInner.java new file mode 100644 index 0000000000000..9da4e76eb01e5 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/PropertysInner.java @@ -0,0 +1,1062 @@ +/** + * 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.apimanagement.v2019_01_01.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.apimanagement.v2019_01_01.ErrorResponseException; +import com.microsoft.azure.management.apimanagement.v2019_01_01.PropertyCreateOrUpdateHeaders; +import com.microsoft.azure.management.apimanagement.v2019_01_01.PropertyGetEntityTagHeaders; +import com.microsoft.azure.management.apimanagement.v2019_01_01.PropertyGetHeaders; +import com.microsoft.azure.management.apimanagement.v2019_01_01.PropertyUpdateParameters; +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.ServiceResponseWithHeaders; +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.HEAD; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.HTTP; +import retrofit2.http.PATCH; +import retrofit2.http.Path; +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 Propertys. + */ +public class PropertysInner { + /** The Retrofit service to perform REST calls. */ + private PropertysService service; + /** The service client containing this operation class. */ + private ApiManagementClientImpl client; + + /** + * Initializes an instance of PropertysInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public PropertysInner(Retrofit retrofit, ApiManagementClientImpl client) { + this.service = retrofit.create(PropertysService.class); + this.client = client; + } + + /** + * The interface defining all the services for Propertys to be + * used by Retrofit to perform actually REST calls. + */ + interface PropertysService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.apimanagement.v2019_01_01.Propertys listByService" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/properties") + Observable> listByService(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("subscriptionId") String subscriptionId, @Query("$filter") String filter, @Query("$top") Integer top, @Query("$skip") Integer skip, @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.apimanagement.v2019_01_01.Propertys getEntityTag" }) + @HEAD("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/properties/{propId}") + Observable> getEntityTag(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("propId") String propId, @Path("subscriptionId") String subscriptionId, @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.apimanagement.v2019_01_01.Propertys get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/properties/{propId}") + Observable> get(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("propId") String propId, @Path("subscriptionId") String subscriptionId, @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.apimanagement.v2019_01_01.Propertys createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/properties/{propId}") + Observable> createOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("propId") String propId, @Path("subscriptionId") String subscriptionId, @Body PropertyContractInner parameters, @Header("If-Match") String ifMatch, @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.apimanagement.v2019_01_01.Propertys update" }) + @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/properties/{propId}") + Observable> update(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("propId") String propId, @Path("subscriptionId") String subscriptionId, @Body PropertyUpdateParameters parameters, @Header("If-Match") String ifMatch, @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.apimanagement.v2019_01_01.Propertys delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/properties/{propId}", method = "DELETE", hasBody = true) + Observable> delete(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("propId") String propId, @Path("subscriptionId") String subscriptionId, @Header("If-Match") String ifMatch, @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.apimanagement.v2019_01_01.Propertys listByServiceNext" }) + @GET + Observable> listByServiceNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Lists a collection of properties defined within a service instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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<PropertyContractInner> object if successful. + */ + public PagedList listByService(final String resourceGroupName, final String serviceName) { + ServiceResponse> response = listByServiceSinglePageAsync(resourceGroupName, serviceName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByServiceNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists a collection of properties defined within a service instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @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> listByServiceAsync(final String resourceGroupName, final String serviceName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByServiceSinglePageAsync(resourceGroupName, serviceName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByServiceNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists a collection of properties defined within a service instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PropertyContractInner> object + */ + public Observable> listByServiceAsync(final String resourceGroupName, final String serviceName) { + return listByServiceWithServiceResponseAsync(resourceGroupName, serviceName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists a collection of properties defined within a service instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PropertyContractInner> object + */ + public Observable>> listByServiceWithServiceResponseAsync(final String resourceGroupName, final String serviceName) { + return listByServiceSinglePageAsync(resourceGroupName, serviceName) + .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(listByServiceNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists a collection of properties defined within a service instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<PropertyContractInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByServiceSinglePageAsync(final String resourceGroupName, final String serviceName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + 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 filter = null; + final Integer top = null; + final Integer skip = null; + return service.listByService(resourceGroupName, serviceName, this.client.subscriptionId(), filter, top, skip, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByServiceDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Lists a collection of properties defined within a service instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| tags | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith, any, all | </br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br> + * @param top Number of records to return. + * @param skip Number of records to skip. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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<PropertyContractInner> object if successful. + */ + public PagedList listByService(final String resourceGroupName, final String serviceName, final String filter, final Integer top, final Integer skip) { + ServiceResponse> response = listByServiceSinglePageAsync(resourceGroupName, serviceName, filter, top, skip).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByServiceNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists a collection of properties defined within a service instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| tags | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith, any, all | </br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br> + * @param top Number of records to return. + * @param skip Number of records to skip. + * @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> listByServiceAsync(final String resourceGroupName, final String serviceName, final String filter, final Integer top, final Integer skip, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByServiceSinglePageAsync(resourceGroupName, serviceName, filter, top, skip), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByServiceNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists a collection of properties defined within a service instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| tags | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith, any, all | </br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br> + * @param top Number of records to return. + * @param skip Number of records to skip. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PropertyContractInner> object + */ + public Observable> listByServiceAsync(final String resourceGroupName, final String serviceName, final String filter, final Integer top, final Integer skip) { + return listByServiceWithServiceResponseAsync(resourceGroupName, serviceName, filter, top, skip) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists a collection of properties defined within a service instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| tags | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith, any, all | </br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br> + * @param top Number of records to return. + * @param skip Number of records to skip. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PropertyContractInner> object + */ + public Observable>> listByServiceWithServiceResponseAsync(final String resourceGroupName, final String serviceName, final String filter, final Integer top, final Integer skip) { + return listByServiceSinglePageAsync(resourceGroupName, serviceName, filter, top, skip) + .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(listByServiceNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists a collection of properties defined within a service instance. + * + ServiceResponse> * @param resourceGroupName The name of the resource group. + ServiceResponse> * @param serviceName The name of the API Management service. + ServiceResponse> * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| tags | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith, any, all | </br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br> + ServiceResponse> * @param top Number of records to return. + ServiceResponse> * @param skip Number of records to skip. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<PropertyContractInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByServiceSinglePageAsync(final String resourceGroupName, final String serviceName, final String filter, final Integer top, final Integer skip) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + 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.listByService(resourceGroupName, serviceName, this.client.subscriptionId(), filter, top, skip, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByServiceDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByServiceDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Gets the entity state (Etag) version of the property specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param propId Identifier of the property. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void getEntityTag(String resourceGroupName, String serviceName, String propId) { + getEntityTagWithServiceResponseAsync(resourceGroupName, serviceName, propId).toBlocking().single().body(); + } + + /** + * Gets the entity state (Etag) version of the property specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param propId Identifier of the property. + * @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 getEntityTagAsync(String resourceGroupName, String serviceName, String propId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(getEntityTagWithServiceResponseAsync(resourceGroupName, serviceName, propId), serviceCallback); + } + + /** + * Gets the entity state (Etag) version of the property specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param propId Identifier of the property. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public Observable getEntityTagAsync(String resourceGroupName, String serviceName, String propId) { + return getEntityTagWithServiceResponseAsync(resourceGroupName, serviceName, propId).map(new Func1, Void>() { + @Override + public Void call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Gets the entity state (Etag) version of the property specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param propId Identifier of the property. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public Observable> getEntityTagWithServiceResponseAsync(String resourceGroupName, String serviceName, String propId) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (propId == null) { + throw new IllegalArgumentException("Parameter propId is required and cannot be null."); + } + 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.getEntityTag(resourceGroupName, serviceName, propId, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = getEntityTagDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponseWithHeaders getEntityTagDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .buildEmptyWithHeaders(response, PropertyGetEntityTagHeaders.class); + } + + /** + * Gets the details of the property specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param propId Identifier of the property. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PropertyContractInner object if successful. + */ + public PropertyContractInner get(String resourceGroupName, String serviceName, String propId) { + return getWithServiceResponseAsync(resourceGroupName, serviceName, propId).toBlocking().single().body(); + } + + /** + * Gets the details of the property specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param propId Identifier of the property. + * @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 getAsync(String resourceGroupName, String serviceName, String propId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(getWithServiceResponseAsync(resourceGroupName, serviceName, propId), serviceCallback); + } + + /** + * Gets the details of the property specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param propId Identifier of the property. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PropertyContractInner object + */ + public Observable getAsync(String resourceGroupName, String serviceName, String propId) { + return getWithServiceResponseAsync(resourceGroupName, serviceName, propId).map(new Func1, PropertyContractInner>() { + @Override + public PropertyContractInner call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Gets the details of the property specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param propId Identifier of the property. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PropertyContractInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String serviceName, String propId) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (propId == null) { + throw new IllegalArgumentException("Parameter propId is required and cannot be null."); + } + 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.get(resourceGroupName, serviceName, propId, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = getDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponseWithHeaders getDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .buildWithHeaders(response, PropertyGetHeaders.class); + } + + /** + * Creates or updates a property. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param propId Identifier of the property. + * @param parameters Create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PropertyContractInner object if successful. + */ + public PropertyContractInner createOrUpdate(String resourceGroupName, String serviceName, String propId, PropertyContractInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serviceName, propId, parameters).toBlocking().single().body(); + } + + /** + * Creates or updates a property. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param propId Identifier of the property. + * @param parameters Create parameters. + * @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 createOrUpdateAsync(String resourceGroupName, String serviceName, String propId, PropertyContractInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, serviceName, propId, parameters), serviceCallback); + } + + /** + * Creates or updates a property. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param propId Identifier of the property. + * @param parameters Create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PropertyContractInner object + */ + public Observable createOrUpdateAsync(String resourceGroupName, String serviceName, String propId, PropertyContractInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serviceName, propId, parameters).map(new Func1, PropertyContractInner>() { + @Override + public PropertyContractInner call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Creates or updates a property. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param propId Identifier of the property. + * @param parameters Create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PropertyContractInner object + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String serviceName, String propId, PropertyContractInner parameters) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (propId == null) { + throw new IllegalArgumentException("Parameter propId is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(parameters); + final String ifMatch = null; + return service.createOrUpdate(resourceGroupName, serviceName, propId, this.client.subscriptionId(), parameters, ifMatch, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = createOrUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Creates or updates a property. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param propId Identifier of the property. + * @param parameters Create parameters. + * @param ifMatch ETag of the Entity. Not required when creating an entity, but required when updating an entity. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PropertyContractInner object if successful. + */ + public PropertyContractInner createOrUpdate(String resourceGroupName, String serviceName, String propId, PropertyContractInner parameters, String ifMatch) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serviceName, propId, parameters, ifMatch).toBlocking().single().body(); + } + + /** + * Creates or updates a property. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param propId Identifier of the property. + * @param parameters Create parameters. + * @param ifMatch ETag of the Entity. Not required when creating an entity, but required when updating an entity. + * @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 createOrUpdateAsync(String resourceGroupName, String serviceName, String propId, PropertyContractInner parameters, String ifMatch, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, serviceName, propId, parameters, ifMatch), serviceCallback); + } + + /** + * Creates or updates a property. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param propId Identifier of the property. + * @param parameters Create parameters. + * @param ifMatch ETag of the Entity. Not required when creating an entity, but required when updating an entity. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PropertyContractInner object + */ + public Observable createOrUpdateAsync(String resourceGroupName, String serviceName, String propId, PropertyContractInner parameters, String ifMatch) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serviceName, propId, parameters, ifMatch).map(new Func1, PropertyContractInner>() { + @Override + public PropertyContractInner call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Creates or updates a property. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param propId Identifier of the property. + * @param parameters Create parameters. + * @param ifMatch ETag of the Entity. Not required when creating an entity, but required when updating an entity. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PropertyContractInner object + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String serviceName, String propId, PropertyContractInner parameters, String ifMatch) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (propId == null) { + throw new IllegalArgumentException("Parameter propId is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(parameters); + return service.createOrUpdate(resourceGroupName, serviceName, propId, this.client.subscriptionId(), parameters, ifMatch, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = createOrUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponseWithHeaders createOrUpdateDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(201, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .buildWithHeaders(response, PropertyCreateOrUpdateHeaders.class); + } + + /** + * Updates the specific property. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param propId Identifier of the property. + * @param parameters Update parameters. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void update(String resourceGroupName, String serviceName, String propId, PropertyUpdateParameters parameters, String ifMatch) { + updateWithServiceResponseAsync(resourceGroupName, serviceName, propId, parameters, ifMatch).toBlocking().single().body(); + } + + /** + * Updates the specific property. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param propId Identifier of the property. + * @param parameters Update parameters. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @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 serviceName, String propId, PropertyUpdateParameters parameters, String ifMatch, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateWithServiceResponseAsync(resourceGroupName, serviceName, propId, parameters, ifMatch), serviceCallback); + } + + /** + * Updates the specific property. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param propId Identifier of the property. + * @param parameters Update parameters. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable updateAsync(String resourceGroupName, String serviceName, String propId, PropertyUpdateParameters parameters, String ifMatch) { + return updateWithServiceResponseAsync(resourceGroupName, serviceName, propId, parameters, ifMatch).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates the specific property. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param propId Identifier of the property. + * @param parameters Update parameters. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> updateWithServiceResponseAsync(String resourceGroupName, String serviceName, String propId, PropertyUpdateParameters parameters, String ifMatch) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (propId == null) { + throw new IllegalArgumentException("Parameter propId is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + if (ifMatch == null) { + throw new IllegalArgumentException("Parameter ifMatch is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(parameters); + return service.update(resourceGroupName, serviceName, propId, this.client.subscriptionId(), parameters, ifMatch, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = updateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse updateDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(204, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Deletes specific property from the API Management service instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param propId Identifier of the property. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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 serviceName, String propId, String ifMatch) { + deleteWithServiceResponseAsync(resourceGroupName, serviceName, propId, ifMatch).toBlocking().single().body(); + } + + /** + * Deletes specific property from the API Management service instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param propId Identifier of the property. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @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 serviceName, String propId, String ifMatch, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, serviceName, propId, ifMatch), serviceCallback); + } + + /** + * Deletes specific property from the API Management service instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param propId Identifier of the property. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable deleteAsync(String resourceGroupName, String serviceName, String propId, String ifMatch) { + return deleteWithServiceResponseAsync(resourceGroupName, serviceName, propId, ifMatch).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes specific property from the API Management service instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param propId Identifier of the property. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> deleteWithServiceResponseAsync(String resourceGroupName, String serviceName, String propId, String ifMatch) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (propId == null) { + throw new IllegalArgumentException("Parameter propId is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (ifMatch == null) { + throw new IllegalArgumentException("Parameter ifMatch 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.delete(resourceGroupName, serviceName, propId, this.client.subscriptionId(), ifMatch, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = deleteDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse deleteDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(204, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists a collection of properties defined within a service instance. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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<PropertyContractInner> object if successful. + */ + public PagedList listByServiceNext(final String nextPageLink) { + ServiceResponse> response = listByServiceNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByServiceNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists a collection of properties defined within a service instance. + * + * @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> listByServiceNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByServiceNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByServiceNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists a collection of properties defined within a service instance. + * + * @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<PropertyContractInner> object + */ + public Observable> listByServiceNextAsync(final String nextPageLink) { + return listByServiceNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists a collection of properties defined within a service instance. + * + * @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<PropertyContractInner> object + */ + public Observable>> listByServiceNextWithServiceResponseAsync(final String nextPageLink) { + return listByServiceNextSinglePageAsync(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(listByServiceNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists a collection of properties defined within a service instance. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<PropertyContractInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByServiceNextSinglePageAsync(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.listByServiceNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByServiceNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByServiceNextDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/QuotaByCounterKeysImpl.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/QuotaByCounterKeysImpl.java new file mode 100644 index 0000000000000..0c73284e8c689 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/QuotaByCounterKeysImpl.java @@ -0,0 +1,50 @@ +/** + * 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. + * abc + */ + +package com.microsoft.azure.management.apimanagement.v2019_01_01.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.apimanagement.v2019_01_01.QuotaByCounterKeys; +import rx.Completable; +import rx.functions.Func1; +import rx.Observable; +import com.microsoft.azure.management.apimanagement.v2019_01_01.QuotaCounterCollection; +import com.microsoft.azure.management.apimanagement.v2019_01_01.QuotaCounterValueContractProperties; + +class QuotaByCounterKeysImpl extends WrapperImpl implements QuotaByCounterKeys { + private final ApiManagementManager manager; + + QuotaByCounterKeysImpl(ApiManagementManager manager) { + super(manager.inner().quotaByCounterKeys()); + this.manager = manager; + } + + public ApiManagementManager manager() { + return this.manager; + } + + @Override + public Observable listByServiceAsync(String resourceGroupName, String serviceName, String quotaCounterKey) { + QuotaByCounterKeysInner client = this.inner(); + return client.listByServiceAsync(resourceGroupName, serviceName, quotaCounterKey) + .map(new Func1() { + @Override + public QuotaCounterCollection call(QuotaCounterCollectionInner inner) { + return new QuotaCounterCollectionImpl(inner, manager()); + } + }); + } + + @Override + public Completable updateAsync(String resourceGroupName, String serviceName, String quotaCounterKey, QuotaCounterValueContractProperties parameters) { + QuotaByCounterKeysInner client = this.inner(); + return client.updateAsync(resourceGroupName, serviceName, quotaCounterKey, parameters).toCompletable(); + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/QuotaByCounterKeysInner.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/QuotaByCounterKeysInner.java new file mode 100644 index 0000000000000..80aeb252b4bcb --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/QuotaByCounterKeysInner.java @@ -0,0 +1,261 @@ +/** + * 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.apimanagement.v2019_01_01.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.management.apimanagement.v2019_01_01.ErrorResponseException; +import com.microsoft.azure.management.apimanagement.v2019_01_01.QuotaCounterValueContractProperties; +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 okhttp3.ResponseBody; +import retrofit2.http.Body; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.PATCH; +import retrofit2.http.Path; +import retrofit2.http.Query; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in QuotaByCounterKeys. + */ +public class QuotaByCounterKeysInner { + /** The Retrofit service to perform REST calls. */ + private QuotaByCounterKeysService service; + /** The service client containing this operation class. */ + private ApiManagementClientImpl client; + + /** + * Initializes an instance of QuotaByCounterKeysInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public QuotaByCounterKeysInner(Retrofit retrofit, ApiManagementClientImpl client) { + this.service = retrofit.create(QuotaByCounterKeysService.class); + this.client = client; + } + + /** + * The interface defining all the services for QuotaByCounterKeys to be + * used by Retrofit to perform actually REST calls. + */ + interface QuotaByCounterKeysService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.apimanagement.v2019_01_01.QuotaByCounterKeys listByService" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/quotas/{quotaCounterKey}") + Observable> listByService(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("quotaCounterKey") String quotaCounterKey, @Path("subscriptionId") String subscriptionId, @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.apimanagement.v2019_01_01.QuotaByCounterKeys update" }) + @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/quotas/{quotaCounterKey}") + Observable> update(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("quotaCounterKey") String quotaCounterKey, @Path("subscriptionId") String subscriptionId, @Body QuotaCounterValueContractProperties parameters, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Lists a collection of current quota counter periods associated with the counter-key configured in the policy on the specified service instance. The api does not support paging yet. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param quotaCounterKey Quota counter key identifier.This is the result of expression defined in counter-key attribute of the quota-by-key policy.For Example, if you specify counter-key="boo" in the policy, then it’s accessible by "boo" counter key. But if it’s defined as counter-key="@("b"+"a")" then it will be accessible by "ba" key + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the QuotaCounterCollectionInner object if successful. + */ + public QuotaCounterCollectionInner listByService(String resourceGroupName, String serviceName, String quotaCounterKey) { + return listByServiceWithServiceResponseAsync(resourceGroupName, serviceName, quotaCounterKey).toBlocking().single().body(); + } + + /** + * Lists a collection of current quota counter periods associated with the counter-key configured in the policy on the specified service instance. The api does not support paging yet. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param quotaCounterKey Quota counter key identifier.This is the result of expression defined in counter-key attribute of the quota-by-key policy.For Example, if you specify counter-key="boo" in the policy, then it’s accessible by "boo" counter key. But if it’s defined as counter-key="@("b"+"a")" then it will be accessible by "ba" key + * @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 listByServiceAsync(String resourceGroupName, String serviceName, String quotaCounterKey, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(listByServiceWithServiceResponseAsync(resourceGroupName, serviceName, quotaCounterKey), serviceCallback); + } + + /** + * Lists a collection of current quota counter periods associated with the counter-key configured in the policy on the specified service instance. The api does not support paging yet. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param quotaCounterKey Quota counter key identifier.This is the result of expression defined in counter-key attribute of the quota-by-key policy.For Example, if you specify counter-key="boo" in the policy, then it’s accessible by "boo" counter key. But if it’s defined as counter-key="@("b"+"a")" then it will be accessible by "ba" key + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the QuotaCounterCollectionInner object + */ + public Observable listByServiceAsync(String resourceGroupName, String serviceName, String quotaCounterKey) { + return listByServiceWithServiceResponseAsync(resourceGroupName, serviceName, quotaCounterKey).map(new Func1, QuotaCounterCollectionInner>() { + @Override + public QuotaCounterCollectionInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Lists a collection of current quota counter periods associated with the counter-key configured in the policy on the specified service instance. The api does not support paging yet. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param quotaCounterKey Quota counter key identifier.This is the result of expression defined in counter-key attribute of the quota-by-key policy.For Example, if you specify counter-key="boo" in the policy, then it’s accessible by "boo" counter key. But if it’s defined as counter-key="@("b"+"a")" then it will be accessible by "ba" key + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the QuotaCounterCollectionInner object + */ + public Observable> listByServiceWithServiceResponseAsync(String resourceGroupName, String serviceName, String quotaCounterKey) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (quotaCounterKey == null) { + throw new IllegalArgumentException("Parameter quotaCounterKey is required and cannot be null."); + } + 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.listByService(resourceGroupName, serviceName, quotaCounterKey, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = listByServiceDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse listByServiceDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Updates all the quota counter values specified with the existing quota counter key to a value in the specified service instance. This should be used for reset of the quota counter values. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param quotaCounterKey Quota counter key identifier.This is the result of expression defined in counter-key attribute of the quota-by-key policy.For Example, if you specify counter-key="boo" in the policy, then it’s accessible by "boo" counter key. But if it’s defined as counter-key="@("b"+"a")" then it will be accessible by "ba" key + * @param parameters The value of the quota counter to be applied to all quota counter periods. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void update(String resourceGroupName, String serviceName, String quotaCounterKey, QuotaCounterValueContractProperties parameters) { + updateWithServiceResponseAsync(resourceGroupName, serviceName, quotaCounterKey, parameters).toBlocking().single().body(); + } + + /** + * Updates all the quota counter values specified with the existing quota counter key to a value in the specified service instance. This should be used for reset of the quota counter values. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param quotaCounterKey Quota counter key identifier.This is the result of expression defined in counter-key attribute of the quota-by-key policy.For Example, if you specify counter-key="boo" in the policy, then it’s accessible by "boo" counter key. But if it’s defined as counter-key="@("b"+"a")" then it will be accessible by "ba" key + * @param parameters The value of the quota counter to be applied to all quota counter periods. + * @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 serviceName, String quotaCounterKey, QuotaCounterValueContractProperties parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateWithServiceResponseAsync(resourceGroupName, serviceName, quotaCounterKey, parameters), serviceCallback); + } + + /** + * Updates all the quota counter values specified with the existing quota counter key to a value in the specified service instance. This should be used for reset of the quota counter values. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param quotaCounterKey Quota counter key identifier.This is the result of expression defined in counter-key attribute of the quota-by-key policy.For Example, if you specify counter-key="boo" in the policy, then it’s accessible by "boo" counter key. But if it’s defined as counter-key="@("b"+"a")" then it will be accessible by "ba" key + * @param parameters The value of the quota counter to be applied to all quota counter periods. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable updateAsync(String resourceGroupName, String serviceName, String quotaCounterKey, QuotaCounterValueContractProperties parameters) { + return updateWithServiceResponseAsync(resourceGroupName, serviceName, quotaCounterKey, parameters).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates all the quota counter values specified with the existing quota counter key to a value in the specified service instance. This should be used for reset of the quota counter values. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param quotaCounterKey Quota counter key identifier.This is the result of expression defined in counter-key attribute of the quota-by-key policy.For Example, if you specify counter-key="boo" in the policy, then it’s accessible by "boo" counter key. But if it’s defined as counter-key="@("b"+"a")" then it will be accessible by "ba" key + * @param parameters The value of the quota counter to be applied to all quota counter periods. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> updateWithServiceResponseAsync(String resourceGroupName, String serviceName, String quotaCounterKey, QuotaCounterValueContractProperties parameters) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (quotaCounterKey == null) { + throw new IllegalArgumentException("Parameter quotaCounterKey is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(parameters); + return service.update(resourceGroupName, serviceName, quotaCounterKey, this.client.subscriptionId(), parameters, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = updateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse updateDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(204, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/QuotaByPeriodKeysImpl.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/QuotaByPeriodKeysImpl.java new file mode 100644 index 0000000000000..d0fcfa1419217 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/QuotaByPeriodKeysImpl.java @@ -0,0 +1,54 @@ +/** + * 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.apimanagement.v2019_01_01.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.apimanagement.v2019_01_01.QuotaByPeriodKeys; +import rx.Observable; +import rx.functions.Func1; +import rx.Completable; +import com.microsoft.azure.management.apimanagement.v2019_01_01.QuotaCounterValueContractProperties; +import com.microsoft.azure.management.apimanagement.v2019_01_01.QuotaCounterContract; + +class QuotaByPeriodKeysImpl extends WrapperImpl implements QuotaByPeriodKeys { + private final ApiManagementManager manager; + + QuotaByPeriodKeysImpl(ApiManagementManager manager) { + super(manager.inner().quotaByPeriodKeys()); + this.manager = manager; + } + + public ApiManagementManager manager() { + return this.manager; + } + + private QuotaCounterContractImpl wrapModel(QuotaCounterContractInner inner) { + return new QuotaCounterContractImpl(inner, manager()); + } + + @Override + public Completable updateAsync(String resourceGroupName, String serviceName, String quotaCounterKey, String quotaPeriodKey, QuotaCounterValueContractProperties parameters) { + QuotaByPeriodKeysInner client = this.inner(); + return client.updateAsync(resourceGroupName, serviceName, quotaCounterKey, quotaPeriodKey, parameters).toCompletable(); + } + + @Override + public Observable getAsync(String resourceGroupName, String serviceName, String quotaCounterKey, String quotaPeriodKey) { + QuotaByPeriodKeysInner client = this.inner(); + return client.getAsync(resourceGroupName, serviceName, quotaCounterKey, quotaPeriodKey) + .map(new Func1() { + @Override + public QuotaCounterContract call(QuotaCounterContractInner inner) { + return wrapModel(inner); + } + }); + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/QuotaByPeriodKeysInner.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/QuotaByPeriodKeysInner.java new file mode 100644 index 0000000000000..ee74f4156903d --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/QuotaByPeriodKeysInner.java @@ -0,0 +1,275 @@ +/** + * 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.apimanagement.v2019_01_01.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.management.apimanagement.v2019_01_01.ErrorResponseException; +import com.microsoft.azure.management.apimanagement.v2019_01_01.QuotaCounterValueContractProperties; +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 okhttp3.ResponseBody; +import retrofit2.http.Body; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.PATCH; +import retrofit2.http.Path; +import retrofit2.http.Query; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in QuotaByPeriodKeys. + */ +public class QuotaByPeriodKeysInner { + /** The Retrofit service to perform REST calls. */ + private QuotaByPeriodKeysService service; + /** The service client containing this operation class. */ + private ApiManagementClientImpl client; + + /** + * Initializes an instance of QuotaByPeriodKeysInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public QuotaByPeriodKeysInner(Retrofit retrofit, ApiManagementClientImpl client) { + this.service = retrofit.create(QuotaByPeriodKeysService.class); + this.client = client; + } + + /** + * The interface defining all the services for QuotaByPeriodKeys to be + * used by Retrofit to perform actually REST calls. + */ + interface QuotaByPeriodKeysService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.apimanagement.v2019_01_01.QuotaByPeriodKeys get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/quotas/{quotaCounterKey}/periods/{quotaPeriodKey}") + Observable> get(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("quotaCounterKey") String quotaCounterKey, @Path("quotaPeriodKey") String quotaPeriodKey, @Path("subscriptionId") String subscriptionId, @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.apimanagement.v2019_01_01.QuotaByPeriodKeys update" }) + @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/quotas/{quotaCounterKey}/periods/{quotaPeriodKey}") + Observable> update(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("quotaCounterKey") String quotaCounterKey, @Path("quotaPeriodKey") String quotaPeriodKey, @Path("subscriptionId") String subscriptionId, @Body QuotaCounterValueContractProperties parameters, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Gets the value of the quota counter associated with the counter-key in the policy for the specific period in service instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param quotaCounterKey Quota counter key identifier.This is the result of expression defined in counter-key attribute of the quota-by-key policy.For Example, if you specify counter-key="boo" in the policy, then it’s accessible by "boo" counter key. But if it’s defined as counter-key="@("b"+"a")" then it will be accessible by "ba" key + * @param quotaPeriodKey Quota period key identifier. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the QuotaCounterContractInner object if successful. + */ + public QuotaCounterContractInner get(String resourceGroupName, String serviceName, String quotaCounterKey, String quotaPeriodKey) { + return getWithServiceResponseAsync(resourceGroupName, serviceName, quotaCounterKey, quotaPeriodKey).toBlocking().single().body(); + } + + /** + * Gets the value of the quota counter associated with the counter-key in the policy for the specific period in service instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param quotaCounterKey Quota counter key identifier.This is the result of expression defined in counter-key attribute of the quota-by-key policy.For Example, if you specify counter-key="boo" in the policy, then it’s accessible by "boo" counter key. But if it’s defined as counter-key="@("b"+"a")" then it will be accessible by "ba" key + * @param quotaPeriodKey Quota period key identifier. + * @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 getAsync(String resourceGroupName, String serviceName, String quotaCounterKey, String quotaPeriodKey, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroupName, serviceName, quotaCounterKey, quotaPeriodKey), serviceCallback); + } + + /** + * Gets the value of the quota counter associated with the counter-key in the policy for the specific period in service instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param quotaCounterKey Quota counter key identifier.This is the result of expression defined in counter-key attribute of the quota-by-key policy.For Example, if you specify counter-key="boo" in the policy, then it’s accessible by "boo" counter key. But if it’s defined as counter-key="@("b"+"a")" then it will be accessible by "ba" key + * @param quotaPeriodKey Quota period key identifier. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the QuotaCounterContractInner object + */ + public Observable getAsync(String resourceGroupName, String serviceName, String quotaCounterKey, String quotaPeriodKey) { + return getWithServiceResponseAsync(resourceGroupName, serviceName, quotaCounterKey, quotaPeriodKey).map(new Func1, QuotaCounterContractInner>() { + @Override + public QuotaCounterContractInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets the value of the quota counter associated with the counter-key in the policy for the specific period in service instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param quotaCounterKey Quota counter key identifier.This is the result of expression defined in counter-key attribute of the quota-by-key policy.For Example, if you specify counter-key="boo" in the policy, then it’s accessible by "boo" counter key. But if it’s defined as counter-key="@("b"+"a")" then it will be accessible by "ba" key + * @param quotaPeriodKey Quota period key identifier. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the QuotaCounterContractInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String serviceName, String quotaCounterKey, String quotaPeriodKey) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (quotaCounterKey == null) { + throw new IllegalArgumentException("Parameter quotaCounterKey is required and cannot be null."); + } + if (quotaPeriodKey == null) { + throw new IllegalArgumentException("Parameter quotaPeriodKey is required and cannot be null."); + } + 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.get(resourceGroupName, serviceName, quotaCounterKey, quotaPeriodKey, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Updates an existing quota counter value in the specified service instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param quotaCounterKey Quota counter key identifier.This is the result of expression defined in counter-key attribute of the quota-by-key policy.For Example, if you specify counter-key="boo" in the policy, then it’s accessible by "boo" counter key. But if it’s defined as counter-key="@("b"+"a")" then it will be accessible by "ba" key + * @param quotaPeriodKey Quota period key identifier. + * @param parameters The value of the Quota counter to be applied on the specified period. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void update(String resourceGroupName, String serviceName, String quotaCounterKey, String quotaPeriodKey, QuotaCounterValueContractProperties parameters) { + updateWithServiceResponseAsync(resourceGroupName, serviceName, quotaCounterKey, quotaPeriodKey, parameters).toBlocking().single().body(); + } + + /** + * Updates an existing quota counter value in the specified service instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param quotaCounterKey Quota counter key identifier.This is the result of expression defined in counter-key attribute of the quota-by-key policy.For Example, if you specify counter-key="boo" in the policy, then it’s accessible by "boo" counter key. But if it’s defined as counter-key="@("b"+"a")" then it will be accessible by "ba" key + * @param quotaPeriodKey Quota period key identifier. + * @param parameters The value of the Quota counter to be applied on the specified period. + * @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 serviceName, String quotaCounterKey, String quotaPeriodKey, QuotaCounterValueContractProperties parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateWithServiceResponseAsync(resourceGroupName, serviceName, quotaCounterKey, quotaPeriodKey, parameters), serviceCallback); + } + + /** + * Updates an existing quota counter value in the specified service instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param quotaCounterKey Quota counter key identifier.This is the result of expression defined in counter-key attribute of the quota-by-key policy.For Example, if you specify counter-key="boo" in the policy, then it’s accessible by "boo" counter key. But if it’s defined as counter-key="@("b"+"a")" then it will be accessible by "ba" key + * @param quotaPeriodKey Quota period key identifier. + * @param parameters The value of the Quota counter to be applied on the specified period. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable updateAsync(String resourceGroupName, String serviceName, String quotaCounterKey, String quotaPeriodKey, QuotaCounterValueContractProperties parameters) { + return updateWithServiceResponseAsync(resourceGroupName, serviceName, quotaCounterKey, quotaPeriodKey, parameters).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates an existing quota counter value in the specified service instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param quotaCounterKey Quota counter key identifier.This is the result of expression defined in counter-key attribute of the quota-by-key policy.For Example, if you specify counter-key="boo" in the policy, then it’s accessible by "boo" counter key. But if it’s defined as counter-key="@("b"+"a")" then it will be accessible by "ba" key + * @param quotaPeriodKey Quota period key identifier. + * @param parameters The value of the Quota counter to be applied on the specified period. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> updateWithServiceResponseAsync(String resourceGroupName, String serviceName, String quotaCounterKey, String quotaPeriodKey, QuotaCounterValueContractProperties parameters) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (quotaCounterKey == null) { + throw new IllegalArgumentException("Parameter quotaCounterKey is required and cannot be null."); + } + if (quotaPeriodKey == null) { + throw new IllegalArgumentException("Parameter quotaPeriodKey is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(parameters); + return service.update(resourceGroupName, serviceName, quotaCounterKey, quotaPeriodKey, this.client.subscriptionId(), parameters, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = updateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse updateDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(204, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/QuotaCounterCollectionImpl.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/QuotaCounterCollectionImpl.java new file mode 100644 index 0000000000000..b8e18cd1f31d8 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/QuotaCounterCollectionImpl.java @@ -0,0 +1,42 @@ +/** + * 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.apimanagement.v2019_01_01.implementation; + +import com.microsoft.azure.management.apimanagement.v2019_01_01.QuotaCounterCollection; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import java.util.List; + +class QuotaCounterCollectionImpl extends WrapperImpl implements QuotaCounterCollection { + private final ApiManagementManager manager; + QuotaCounterCollectionImpl(QuotaCounterCollectionInner inner, ApiManagementManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public ApiManagementManager manager() { + return this.manager; + } + + @Override + public Long count() { + return this.inner().count(); + } + + @Override + public String nextLink() { + return this.inner().nextLink(); + } + + @Override + public List value() { + return this.inner().value(); + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/QuotaCounterCollectionInner.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/QuotaCounterCollectionInner.java new file mode 100644 index 0000000000000..c7bf6191c66a6 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/QuotaCounterCollectionInner.java @@ -0,0 +1,96 @@ +/** + * 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.apimanagement.v2019_01_01.implementation; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Paged Quota Counter list representation. + */ +public class QuotaCounterCollectionInner { + /** + * Quota counter values. + */ + @JsonProperty(value = "value") + private List value; + + /** + * Total record count number across all pages. + */ + @JsonProperty(value = "count") + private Long count; + + /** + * Next page link if any. + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** + * Get quota counter values. + * + * @return the value value + */ + public List value() { + return this.value; + } + + /** + * Set quota counter values. + * + * @param value the value value to set + * @return the QuotaCounterCollectionInner object itself. + */ + public QuotaCounterCollectionInner withValue(List value) { + this.value = value; + return this; + } + + /** + * Get total record count number across all pages. + * + * @return the count value + */ + public Long count() { + return this.count; + } + + /** + * Set total record count number across all pages. + * + * @param count the count value to set + * @return the QuotaCounterCollectionInner object itself. + */ + public QuotaCounterCollectionInner withCount(Long count) { + this.count = count; + return this; + } + + /** + * Get next page link if any. + * + * @return the nextLink value + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set next page link if any. + * + * @param nextLink the nextLink value to set + * @return the QuotaCounterCollectionInner object itself. + */ + public QuotaCounterCollectionInner withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/QuotaCounterContractImpl.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/QuotaCounterContractImpl.java new file mode 100644 index 0000000000000..e47bf52d1ee24 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/QuotaCounterContractImpl.java @@ -0,0 +1,61 @@ +/** + * 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.apimanagement.v2019_01_01.implementation; + +import com.microsoft.azure.management.apimanagement.v2019_01_01.QuotaCounterContract; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import rx.Observable; +import org.joda.time.DateTime; +import com.microsoft.azure.management.apimanagement.v2019_01_01.QuotaCounterValueContractProperties; + +class QuotaCounterContractImpl extends WrapperImpl implements QuotaCounterContract { + private final ApiManagementManager manager; + private String resourceGroupName; + private String serviceName; + private String quotaCounterKey; + private String quotaPeriodKey; + + QuotaCounterContractImpl(QuotaCounterContractInner inner, ApiManagementManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public ApiManagementManager manager() { + return this.manager; + } + + + + @Override + public String counterKey() { + return this.inner().counterKey(); + } + + @Override + public DateTime periodEndTime() { + return this.inner().periodEndTime(); + } + + @Override + public String periodKey() { + return this.inner().periodKey(); + } + + @Override + public DateTime periodStartTime() { + return this.inner().periodStartTime(); + } + + @Override + public QuotaCounterValueContractProperties value() { + return this.inner().value(); + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/QuotaCounterContractInner.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/QuotaCounterContractInner.java new file mode 100644 index 0000000000000..1b6108a71d7ad --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/QuotaCounterContractInner.java @@ -0,0 +1,154 @@ +/** + * 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.apimanagement.v2019_01_01.implementation; + +import org.joda.time.DateTime; +import com.microsoft.azure.management.apimanagement.v2019_01_01.QuotaCounterValueContractProperties; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Quota counter details. + */ +public class QuotaCounterContractInner { + /** + * The Key value of the Counter. Must not be empty. + */ + @JsonProperty(value = "counterKey", required = true) + private String counterKey; + + /** + * Identifier of the Period for which the counter was collected. Must not + * be empty. + */ + @JsonProperty(value = "periodKey", required = true) + private String periodKey; + + /** + * The date of the start of Counter Period. The date conforms to the + * following format: `yyyy-MM-ddTHH:mm:ssZ` as specified by the ISO 8601 + * standard. + */ + @JsonProperty(value = "periodStartTime", required = true) + private DateTime periodStartTime; + + /** + * The date of the end of Counter Period. The date conforms to the + * following format: `yyyy-MM-ddTHH:mm:ssZ` as specified by the ISO 8601 + * standard. + */ + @JsonProperty(value = "periodEndTime", required = true) + private DateTime periodEndTime; + + /** + * Quota Value Properties. + */ + @JsonProperty(value = "value") + private QuotaCounterValueContractProperties value; + + /** + * Get the Key value of the Counter. Must not be empty. + * + * @return the counterKey value + */ + public String counterKey() { + return this.counterKey; + } + + /** + * Set the Key value of the Counter. Must not be empty. + * + * @param counterKey the counterKey value to set + * @return the QuotaCounterContractInner object itself. + */ + public QuotaCounterContractInner withCounterKey(String counterKey) { + this.counterKey = counterKey; + return this; + } + + /** + * Get identifier of the Period for which the counter was collected. Must not be empty. + * + * @return the periodKey value + */ + public String periodKey() { + return this.periodKey; + } + + /** + * Set identifier of the Period for which the counter was collected. Must not be empty. + * + * @param periodKey the periodKey value to set + * @return the QuotaCounterContractInner object itself. + */ + public QuotaCounterContractInner withPeriodKey(String periodKey) { + this.periodKey = periodKey; + return this; + } + + /** + * Get the date of the start of Counter Period. The date conforms to the following format: `yyyy-MM-ddTHH:mm:ssZ` as specified by the ISO 8601 standard. + * + * @return the periodStartTime value + */ + public DateTime periodStartTime() { + return this.periodStartTime; + } + + /** + * Set the date of the start of Counter Period. The date conforms to the following format: `yyyy-MM-ddTHH:mm:ssZ` as specified by the ISO 8601 standard. + * + * @param periodStartTime the periodStartTime value to set + * @return the QuotaCounterContractInner object itself. + */ + public QuotaCounterContractInner withPeriodStartTime(DateTime periodStartTime) { + this.periodStartTime = periodStartTime; + return this; + } + + /** + * Get the date of the end of Counter Period. The date conforms to the following format: `yyyy-MM-ddTHH:mm:ssZ` as specified by the ISO 8601 standard. + * + * @return the periodEndTime value + */ + public DateTime periodEndTime() { + return this.periodEndTime; + } + + /** + * Set the date of the end of Counter Period. The date conforms to the following format: `yyyy-MM-ddTHH:mm:ssZ` as specified by the ISO 8601 standard. + * + * @param periodEndTime the periodEndTime value to set + * @return the QuotaCounterContractInner object itself. + */ + public QuotaCounterContractInner withPeriodEndTime(DateTime periodEndTime) { + this.periodEndTime = periodEndTime; + return this; + } + + /** + * Get quota Value Properties. + * + * @return the value value + */ + public QuotaCounterValueContractProperties value() { + return this.value; + } + + /** + * Set quota Value Properties. + * + * @param value the value value to set + * @return the QuotaCounterContractInner object itself. + */ + public QuotaCounterContractInner withValue(QuotaCounterValueContractProperties value) { + this.value = value; + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/RecipientEmailCollectionImpl.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/RecipientEmailCollectionImpl.java new file mode 100644 index 0000000000000..b15c8a95fec3f --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/RecipientEmailCollectionImpl.java @@ -0,0 +1,37 @@ +/** + * 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.apimanagement.v2019_01_01.implementation; + +import com.microsoft.azure.management.apimanagement.v2019_01_01.RecipientEmailCollection; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import java.util.List; + +class RecipientEmailCollectionImpl extends WrapperImpl implements RecipientEmailCollection { + private final ApiManagementManager manager; + RecipientEmailCollectionImpl(RecipientEmailCollectionInner inner, ApiManagementManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public ApiManagementManager manager() { + return this.manager; + } + + @Override + public String nextLink() { + return this.inner().nextLink(); + } + + @Override + public List value() { + return this.inner().value(); + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/RecipientEmailCollectionInner.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/RecipientEmailCollectionInner.java new file mode 100644 index 0000000000000..9c876eebcf775 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/RecipientEmailCollectionInner.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.apimanagement.v2019_01_01.implementation; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Paged Recipient User list representation. + */ +public class RecipientEmailCollectionInner { + /** + * Page values. + */ + @JsonProperty(value = "value") + private List value; + + /** + * Next page link if any. + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** + * Get page values. + * + * @return the value value + */ + public List value() { + return this.value; + } + + /** + * Set page values. + * + * @param value the value value to set + * @return the RecipientEmailCollectionInner object itself. + */ + public RecipientEmailCollectionInner withValue(List value) { + this.value = value; + return this; + } + + /** + * Get next page link if any. + * + * @return the nextLink value + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set next page link if any. + * + * @param nextLink the nextLink value to set + * @return the RecipientEmailCollectionInner object itself. + */ + public RecipientEmailCollectionInner withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/RecipientEmailContractImpl.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/RecipientEmailContractImpl.java new file mode 100644 index 0000000000000..ec991e2934bbc --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/RecipientEmailContractImpl.java @@ -0,0 +1,103 @@ +/** + * 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.apimanagement.v2019_01_01.implementation; + +import com.microsoft.azure.management.apimanagement.v2019_01_01.RecipientEmailContract; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import com.microsoft.azure.management.apimanagement.v2019_01_01.NotificationName; + +class RecipientEmailContractImpl extends CreatableUpdatableImpl implements RecipientEmailContract, RecipientEmailContract.Definition, RecipientEmailContract.Update { + private final ApiManagementManager manager; + private String resourceGroupName; + private String serviceName; + private NotificationName notificationName; + private String email; + + RecipientEmailContractImpl(String name, ApiManagementManager manager) { + super(name, new RecipientEmailContractInner()); + this.manager = manager; + // Set resource name + this.email = name; + // + } + + RecipientEmailContractImpl(RecipientEmailContractInner inner, ApiManagementManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.email = inner.name(); + // set resource ancestor and positional variables + this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourceGroups"); + this.serviceName = IdParsingUtils.getValueFromIdByName(inner.id(), "service"); + this.notificationName = NotificationName.fromString(IdParsingUtils.getValueFromIdByName(inner.id(), "notifications")); + this.email = IdParsingUtils.getValueFromIdByName(inner.id(), "recipientEmails"); + // + } + + @Override + public ApiManagementManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + NotificationRecipientEmailsInner client = this.manager().inner().notificationRecipientEmails(); + return client.createOrUpdateAsync(this.resourceGroupName, this.serviceName, this.notificationName, this.email) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + NotificationRecipientEmailsInner client = this.manager().inner().notificationRecipientEmails(); + return client.createOrUpdateAsync(this.resourceGroupName, this.serviceName, this.notificationName, this.email) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + NotificationRecipientEmailsInner client = this.manager().inner().notificationRecipientEmails(); + return null; // NOP getInnerAsync implementation as get is not supported + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + + @Override + public String email() { + return this.inner().email(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public RecipientEmailContractImpl withExistingNotification(String resourceGroupName, String serviceName, NotificationName notificationName) { + this.resourceGroupName = resourceGroupName; + this.serviceName = serviceName; + this.notificationName = notificationName; + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/RecipientEmailContractInner.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/RecipientEmailContractInner.java new file mode 100644 index 0000000000000..77c30dfcb1784 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/RecipientEmailContractInner.java @@ -0,0 +1,46 @@ +/** + * 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.apimanagement.v2019_01_01.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * Recipient Email details. + */ +@JsonFlatten +public class RecipientEmailContractInner extends ProxyResource { + /** + * User Email subscribed to notification. + */ + @JsonProperty(value = "properties.email") + private String email; + + /** + * Get user Email subscribed to notification. + * + * @return the email value + */ + public String email() { + return this.email; + } + + /** + * Set user Email subscribed to notification. + * + * @param email the email value to set + * @return the RecipientEmailContractInner object itself. + */ + public RecipientEmailContractInner withEmail(String email) { + this.email = email; + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/RecipientUserCollectionImpl.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/RecipientUserCollectionImpl.java new file mode 100644 index 0000000000000..efbb8f44eb491 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/RecipientUserCollectionImpl.java @@ -0,0 +1,37 @@ +/** + * 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.apimanagement.v2019_01_01.implementation; + +import com.microsoft.azure.management.apimanagement.v2019_01_01.RecipientUserCollection; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import java.util.List; + +class RecipientUserCollectionImpl extends WrapperImpl implements RecipientUserCollection { + private final ApiManagementManager manager; + RecipientUserCollectionImpl(RecipientUserCollectionInner inner, ApiManagementManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public ApiManagementManager manager() { + return this.manager; + } + + @Override + public String nextLink() { + return this.inner().nextLink(); + } + + @Override + public List value() { + return this.inner().value(); + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/RecipientUserCollectionInner.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/RecipientUserCollectionInner.java new file mode 100644 index 0000000000000..48579f363f8d2 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/RecipientUserCollectionInner.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.apimanagement.v2019_01_01.implementation; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Paged Recipient User list representation. + */ +public class RecipientUserCollectionInner { + /** + * Page values. + */ + @JsonProperty(value = "value") + private List value; + + /** + * Next page link if any. + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** + * Get page values. + * + * @return the value value + */ + public List value() { + return this.value; + } + + /** + * Set page values. + * + * @param value the value value to set + * @return the RecipientUserCollectionInner object itself. + */ + public RecipientUserCollectionInner withValue(List value) { + this.value = value; + return this; + } + + /** + * Get next page link if any. + * + * @return the nextLink value + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set next page link if any. + * + * @param nextLink the nextLink value to set + * @return the RecipientUserCollectionInner object itself. + */ + public RecipientUserCollectionInner withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/RecipientUserContractImpl.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/RecipientUserContractImpl.java new file mode 100644 index 0000000000000..6c74d52d183d0 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/RecipientUserContractImpl.java @@ -0,0 +1,103 @@ +/** + * 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.apimanagement.v2019_01_01.implementation; + +import com.microsoft.azure.management.apimanagement.v2019_01_01.RecipientUserContract; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import com.microsoft.azure.management.apimanagement.v2019_01_01.NotificationName; + +class RecipientUserContractImpl extends CreatableUpdatableImpl implements RecipientUserContract, RecipientUserContract.Definition, RecipientUserContract.Update { + private final ApiManagementManager manager; + private String resourceGroupName; + private String serviceName; + private NotificationName notificationName; + private String userId; + + RecipientUserContractImpl(String name, ApiManagementManager manager) { + super(name, new RecipientUserContractInner()); + this.manager = manager; + // Set resource name + this.userId = name; + // + } + + RecipientUserContractImpl(RecipientUserContractInner inner, ApiManagementManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.userId = inner.name(); + // set resource ancestor and positional variables + this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourceGroups"); + this.serviceName = IdParsingUtils.getValueFromIdByName(inner.id(), "service"); + this.notificationName = NotificationName.fromString(IdParsingUtils.getValueFromIdByName(inner.id(), "notifications")); + this.userId = IdParsingUtils.getValueFromIdByName(inner.id(), "recipientUsers"); + // + } + + @Override + public ApiManagementManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + NotificationRecipientUsersInner client = this.manager().inner().notificationRecipientUsers(); + return client.createOrUpdateAsync(this.resourceGroupName, this.serviceName, this.notificationName, this.userId) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + NotificationRecipientUsersInner client = this.manager().inner().notificationRecipientUsers(); + return client.createOrUpdateAsync(this.resourceGroupName, this.serviceName, this.notificationName, this.userId) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + NotificationRecipientUsersInner client = this.manager().inner().notificationRecipientUsers(); + return null; // NOP getInnerAsync implementation as get is not supported + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public String userId() { + return this.inner().userId(); + } + + @Override + public RecipientUserContractImpl withExistingNotification(String resourceGroupName, String serviceName, NotificationName notificationName) { + this.resourceGroupName = resourceGroupName; + this.serviceName = serviceName; + this.notificationName = notificationName; + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/RecipientUserContractInner.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/RecipientUserContractInner.java new file mode 100644 index 0000000000000..0838e43d0ed96 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/RecipientUserContractInner.java @@ -0,0 +1,46 @@ +/** + * 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.apimanagement.v2019_01_01.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * Recipient User details. + */ +@JsonFlatten +public class RecipientUserContractInner extends ProxyResource { + /** + * API Management UserId subscribed to notification. + */ + @JsonProperty(value = "properties.userId") + private String userId; + + /** + * Get aPI Management UserId subscribed to notification. + * + * @return the userId value + */ + public String userId() { + return this.userId; + } + + /** + * Set aPI Management UserId subscribed to notification. + * + * @param userId the userId value to set + * @return the RecipientUserContractInner object itself. + */ + public RecipientUserContractInner withUserId(String userId) { + this.userId = userId; + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/RegionContractImpl.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/RegionContractImpl.java new file mode 100644 index 0000000000000..60353849631f0 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/RegionContractImpl.java @@ -0,0 +1,41 @@ +/** + * 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.apimanagement.v2019_01_01.implementation; + +import com.microsoft.azure.management.apimanagement.v2019_01_01.RegionContract; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; + +class RegionContractImpl extends WrapperImpl implements RegionContract { + private final ApiManagementManager manager; + RegionContractImpl(RegionContractInner inner, ApiManagementManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public ApiManagementManager manager() { + return this.manager; + } + + @Override + public Boolean isDeleted() { + return this.inner().isDeleted(); + } + + @Override + public Boolean isMasterRegion() { + return this.inner().isMasterRegion(); + } + + @Override + public String name() { + return this.inner().name(); + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/RegionContractInner.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/RegionContractInner.java new file mode 100644 index 0000000000000..c039813becf28 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/RegionContractInner.java @@ -0,0 +1,84 @@ +/** + * 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.apimanagement.v2019_01_01.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Region profile. + */ +public class RegionContractInner { + /** + * Region name. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /** + * whether Region is the master region. + */ + @JsonProperty(value = "isMasterRegion") + private Boolean isMasterRegion; + + /** + * whether Region is deleted. + */ + @JsonProperty(value = "isDeleted") + private Boolean isDeleted; + + /** + * Get region name. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Get whether Region is the master region. + * + * @return the isMasterRegion value + */ + public Boolean isMasterRegion() { + return this.isMasterRegion; + } + + /** + * Set whether Region is the master region. + * + * @param isMasterRegion the isMasterRegion value to set + * @return the RegionContractInner object itself. + */ + public RegionContractInner withIsMasterRegion(Boolean isMasterRegion) { + this.isMasterRegion = isMasterRegion; + return this; + } + + /** + * Get whether Region is deleted. + * + * @return the isDeleted value + */ + public Boolean isDeleted() { + return this.isDeleted; + } + + /** + * Set whether Region is deleted. + * + * @param isDeleted the isDeleted value to set + * @return the RegionContractInner object itself. + */ + public RegionContractInner withIsDeleted(Boolean isDeleted) { + this.isDeleted = isDeleted; + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/RegionsImpl.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/RegionsImpl.java new file mode 100644 index 0000000000000..eab65ba83800e --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/RegionsImpl.java @@ -0,0 +1,49 @@ +/** + * 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. + * abc + */ + +package com.microsoft.azure.management.apimanagement.v2019_01_01.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.apimanagement.v2019_01_01.Regions; +import rx.functions.Func1; +import rx.Observable; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.apimanagement.v2019_01_01.RegionContract; + +class RegionsImpl extends WrapperImpl implements Regions { + private final ApiManagementManager manager; + + RegionsImpl(ApiManagementManager manager) { + super(manager.inner().regions()); + this.manager = manager; + } + + public ApiManagementManager manager() { + return this.manager; + } + + @Override + public Observable listByServiceAsync(final String resourceGroupName, final String serviceName) { + RegionsInner client = this.inner(); + return client.listByServiceAsync(resourceGroupName, serviceName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public RegionContract call(RegionContractInner inner) { + return new RegionContractImpl(inner, manager()); + } + }); + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/RegionsInner.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/RegionsInner.java new file mode 100644 index 0000000000000..a746ae61bfe71 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/RegionsInner.java @@ -0,0 +1,303 @@ +/** + * 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.apimanagement.v2019_01_01.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.apimanagement.v2019_01_01.ErrorResponseException; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Path; +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 Regions. + */ +public class RegionsInner { + /** The Retrofit service to perform REST calls. */ + private RegionsService service; + /** The service client containing this operation class. */ + private ApiManagementClientImpl client; + + /** + * Initializes an instance of RegionsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public RegionsInner(Retrofit retrofit, ApiManagementClientImpl client) { + this.service = retrofit.create(RegionsService.class); + this.client = client; + } + + /** + * The interface defining all the services for Regions to be + * used by Retrofit to perform actually REST calls. + */ + interface RegionsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.apimanagement.v2019_01_01.Regions listByService" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/regions") + Observable> listByService(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("subscriptionId") String subscriptionId, @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.apimanagement.v2019_01_01.Regions listByServiceNext" }) + @GET + Observable> listByServiceNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Lists all azure regions in which the service exists. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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<RegionContractInner> object if successful. + */ + public PagedList listByService(final String resourceGroupName, final String serviceName) { + ServiceResponse> response = listByServiceSinglePageAsync(resourceGroupName, serviceName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByServiceNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists all azure regions in which the service exists. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @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> listByServiceAsync(final String resourceGroupName, final String serviceName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByServiceSinglePageAsync(resourceGroupName, serviceName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByServiceNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists all azure regions in which the service exists. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<RegionContractInner> object + */ + public Observable> listByServiceAsync(final String resourceGroupName, final String serviceName) { + return listByServiceWithServiceResponseAsync(resourceGroupName, serviceName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all azure regions in which the service exists. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<RegionContractInner> object + */ + public Observable>> listByServiceWithServiceResponseAsync(final String resourceGroupName, final String serviceName) { + return listByServiceSinglePageAsync(resourceGroupName, serviceName) + .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(listByServiceNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists all azure regions in which the service exists. + * + ServiceResponse> * @param resourceGroupName The name of the resource group. + ServiceResponse> * @param serviceName The name of the API Management service. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<RegionContractInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByServiceSinglePageAsync(final String resourceGroupName, final String serviceName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + 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.listByService(resourceGroupName, serviceName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByServiceDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByServiceDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists all azure regions in which the service exists. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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<RegionContractInner> object if successful. + */ + public PagedList listByServiceNext(final String nextPageLink) { + ServiceResponse> response = listByServiceNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByServiceNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists all azure regions in which the service exists. + * + * @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> listByServiceNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByServiceNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByServiceNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists all azure regions in which the service exists. + * + * @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<RegionContractInner> object + */ + public Observable> listByServiceNextAsync(final String nextPageLink) { + return listByServiceNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all azure regions in which the service exists. + * + * @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<RegionContractInner> object + */ + public Observable>> listByServiceNextWithServiceResponseAsync(final String nextPageLink) { + return listByServiceNextSinglePageAsync(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(listByServiceNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists all azure regions in which the service exists. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<RegionContractInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByServiceNextSinglePageAsync(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.listByServiceNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByServiceNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByServiceNextDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ReportRecordContractImpl.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ReportRecordContractImpl.java new file mode 100644 index 0000000000000..846e37f0e92f0 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ReportRecordContractImpl.java @@ -0,0 +1,157 @@ +/** + * 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.apimanagement.v2019_01_01.implementation; + +import com.microsoft.azure.management.apimanagement.v2019_01_01.ReportRecordContract; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import org.joda.time.DateTime; + +class ReportRecordContractImpl extends WrapperImpl implements ReportRecordContract { + private final ApiManagementManager manager; + ReportRecordContractImpl(ReportRecordContractInner inner, ApiManagementManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public ApiManagementManager manager() { + return this.manager; + } + + @Override + public String apiId() { + return this.inner().apiId(); + } + + @Override + public String apiRegion() { + return this.inner().apiRegion(); + } + + @Override + public Double apiTimeAvg() { + return this.inner().apiTimeAvg(); + } + + @Override + public Double apiTimeMax() { + return this.inner().apiTimeMax(); + } + + @Override + public Double apiTimeMin() { + return this.inner().apiTimeMin(); + } + + @Override + public Long bandwidth() { + return this.inner().bandwidth(); + } + + @Override + public Integer cacheHitCount() { + return this.inner().cacheHitCount(); + } + + @Override + public Integer cacheMissCount() { + return this.inner().cacheMissCount(); + } + + @Override + public Integer callCountBlocked() { + return this.inner().callCountBlocked(); + } + + @Override + public Integer callCountFailed() { + return this.inner().callCountFailed(); + } + + @Override + public Integer callCountOther() { + return this.inner().callCountOther(); + } + + @Override + public Integer callCountSuccess() { + return this.inner().callCountSuccess(); + } + + @Override + public Integer callCountTotal() { + return this.inner().callCountTotal(); + } + + @Override + public String country() { + return this.inner().country(); + } + + @Override + public String interval() { + return this.inner().interval(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public String operationId() { + return this.inner().operationId(); + } + + @Override + public String productId() { + return this.inner().productId(); + } + + @Override + public String region() { + return this.inner().region(); + } + + @Override + public Double serviceTimeAvg() { + return this.inner().serviceTimeAvg(); + } + + @Override + public Double serviceTimeMax() { + return this.inner().serviceTimeMax(); + } + + @Override + public Double serviceTimeMin() { + return this.inner().serviceTimeMin(); + } + + @Override + public String subscriptionId() { + return this.inner().subscriptionId(); + } + + @Override + public DateTime timestamp() { + return this.inner().timestamp(); + } + + @Override + public String userId() { + return this.inner().userId(); + } + + @Override + public String zip() { + return this.inner().zip(); + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ReportRecordContractInner.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ReportRecordContractInner.java new file mode 100644 index 0000000000000..1a407883826c3 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ReportRecordContractInner.java @@ -0,0 +1,682 @@ +/** + * 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.apimanagement.v2019_01_01.implementation; + +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Report data. + */ +public class ReportRecordContractInner { + /** + * Name depending on report endpoint specifies product, API, operation or + * developer name. + */ + @JsonProperty(value = "name") + private String name; + + /** + * Start of aggregation period. The date conforms to the following format: + * `yyyy-MM-ddTHH:mm:ssZ` as specified by the ISO 8601 standard. + */ + @JsonProperty(value = "timestamp") + private DateTime timestamp; + + /** + * Length of aggregation period. Interval must be multiple of 15 minutes + * and may not be zero. The value should be in ISO 8601 format + * (http://en.wikipedia.org/wiki/ISO_8601#Durations). + */ + @JsonProperty(value = "interval") + private String interval; + + /** + * Country to which this record data is related. + */ + @JsonProperty(value = "country") + private String country; + + /** + * Country region to which this record data is related. + */ + @JsonProperty(value = "region") + private String region; + + /** + * Zip code to which this record data is related. + */ + @JsonProperty(value = "zip") + private String zip; + + /** + * User identifier path. /users/{userId}. + */ + @JsonProperty(value = "userId", access = JsonProperty.Access.WRITE_ONLY) + private String userId; + + /** + * Product identifier path. /products/{productId}. + */ + @JsonProperty(value = "productId", access = JsonProperty.Access.WRITE_ONLY) + private String productId; + + /** + * API identifier path. /apis/{apiId}. + */ + @JsonProperty(value = "apiId") + private String apiId; + + /** + * Operation identifier path. /apis/{apiId}/operations/{operationId}. + */ + @JsonProperty(value = "operationId") + private String operationId; + + /** + * API region identifier. + */ + @JsonProperty(value = "apiRegion") + private String apiRegion; + + /** + * Subscription identifier path. /subscriptions/{subscriptionId}. + */ + @JsonProperty(value = "subscriptionId") + private String subscriptionId; + + /** + * Number of successful calls. This includes calls returning HttpStatusCode + * <= 301 and HttpStatusCode.NotModified and + * HttpStatusCode.TemporaryRedirect. + */ + @JsonProperty(value = "callCountSuccess") + private Integer callCountSuccess; + + /** + * Number of calls blocked due to invalid credentials. This includes calls + * returning HttpStatusCode.Unauthorized and HttpStatusCode.Forbidden and + * HttpStatusCode.TooManyRequests. + */ + @JsonProperty(value = "callCountBlocked") + private Integer callCountBlocked; + + /** + * Number of calls failed due to proxy or backend errors. This includes + * calls returning HttpStatusCode.BadRequest(400) and any Code between + * HttpStatusCode.InternalServerError (500) and 600. + */ + @JsonProperty(value = "callCountFailed") + private Integer callCountFailed; + + /** + * Number of other calls. + */ + @JsonProperty(value = "callCountOther") + private Integer callCountOther; + + /** + * Total number of calls. + */ + @JsonProperty(value = "callCountTotal") + private Integer callCountTotal; + + /** + * Bandwidth consumed. + */ + @JsonProperty(value = "bandwidth") + private Long bandwidth; + + /** + * Number of times when content was served from cache policy. + */ + @JsonProperty(value = "cacheHitCount") + private Integer cacheHitCount; + + /** + * Number of times content was fetched from backend. + */ + @JsonProperty(value = "cacheMissCount") + private Integer cacheMissCount; + + /** + * Average time it took to process request. + */ + @JsonProperty(value = "apiTimeAvg") + private Double apiTimeAvg; + + /** + * Minimum time it took to process request. + */ + @JsonProperty(value = "apiTimeMin") + private Double apiTimeMin; + + /** + * Maximum time it took to process request. + */ + @JsonProperty(value = "apiTimeMax") + private Double apiTimeMax; + + /** + * Average time it took to process request on backend. + */ + @JsonProperty(value = "serviceTimeAvg") + private Double serviceTimeAvg; + + /** + * Minimum time it took to process request on backend. + */ + @JsonProperty(value = "serviceTimeMin") + private Double serviceTimeMin; + + /** + * Maximum time it took to process request on backend. + */ + @JsonProperty(value = "serviceTimeMax") + private Double serviceTimeMax; + + /** + * Get name depending on report endpoint specifies product, API, operation or developer name. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set name depending on report endpoint specifies product, API, operation or developer name. + * + * @param name the name value to set + * @return the ReportRecordContractInner object itself. + */ + public ReportRecordContractInner withName(String name) { + this.name = name; + return this; + } + + /** + * Get start of aggregation period. The date conforms to the following format: `yyyy-MM-ddTHH:mm:ssZ` as specified by the ISO 8601 standard. + * + * @return the timestamp value + */ + public DateTime timestamp() { + return this.timestamp; + } + + /** + * Set start of aggregation period. The date conforms to the following format: `yyyy-MM-ddTHH:mm:ssZ` as specified by the ISO 8601 standard. + * + * @param timestamp the timestamp value to set + * @return the ReportRecordContractInner object itself. + */ + public ReportRecordContractInner withTimestamp(DateTime timestamp) { + this.timestamp = timestamp; + return this; + } + + /** + * Get length of aggregation period. Interval must be multiple of 15 minutes and may not be zero. The value should be in ISO 8601 format (http://en.wikipedia.org/wiki/ISO_8601#Durations). + * + * @return the interval value + */ + public String interval() { + return this.interval; + } + + /** + * Set length of aggregation period. Interval must be multiple of 15 minutes and may not be zero. The value should be in ISO 8601 format (http://en.wikipedia.org/wiki/ISO_8601#Durations). + * + * @param interval the interval value to set + * @return the ReportRecordContractInner object itself. + */ + public ReportRecordContractInner withInterval(String interval) { + this.interval = interval; + return this; + } + + /** + * Get country to which this record data is related. + * + * @return the country value + */ + public String country() { + return this.country; + } + + /** + * Set country to which this record data is related. + * + * @param country the country value to set + * @return the ReportRecordContractInner object itself. + */ + public ReportRecordContractInner withCountry(String country) { + this.country = country; + return this; + } + + /** + * Get country region to which this record data is related. + * + * @return the region value + */ + public String region() { + return this.region; + } + + /** + * Set country region to which this record data is related. + * + * @param region the region value to set + * @return the ReportRecordContractInner object itself. + */ + public ReportRecordContractInner withRegion(String region) { + this.region = region; + return this; + } + + /** + * Get zip code to which this record data is related. + * + * @return the zip value + */ + public String zip() { + return this.zip; + } + + /** + * Set zip code to which this record data is related. + * + * @param zip the zip value to set + * @return the ReportRecordContractInner object itself. + */ + public ReportRecordContractInner withZip(String zip) { + this.zip = zip; + return this; + } + + /** + * Get user identifier path. /users/{userId}. + * + * @return the userId value + */ + public String userId() { + return this.userId; + } + + /** + * Get product identifier path. /products/{productId}. + * + * @return the productId value + */ + public String productId() { + return this.productId; + } + + /** + * Get aPI identifier path. /apis/{apiId}. + * + * @return the apiId value + */ + public String apiId() { + return this.apiId; + } + + /** + * Set aPI identifier path. /apis/{apiId}. + * + * @param apiId the apiId value to set + * @return the ReportRecordContractInner object itself. + */ + public ReportRecordContractInner withApiId(String apiId) { + this.apiId = apiId; + return this; + } + + /** + * Get operation identifier path. /apis/{apiId}/operations/{operationId}. + * + * @return the operationId value + */ + public String operationId() { + return this.operationId; + } + + /** + * Set operation identifier path. /apis/{apiId}/operations/{operationId}. + * + * @param operationId the operationId value to set + * @return the ReportRecordContractInner object itself. + */ + public ReportRecordContractInner withOperationId(String operationId) { + this.operationId = operationId; + return this; + } + + /** + * Get aPI region identifier. + * + * @return the apiRegion value + */ + public String apiRegion() { + return this.apiRegion; + } + + /** + * Set aPI region identifier. + * + * @param apiRegion the apiRegion value to set + * @return the ReportRecordContractInner object itself. + */ + public ReportRecordContractInner withApiRegion(String apiRegion) { + this.apiRegion = apiRegion; + return this; + } + + /** + * Get subscription identifier path. /subscriptions/{subscriptionId}. + * + * @return the subscriptionId value + */ + public String subscriptionId() { + return this.subscriptionId; + } + + /** + * Set subscription identifier path. /subscriptions/{subscriptionId}. + * + * @param subscriptionId the subscriptionId value to set + * @return the ReportRecordContractInner object itself. + */ + public ReportRecordContractInner withSubscriptionId(String subscriptionId) { + this.subscriptionId = subscriptionId; + return this; + } + + /** + * Get number of successful calls. This includes calls returning HttpStatusCode <= 301 and HttpStatusCode.NotModified and HttpStatusCode.TemporaryRedirect. + * + * @return the callCountSuccess value + */ + public Integer callCountSuccess() { + return this.callCountSuccess; + } + + /** + * Set number of successful calls. This includes calls returning HttpStatusCode <= 301 and HttpStatusCode.NotModified and HttpStatusCode.TemporaryRedirect. + * + * @param callCountSuccess the callCountSuccess value to set + * @return the ReportRecordContractInner object itself. + */ + public ReportRecordContractInner withCallCountSuccess(Integer callCountSuccess) { + this.callCountSuccess = callCountSuccess; + return this; + } + + /** + * Get number of calls blocked due to invalid credentials. This includes calls returning HttpStatusCode.Unauthorized and HttpStatusCode.Forbidden and HttpStatusCode.TooManyRequests. + * + * @return the callCountBlocked value + */ + public Integer callCountBlocked() { + return this.callCountBlocked; + } + + /** + * Set number of calls blocked due to invalid credentials. This includes calls returning HttpStatusCode.Unauthorized and HttpStatusCode.Forbidden and HttpStatusCode.TooManyRequests. + * + * @param callCountBlocked the callCountBlocked value to set + * @return the ReportRecordContractInner object itself. + */ + public ReportRecordContractInner withCallCountBlocked(Integer callCountBlocked) { + this.callCountBlocked = callCountBlocked; + return this; + } + + /** + * Get number of calls failed due to proxy or backend errors. This includes calls returning HttpStatusCode.BadRequest(400) and any Code between HttpStatusCode.InternalServerError (500) and 600. + * + * @return the callCountFailed value + */ + public Integer callCountFailed() { + return this.callCountFailed; + } + + /** + * Set number of calls failed due to proxy or backend errors. This includes calls returning HttpStatusCode.BadRequest(400) and any Code between HttpStatusCode.InternalServerError (500) and 600. + * + * @param callCountFailed the callCountFailed value to set + * @return the ReportRecordContractInner object itself. + */ + public ReportRecordContractInner withCallCountFailed(Integer callCountFailed) { + this.callCountFailed = callCountFailed; + return this; + } + + /** + * Get number of other calls. + * + * @return the callCountOther value + */ + public Integer callCountOther() { + return this.callCountOther; + } + + /** + * Set number of other calls. + * + * @param callCountOther the callCountOther value to set + * @return the ReportRecordContractInner object itself. + */ + public ReportRecordContractInner withCallCountOther(Integer callCountOther) { + this.callCountOther = callCountOther; + return this; + } + + /** + * Get total number of calls. + * + * @return the callCountTotal value + */ + public Integer callCountTotal() { + return this.callCountTotal; + } + + /** + * Set total number of calls. + * + * @param callCountTotal the callCountTotal value to set + * @return the ReportRecordContractInner object itself. + */ + public ReportRecordContractInner withCallCountTotal(Integer callCountTotal) { + this.callCountTotal = callCountTotal; + return this; + } + + /** + * Get bandwidth consumed. + * + * @return the bandwidth value + */ + public Long bandwidth() { + return this.bandwidth; + } + + /** + * Set bandwidth consumed. + * + * @param bandwidth the bandwidth value to set + * @return the ReportRecordContractInner object itself. + */ + public ReportRecordContractInner withBandwidth(Long bandwidth) { + this.bandwidth = bandwidth; + return this; + } + + /** + * Get number of times when content was served from cache policy. + * + * @return the cacheHitCount value + */ + public Integer cacheHitCount() { + return this.cacheHitCount; + } + + /** + * Set number of times when content was served from cache policy. + * + * @param cacheHitCount the cacheHitCount value to set + * @return the ReportRecordContractInner object itself. + */ + public ReportRecordContractInner withCacheHitCount(Integer cacheHitCount) { + this.cacheHitCount = cacheHitCount; + return this; + } + + /** + * Get number of times content was fetched from backend. + * + * @return the cacheMissCount value + */ + public Integer cacheMissCount() { + return this.cacheMissCount; + } + + /** + * Set number of times content was fetched from backend. + * + * @param cacheMissCount the cacheMissCount value to set + * @return the ReportRecordContractInner object itself. + */ + public ReportRecordContractInner withCacheMissCount(Integer cacheMissCount) { + this.cacheMissCount = cacheMissCount; + return this; + } + + /** + * Get average time it took to process request. + * + * @return the apiTimeAvg value + */ + public Double apiTimeAvg() { + return this.apiTimeAvg; + } + + /** + * Set average time it took to process request. + * + * @param apiTimeAvg the apiTimeAvg value to set + * @return the ReportRecordContractInner object itself. + */ + public ReportRecordContractInner withApiTimeAvg(Double apiTimeAvg) { + this.apiTimeAvg = apiTimeAvg; + return this; + } + + /** + * Get minimum time it took to process request. + * + * @return the apiTimeMin value + */ + public Double apiTimeMin() { + return this.apiTimeMin; + } + + /** + * Set minimum time it took to process request. + * + * @param apiTimeMin the apiTimeMin value to set + * @return the ReportRecordContractInner object itself. + */ + public ReportRecordContractInner withApiTimeMin(Double apiTimeMin) { + this.apiTimeMin = apiTimeMin; + return this; + } + + /** + * Get maximum time it took to process request. + * + * @return the apiTimeMax value + */ + public Double apiTimeMax() { + return this.apiTimeMax; + } + + /** + * Set maximum time it took to process request. + * + * @param apiTimeMax the apiTimeMax value to set + * @return the ReportRecordContractInner object itself. + */ + public ReportRecordContractInner withApiTimeMax(Double apiTimeMax) { + this.apiTimeMax = apiTimeMax; + return this; + } + + /** + * Get average time it took to process request on backend. + * + * @return the serviceTimeAvg value + */ + public Double serviceTimeAvg() { + return this.serviceTimeAvg; + } + + /** + * Set average time it took to process request on backend. + * + * @param serviceTimeAvg the serviceTimeAvg value to set + * @return the ReportRecordContractInner object itself. + */ + public ReportRecordContractInner withServiceTimeAvg(Double serviceTimeAvg) { + this.serviceTimeAvg = serviceTimeAvg; + return this; + } + + /** + * Get minimum time it took to process request on backend. + * + * @return the serviceTimeMin value + */ + public Double serviceTimeMin() { + return this.serviceTimeMin; + } + + /** + * Set minimum time it took to process request on backend. + * + * @param serviceTimeMin the serviceTimeMin value to set + * @return the ReportRecordContractInner object itself. + */ + public ReportRecordContractInner withServiceTimeMin(Double serviceTimeMin) { + this.serviceTimeMin = serviceTimeMin; + return this; + } + + /** + * Get maximum time it took to process request on backend. + * + * @return the serviceTimeMax value + */ + public Double serviceTimeMax() { + return this.serviceTimeMax; + } + + /** + * Set maximum time it took to process request on backend. + * + * @param serviceTimeMax the serviceTimeMax value to set + * @return the ReportRecordContractInner object itself. + */ + public ReportRecordContractInner withServiceTimeMax(Double serviceTimeMax) { + this.serviceTimeMax = serviceTimeMax; + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ReportsImpl.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ReportsImpl.java new file mode 100644 index 0000000000000..70c6f51c91c6e --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ReportsImpl.java @@ -0,0 +1,178 @@ +/** + * 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. + * abc + */ + +package com.microsoft.azure.management.apimanagement.v2019_01_01.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.apimanagement.v2019_01_01.Reports; +import rx.functions.Func1; +import rx.Observable; +import com.microsoft.azure.Page; +import java.util.List; +import com.microsoft.azure.management.apimanagement.v2019_01_01.ReportRecordContract; +import com.microsoft.azure.management.apimanagement.v2019_01_01.RequestReportRecordContract; +import org.joda.time.Period; + +class ReportsImpl extends WrapperImpl implements Reports { + private final ApiManagementManager manager; + + ReportsImpl(ApiManagementManager manager) { + super(manager.inner().reports()); + this.manager = manager; + } + + public ApiManagementManager manager() { + return this.manager; + } + + @Override + public Observable listByApiAsync(final String resourceGroupName, final String serviceName, final String filter) { + ReportsInner client = this.inner(); + return client.listByApiAsync(resourceGroupName, serviceName, filter) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public ReportRecordContract call(ReportRecordContractInner inner) { + return new ReportRecordContractImpl(inner, manager()); + } + }); + } + + @Override + public Observable listByUserAsync(final String resourceGroupName, final String serviceName, final String filter) { + ReportsInner client = this.inner(); + return client.listByUserAsync(resourceGroupName, serviceName, filter) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public ReportRecordContract call(ReportRecordContractInner inner) { + return new ReportRecordContractImpl(inner, manager()); + } + }); + } + + @Override + public Observable listByOperationAsync(final String resourceGroupName, final String serviceName, final String filter) { + ReportsInner client = this.inner(); + return client.listByOperationAsync(resourceGroupName, serviceName, filter) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public ReportRecordContract call(ReportRecordContractInner inner) { + return new ReportRecordContractImpl(inner, manager()); + } + }); + } + + @Override + public Observable listByProductAsync(final String resourceGroupName, final String serviceName, final String filter) { + ReportsInner client = this.inner(); + return client.listByProductAsync(resourceGroupName, serviceName, filter) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public ReportRecordContract call(ReportRecordContractInner inner) { + return new ReportRecordContractImpl(inner, manager()); + } + }); + } + + @Override + public Observable listByGeoAsync(final String resourceGroupName, final String serviceName, final String filter) { + ReportsInner client = this.inner(); + return client.listByGeoAsync(resourceGroupName, serviceName, filter) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public ReportRecordContract call(ReportRecordContractInner inner) { + return new ReportRecordContractImpl(inner, manager()); + } + }); + } + + @Override + public Observable listBySubscriptionAsync(final String resourceGroupName, final String serviceName, final String filter) { + ReportsInner client = this.inner(); + return client.listBySubscriptionAsync(resourceGroupName, serviceName, filter) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public ReportRecordContract call(ReportRecordContractInner inner) { + return new ReportRecordContractImpl(inner, manager()); + } + }); + } + + @Override + public Observable listByTimeAsync(final String resourceGroupName, final String serviceName, final String filter, final Period interval) { + ReportsInner client = this.inner(); + return client.listByTimeAsync(resourceGroupName, serviceName, filter, interval) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public ReportRecordContract call(ReportRecordContractInner inner) { + return new ReportRecordContractImpl(inner, manager()); + } + }); + } + + @Override + public Observable listByRequestAsync(String resourceGroupName, String serviceName, String filter) { + ReportsInner client = this.inner(); + return client.listByRequestAsync(resourceGroupName, serviceName, filter) + .flatMap(new Func1, Observable>() { + @Override + public Observable call(List innerList) { + return Observable.from(innerList); + } + }) + .map(new Func1() { + @Override + public RequestReportRecordContract call(RequestReportRecordContractInner inner) { + return new RequestReportRecordContractImpl(inner, manager()); + } + }); + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ReportsInner.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ReportsInner.java new file mode 100644 index 0000000000000..3770dc54fd4c9 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ReportsInner.java @@ -0,0 +1,3020 @@ +/** + * 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.apimanagement.v2019_01_01.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.CloudException; +import com.microsoft.azure.ListOperationCallback; +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 org.joda.time.Period; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Path; +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 Reports. + */ +public class ReportsInner { + /** The Retrofit service to perform REST calls. */ + private ReportsService service; + /** The service client containing this operation class. */ + private ApiManagementClientImpl client; + + /** + * Initializes an instance of ReportsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public ReportsInner(Retrofit retrofit, ApiManagementClientImpl client) { + this.service = retrofit.create(ReportsService.class); + this.client = client; + } + + /** + * The interface defining all the services for Reports to be + * used by Retrofit to perform actually REST calls. + */ + interface ReportsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.apimanagement.v2019_01_01.Reports listByApi" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/reports/byApi") + Observable> listByApi(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("subscriptionId") String subscriptionId, @Query("$filter") String filter, @Query("$top") Integer top, @Query("$skip") Integer skip, @Query("$orderby") String orderby, @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.apimanagement.v2019_01_01.Reports listByUser" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/reports/byUser") + Observable> listByUser(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("subscriptionId") String subscriptionId, @Query("$filter") String filter, @Query("$top") Integer top, @Query("$skip") Integer skip, @Query("$orderby") String orderby, @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.apimanagement.v2019_01_01.Reports listByOperation" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/reports/byOperation") + Observable> listByOperation(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("subscriptionId") String subscriptionId, @Query("$filter") String filter, @Query("$top") Integer top, @Query("$skip") Integer skip, @Query("$orderby") String orderby, @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.apimanagement.v2019_01_01.Reports listByProduct" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/reports/byProduct") + Observable> listByProduct(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("subscriptionId") String subscriptionId, @Query("$filter") String filter, @Query("$top") Integer top, @Query("$skip") Integer skip, @Query("$orderby") String orderby, @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.apimanagement.v2019_01_01.Reports listByGeo" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/reports/byGeo") + Observable> listByGeo(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("subscriptionId") String subscriptionId, @Query("$filter") String filter, @Query("$top") Integer top, @Query("$skip") Integer skip, @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.apimanagement.v2019_01_01.Reports listBySubscription" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/reports/bySubscription") + Observable> listBySubscription(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("subscriptionId") String subscriptionId, @Query("$filter") String filter, @Query("$top") Integer top, @Query("$skip") Integer skip, @Query("$orderby") String orderby, @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.apimanagement.v2019_01_01.Reports listByTime" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/reports/byTime") + Observable> listByTime(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("subscriptionId") String subscriptionId, @Query("$filter") String filter, @Query("$top") Integer top, @Query("$skip") Integer skip, @Query("$orderby") String orderby, @Query("interval") Period interval, @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.apimanagement.v2019_01_01.Reports listByRequest" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/reports/byRequest") + Observable> listByRequest(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("subscriptionId") String subscriptionId, @Query("$filter") String filter, @Query("$top") Integer top, @Query("$skip") Integer skip, @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.apimanagement.v2019_01_01.Reports listByApiNext" }) + @GET + Observable> listByApiNext(@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.apimanagement.v2019_01_01.Reports listByUserNext" }) + @GET + Observable> listByUserNext(@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.apimanagement.v2019_01_01.Reports listByOperationNext" }) + @GET + Observable> listByOperationNext(@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.apimanagement.v2019_01_01.Reports listByProductNext" }) + @GET + Observable> listByProductNext(@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.apimanagement.v2019_01_01.Reports listByGeoNext" }) + @GET + Observable> listByGeoNext(@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.apimanagement.v2019_01_01.Reports listBySubscriptionNext" }) + @GET + Observable> listBySubscriptionNext(@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.apimanagement.v2019_01_01.Reports listByTimeNext" }) + @GET + Observable> listByTimeNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Lists report records by API. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param filter The filter to apply on the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException 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<ReportRecordContractInner> object if successful. + */ + public PagedList listByApi(final String resourceGroupName, final String serviceName, final String filter) { + ServiceResponse> response = listByApiSinglePageAsync(resourceGroupName, serviceName, filter).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByApiNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists report records by API. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param filter The filter to apply on the operation. + * @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> listByApiAsync(final String resourceGroupName, final String serviceName, final String filter, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByApiSinglePageAsync(resourceGroupName, serviceName, filter), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByApiNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists report records by API. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param filter The filter to apply on the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ReportRecordContractInner> object + */ + public Observable> listByApiAsync(final String resourceGroupName, final String serviceName, final String filter) { + return listByApiWithServiceResponseAsync(resourceGroupName, serviceName, filter) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists report records by API. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param filter The filter to apply on the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ReportRecordContractInner> object + */ + public Observable>> listByApiWithServiceResponseAsync(final String resourceGroupName, final String serviceName, final String filter) { + return listByApiSinglePageAsync(resourceGroupName, serviceName, filter) + .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(listByApiNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists report records by API. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param filter The filter to apply on the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ReportRecordContractInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByApiSinglePageAsync(final String resourceGroupName, final String serviceName, final String filter) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (filter == null) { + throw new IllegalArgumentException("Parameter filter 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 Integer top = null; + final Integer skip = null; + final String orderby = null; + return service.listByApi(resourceGroupName, serviceName, this.client.subscriptionId(), filter, top, skip, orderby, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByApiDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Lists report records by API. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param filter The filter to apply on the operation. + * @param top Number of records to return. + * @param skip Number of records to skip. + * @param orderby OData order by query option. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException 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<ReportRecordContractInner> object if successful. + */ + public PagedList listByApi(final String resourceGroupName, final String serviceName, final String filter, final Integer top, final Integer skip, final String orderby) { + ServiceResponse> response = listByApiSinglePageAsync(resourceGroupName, serviceName, filter, top, skip, orderby).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByApiNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists report records by API. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param filter The filter to apply on the operation. + * @param top Number of records to return. + * @param skip Number of records to skip. + * @param orderby OData order by query option. + * @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> listByApiAsync(final String resourceGroupName, final String serviceName, final String filter, final Integer top, final Integer skip, final String orderby, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByApiSinglePageAsync(resourceGroupName, serviceName, filter, top, skip, orderby), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByApiNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists report records by API. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param filter The filter to apply on the operation. + * @param top Number of records to return. + * @param skip Number of records to skip. + * @param orderby OData order by query option. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ReportRecordContractInner> object + */ + public Observable> listByApiAsync(final String resourceGroupName, final String serviceName, final String filter, final Integer top, final Integer skip, final String orderby) { + return listByApiWithServiceResponseAsync(resourceGroupName, serviceName, filter, top, skip, orderby) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists report records by API. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param filter The filter to apply on the operation. + * @param top Number of records to return. + * @param skip Number of records to skip. + * @param orderby OData order by query option. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ReportRecordContractInner> object + */ + public Observable>> listByApiWithServiceResponseAsync(final String resourceGroupName, final String serviceName, final String filter, final Integer top, final Integer skip, final String orderby) { + return listByApiSinglePageAsync(resourceGroupName, serviceName, filter, top, skip, orderby) + .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(listByApiNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists report records by API. + * + ServiceResponse> * @param resourceGroupName The name of the resource group. + ServiceResponse> * @param serviceName The name of the API Management service. + ServiceResponse> * @param filter The filter to apply on the operation. + ServiceResponse> * @param top Number of records to return. + ServiceResponse> * @param skip Number of records to skip. + ServiceResponse> * @param orderby OData order by query option. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ReportRecordContractInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByApiSinglePageAsync(final String resourceGroupName, final String serviceName, final String filter, final Integer top, final Integer skip, final String orderby) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (filter == null) { + throw new IllegalArgumentException("Parameter filter 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.listByApi(resourceGroupName, serviceName, this.client.subscriptionId(), filter, top, skip, orderby, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByApiDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByApiDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Lists report records by User. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| timestamp | filter | ge, le | | </br>| displayName | select, orderBy | | | </br>| userId | select, filter | eq | | </br>| apiRegion | filter | eq | | </br>| productId | filter | eq | | </br>| subscriptionId | filter | eq | | </br>| apiId | filter | eq | | </br>| operationId | filter | eq | | </br>| callCountSuccess | select, orderBy | | | </br>| callCountBlocked | select, orderBy | | | </br>| callCountFailed | select, orderBy | | | </br>| callCountOther | select, orderBy | | | </br>| callCountTotal | select, orderBy | | | </br>| bandwidth | select, orderBy | | | </br>| cacheHitsCount | select | | | </br>| cacheMissCount | select | | | </br>| apiTimeAvg | select, orderBy | | | </br>| apiTimeMin | select | | | </br>| apiTimeMax | select | | | </br>| serviceTimeAvg | select | | | </br>| serviceTimeMin | select | | | </br>| serviceTimeMax | select | | | </br> + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException 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<ReportRecordContractInner> object if successful. + */ + public PagedList listByUser(final String resourceGroupName, final String serviceName, final String filter) { + ServiceResponse> response = listByUserSinglePageAsync(resourceGroupName, serviceName, filter).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByUserNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists report records by User. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| timestamp | filter | ge, le | | </br>| displayName | select, orderBy | | | </br>| userId | select, filter | eq | | </br>| apiRegion | filter | eq | | </br>| productId | filter | eq | | </br>| subscriptionId | filter | eq | | </br>| apiId | filter | eq | | </br>| operationId | filter | eq | | </br>| callCountSuccess | select, orderBy | | | </br>| callCountBlocked | select, orderBy | | | </br>| callCountFailed | select, orderBy | | | </br>| callCountOther | select, orderBy | | | </br>| callCountTotal | select, orderBy | | | </br>| bandwidth | select, orderBy | | | </br>| cacheHitsCount | select | | | </br>| cacheMissCount | select | | | </br>| apiTimeAvg | select, orderBy | | | </br>| apiTimeMin | select | | | </br>| apiTimeMax | select | | | </br>| serviceTimeAvg | select | | | </br>| serviceTimeMin | select | | | </br>| serviceTimeMax | select | | | </br> + * @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> listByUserAsync(final String resourceGroupName, final String serviceName, final String filter, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByUserSinglePageAsync(resourceGroupName, serviceName, filter), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByUserNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists report records by User. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| timestamp | filter | ge, le | | </br>| displayName | select, orderBy | | | </br>| userId | select, filter | eq | | </br>| apiRegion | filter | eq | | </br>| productId | filter | eq | | </br>| subscriptionId | filter | eq | | </br>| apiId | filter | eq | | </br>| operationId | filter | eq | | </br>| callCountSuccess | select, orderBy | | | </br>| callCountBlocked | select, orderBy | | | </br>| callCountFailed | select, orderBy | | | </br>| callCountOther | select, orderBy | | | </br>| callCountTotal | select, orderBy | | | </br>| bandwidth | select, orderBy | | | </br>| cacheHitsCount | select | | | </br>| cacheMissCount | select | | | </br>| apiTimeAvg | select, orderBy | | | </br>| apiTimeMin | select | | | </br>| apiTimeMax | select | | | </br>| serviceTimeAvg | select | | | </br>| serviceTimeMin | select | | | </br>| serviceTimeMax | select | | | </br> + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ReportRecordContractInner> object + */ + public Observable> listByUserAsync(final String resourceGroupName, final String serviceName, final String filter) { + return listByUserWithServiceResponseAsync(resourceGroupName, serviceName, filter) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists report records by User. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| timestamp | filter | ge, le | | </br>| displayName | select, orderBy | | | </br>| userId | select, filter | eq | | </br>| apiRegion | filter | eq | | </br>| productId | filter | eq | | </br>| subscriptionId | filter | eq | | </br>| apiId | filter | eq | | </br>| operationId | filter | eq | | </br>| callCountSuccess | select, orderBy | | | </br>| callCountBlocked | select, orderBy | | | </br>| callCountFailed | select, orderBy | | | </br>| callCountOther | select, orderBy | | | </br>| callCountTotal | select, orderBy | | | </br>| bandwidth | select, orderBy | | | </br>| cacheHitsCount | select | | | </br>| cacheMissCount | select | | | </br>| apiTimeAvg | select, orderBy | | | </br>| apiTimeMin | select | | | </br>| apiTimeMax | select | | | </br>| serviceTimeAvg | select | | | </br>| serviceTimeMin | select | | | </br>| serviceTimeMax | select | | | </br> + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ReportRecordContractInner> object + */ + public Observable>> listByUserWithServiceResponseAsync(final String resourceGroupName, final String serviceName, final String filter) { + return listByUserSinglePageAsync(resourceGroupName, serviceName, filter) + .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(listByUserNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists report records by User. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| timestamp | filter | ge, le | | </br>| displayName | select, orderBy | | | </br>| userId | select, filter | eq | | </br>| apiRegion | filter | eq | | </br>| productId | filter | eq | | </br>| subscriptionId | filter | eq | | </br>| apiId | filter | eq | | </br>| operationId | filter | eq | | </br>| callCountSuccess | select, orderBy | | | </br>| callCountBlocked | select, orderBy | | | </br>| callCountFailed | select, orderBy | | | </br>| callCountOther | select, orderBy | | | </br>| callCountTotal | select, orderBy | | | </br>| bandwidth | select, orderBy | | | </br>| cacheHitsCount | select | | | </br>| cacheMissCount | select | | | </br>| apiTimeAvg | select, orderBy | | | </br>| apiTimeMin | select | | | </br>| apiTimeMax | select | | | </br>| serviceTimeAvg | select | | | </br>| serviceTimeMin | select | | | </br>| serviceTimeMax | select | | | </br> + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ReportRecordContractInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByUserSinglePageAsync(final String resourceGroupName, final String serviceName, final String filter) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (filter == null) { + throw new IllegalArgumentException("Parameter filter 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 Integer top = null; + final Integer skip = null; + final String orderby = null; + return service.listByUser(resourceGroupName, serviceName, this.client.subscriptionId(), filter, top, skip, orderby, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByUserDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Lists report records by User. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| timestamp | filter | ge, le | | </br>| displayName | select, orderBy | | | </br>| userId | select, filter | eq | | </br>| apiRegion | filter | eq | | </br>| productId | filter | eq | | </br>| subscriptionId | filter | eq | | </br>| apiId | filter | eq | | </br>| operationId | filter | eq | | </br>| callCountSuccess | select, orderBy | | | </br>| callCountBlocked | select, orderBy | | | </br>| callCountFailed | select, orderBy | | | </br>| callCountOther | select, orderBy | | | </br>| callCountTotal | select, orderBy | | | </br>| bandwidth | select, orderBy | | | </br>| cacheHitsCount | select | | | </br>| cacheMissCount | select | | | </br>| apiTimeAvg | select, orderBy | | | </br>| apiTimeMin | select | | | </br>| apiTimeMax | select | | | </br>| serviceTimeAvg | select | | | </br>| serviceTimeMin | select | | | </br>| serviceTimeMax | select | | | </br> + * @param top Number of records to return. + * @param skip Number of records to skip. + * @param orderby OData order by query option. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException 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<ReportRecordContractInner> object if successful. + */ + public PagedList listByUser(final String resourceGroupName, final String serviceName, final String filter, final Integer top, final Integer skip, final String orderby) { + ServiceResponse> response = listByUserSinglePageAsync(resourceGroupName, serviceName, filter, top, skip, orderby).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByUserNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists report records by User. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| timestamp | filter | ge, le | | </br>| displayName | select, orderBy | | | </br>| userId | select, filter | eq | | </br>| apiRegion | filter | eq | | </br>| productId | filter | eq | | </br>| subscriptionId | filter | eq | | </br>| apiId | filter | eq | | </br>| operationId | filter | eq | | </br>| callCountSuccess | select, orderBy | | | </br>| callCountBlocked | select, orderBy | | | </br>| callCountFailed | select, orderBy | | | </br>| callCountOther | select, orderBy | | | </br>| callCountTotal | select, orderBy | | | </br>| bandwidth | select, orderBy | | | </br>| cacheHitsCount | select | | | </br>| cacheMissCount | select | | | </br>| apiTimeAvg | select, orderBy | | | </br>| apiTimeMin | select | | | </br>| apiTimeMax | select | | | </br>| serviceTimeAvg | select | | | </br>| serviceTimeMin | select | | | </br>| serviceTimeMax | select | | | </br> + * @param top Number of records to return. + * @param skip Number of records to skip. + * @param orderby OData order by query option. + * @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> listByUserAsync(final String resourceGroupName, final String serviceName, final String filter, final Integer top, final Integer skip, final String orderby, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByUserSinglePageAsync(resourceGroupName, serviceName, filter, top, skip, orderby), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByUserNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists report records by User. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| timestamp | filter | ge, le | | </br>| displayName | select, orderBy | | | </br>| userId | select, filter | eq | | </br>| apiRegion | filter | eq | | </br>| productId | filter | eq | | </br>| subscriptionId | filter | eq | | </br>| apiId | filter | eq | | </br>| operationId | filter | eq | | </br>| callCountSuccess | select, orderBy | | | </br>| callCountBlocked | select, orderBy | | | </br>| callCountFailed | select, orderBy | | | </br>| callCountOther | select, orderBy | | | </br>| callCountTotal | select, orderBy | | | </br>| bandwidth | select, orderBy | | | </br>| cacheHitsCount | select | | | </br>| cacheMissCount | select | | | </br>| apiTimeAvg | select, orderBy | | | </br>| apiTimeMin | select | | | </br>| apiTimeMax | select | | | </br>| serviceTimeAvg | select | | | </br>| serviceTimeMin | select | | | </br>| serviceTimeMax | select | | | </br> + * @param top Number of records to return. + * @param skip Number of records to skip. + * @param orderby OData order by query option. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ReportRecordContractInner> object + */ + public Observable> listByUserAsync(final String resourceGroupName, final String serviceName, final String filter, final Integer top, final Integer skip, final String orderby) { + return listByUserWithServiceResponseAsync(resourceGroupName, serviceName, filter, top, skip, orderby) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists report records by User. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| timestamp | filter | ge, le | | </br>| displayName | select, orderBy | | | </br>| userId | select, filter | eq | | </br>| apiRegion | filter | eq | | </br>| productId | filter | eq | | </br>| subscriptionId | filter | eq | | </br>| apiId | filter | eq | | </br>| operationId | filter | eq | | </br>| callCountSuccess | select, orderBy | | | </br>| callCountBlocked | select, orderBy | | | </br>| callCountFailed | select, orderBy | | | </br>| callCountOther | select, orderBy | | | </br>| callCountTotal | select, orderBy | | | </br>| bandwidth | select, orderBy | | | </br>| cacheHitsCount | select | | | </br>| cacheMissCount | select | | | </br>| apiTimeAvg | select, orderBy | | | </br>| apiTimeMin | select | | | </br>| apiTimeMax | select | | | </br>| serviceTimeAvg | select | | | </br>| serviceTimeMin | select | | | </br>| serviceTimeMax | select | | | </br> + * @param top Number of records to return. + * @param skip Number of records to skip. + * @param orderby OData order by query option. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ReportRecordContractInner> object + */ + public Observable>> listByUserWithServiceResponseAsync(final String resourceGroupName, final String serviceName, final String filter, final Integer top, final Integer skip, final String orderby) { + return listByUserSinglePageAsync(resourceGroupName, serviceName, filter, top, skip, orderby) + .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(listByUserNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists report records by User. + * + ServiceResponse> * @param resourceGroupName The name of the resource group. + ServiceResponse> * @param serviceName The name of the API Management service. + ServiceResponse> * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| timestamp | filter | ge, le | | </br>| displayName | select, orderBy | | | </br>| userId | select, filter | eq | | </br>| apiRegion | filter | eq | | </br>| productId | filter | eq | | </br>| subscriptionId | filter | eq | | </br>| apiId | filter | eq | | </br>| operationId | filter | eq | | </br>| callCountSuccess | select, orderBy | | | </br>| callCountBlocked | select, orderBy | | | </br>| callCountFailed | select, orderBy | | | </br>| callCountOther | select, orderBy | | | </br>| callCountTotal | select, orderBy | | | </br>| bandwidth | select, orderBy | | | </br>| cacheHitsCount | select | | | </br>| cacheMissCount | select | | | </br>| apiTimeAvg | select, orderBy | | | </br>| apiTimeMin | select | | | </br>| apiTimeMax | select | | | </br>| serviceTimeAvg | select | | | </br>| serviceTimeMin | select | | | </br>| serviceTimeMax | select | | | </br> + ServiceResponse> * @param top Number of records to return. + ServiceResponse> * @param skip Number of records to skip. + ServiceResponse> * @param orderby OData order by query option. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ReportRecordContractInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByUserSinglePageAsync(final String resourceGroupName, final String serviceName, final String filter, final Integer top, final Integer skip, final String orderby) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (filter == null) { + throw new IllegalArgumentException("Parameter filter 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.listByUser(resourceGroupName, serviceName, this.client.subscriptionId(), filter, top, skip, orderby, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByUserDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByUserDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Lists report records by API Operations. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| timestamp | filter | ge, le | | </br>| displayName | select, orderBy | | | </br>| apiRegion | filter | eq | | </br>| userId | filter | eq | | </br>| productId | filter | eq | | </br>| subscriptionId | filter | eq | | </br>| apiId | filter | eq | | </br>| operationId | select, filter | eq | | </br>| callCountSuccess | select, orderBy | | | </br>| callCountBlocked | select, orderBy | | | </br>| callCountFailed | select, orderBy | | | </br>| callCountOther | select, orderBy | | | </br>| callCountTotal | select, orderBy | | | </br>| bandwidth | select, orderBy | | | </br>| cacheHitsCount | select | | | </br>| cacheMissCount | select | | | </br>| apiTimeAvg | select, orderBy | | | </br>| apiTimeMin | select | | | </br>| apiTimeMax | select | | | </br>| serviceTimeAvg | select | | | </br>| serviceTimeMin | select | | | </br>| serviceTimeMax | select | | | </br> + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException 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<ReportRecordContractInner> object if successful. + */ + public PagedList listByOperation(final String resourceGroupName, final String serviceName, final String filter) { + ServiceResponse> response = listByOperationSinglePageAsync(resourceGroupName, serviceName, filter).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByOperationNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists report records by API Operations. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| timestamp | filter | ge, le | | </br>| displayName | select, orderBy | | | </br>| apiRegion | filter | eq | | </br>| userId | filter | eq | | </br>| productId | filter | eq | | </br>| subscriptionId | filter | eq | | </br>| apiId | filter | eq | | </br>| operationId | select, filter | eq | | </br>| callCountSuccess | select, orderBy | | | </br>| callCountBlocked | select, orderBy | | | </br>| callCountFailed | select, orderBy | | | </br>| callCountOther | select, orderBy | | | </br>| callCountTotal | select, orderBy | | | </br>| bandwidth | select, orderBy | | | </br>| cacheHitsCount | select | | | </br>| cacheMissCount | select | | | </br>| apiTimeAvg | select, orderBy | | | </br>| apiTimeMin | select | | | </br>| apiTimeMax | select | | | </br>| serviceTimeAvg | select | | | </br>| serviceTimeMin | select | | | </br>| serviceTimeMax | select | | | </br> + * @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> listByOperationAsync(final String resourceGroupName, final String serviceName, final String filter, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByOperationSinglePageAsync(resourceGroupName, serviceName, filter), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByOperationNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists report records by API Operations. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| timestamp | filter | ge, le | | </br>| displayName | select, orderBy | | | </br>| apiRegion | filter | eq | | </br>| userId | filter | eq | | </br>| productId | filter | eq | | </br>| subscriptionId | filter | eq | | </br>| apiId | filter | eq | | </br>| operationId | select, filter | eq | | </br>| callCountSuccess | select, orderBy | | | </br>| callCountBlocked | select, orderBy | | | </br>| callCountFailed | select, orderBy | | | </br>| callCountOther | select, orderBy | | | </br>| callCountTotal | select, orderBy | | | </br>| bandwidth | select, orderBy | | | </br>| cacheHitsCount | select | | | </br>| cacheMissCount | select | | | </br>| apiTimeAvg | select, orderBy | | | </br>| apiTimeMin | select | | | </br>| apiTimeMax | select | | | </br>| serviceTimeAvg | select | | | </br>| serviceTimeMin | select | | | </br>| serviceTimeMax | select | | | </br> + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ReportRecordContractInner> object + */ + public Observable> listByOperationAsync(final String resourceGroupName, final String serviceName, final String filter) { + return listByOperationWithServiceResponseAsync(resourceGroupName, serviceName, filter) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists report records by API Operations. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| timestamp | filter | ge, le | | </br>| displayName | select, orderBy | | | </br>| apiRegion | filter | eq | | </br>| userId | filter | eq | | </br>| productId | filter | eq | | </br>| subscriptionId | filter | eq | | </br>| apiId | filter | eq | | </br>| operationId | select, filter | eq | | </br>| callCountSuccess | select, orderBy | | | </br>| callCountBlocked | select, orderBy | | | </br>| callCountFailed | select, orderBy | | | </br>| callCountOther | select, orderBy | | | </br>| callCountTotal | select, orderBy | | | </br>| bandwidth | select, orderBy | | | </br>| cacheHitsCount | select | | | </br>| cacheMissCount | select | | | </br>| apiTimeAvg | select, orderBy | | | </br>| apiTimeMin | select | | | </br>| apiTimeMax | select | | | </br>| serviceTimeAvg | select | | | </br>| serviceTimeMin | select | | | </br>| serviceTimeMax | select | | | </br> + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ReportRecordContractInner> object + */ + public Observable>> listByOperationWithServiceResponseAsync(final String resourceGroupName, final String serviceName, final String filter) { + return listByOperationSinglePageAsync(resourceGroupName, serviceName, filter) + .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(listByOperationNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists report records by API Operations. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| timestamp | filter | ge, le | | </br>| displayName | select, orderBy | | | </br>| apiRegion | filter | eq | | </br>| userId | filter | eq | | </br>| productId | filter | eq | | </br>| subscriptionId | filter | eq | | </br>| apiId | filter | eq | | </br>| operationId | select, filter | eq | | </br>| callCountSuccess | select, orderBy | | | </br>| callCountBlocked | select, orderBy | | | </br>| callCountFailed | select, orderBy | | | </br>| callCountOther | select, orderBy | | | </br>| callCountTotal | select, orderBy | | | </br>| bandwidth | select, orderBy | | | </br>| cacheHitsCount | select | | | </br>| cacheMissCount | select | | | </br>| apiTimeAvg | select, orderBy | | | </br>| apiTimeMin | select | | | </br>| apiTimeMax | select | | | </br>| serviceTimeAvg | select | | | </br>| serviceTimeMin | select | | | </br>| serviceTimeMax | select | | | </br> + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ReportRecordContractInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByOperationSinglePageAsync(final String resourceGroupName, final String serviceName, final String filter) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (filter == null) { + throw new IllegalArgumentException("Parameter filter 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 Integer top = null; + final Integer skip = null; + final String orderby = null; + return service.listByOperation(resourceGroupName, serviceName, this.client.subscriptionId(), filter, top, skip, orderby, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByOperationDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Lists report records by API Operations. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| timestamp | filter | ge, le | | </br>| displayName | select, orderBy | | | </br>| apiRegion | filter | eq | | </br>| userId | filter | eq | | </br>| productId | filter | eq | | </br>| subscriptionId | filter | eq | | </br>| apiId | filter | eq | | </br>| operationId | select, filter | eq | | </br>| callCountSuccess | select, orderBy | | | </br>| callCountBlocked | select, orderBy | | | </br>| callCountFailed | select, orderBy | | | </br>| callCountOther | select, orderBy | | | </br>| callCountTotal | select, orderBy | | | </br>| bandwidth | select, orderBy | | | </br>| cacheHitsCount | select | | | </br>| cacheMissCount | select | | | </br>| apiTimeAvg | select, orderBy | | | </br>| apiTimeMin | select | | | </br>| apiTimeMax | select | | | </br>| serviceTimeAvg | select | | | </br>| serviceTimeMin | select | | | </br>| serviceTimeMax | select | | | </br> + * @param top Number of records to return. + * @param skip Number of records to skip. + * @param orderby OData order by query option. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException 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<ReportRecordContractInner> object if successful. + */ + public PagedList listByOperation(final String resourceGroupName, final String serviceName, final String filter, final Integer top, final Integer skip, final String orderby) { + ServiceResponse> response = listByOperationSinglePageAsync(resourceGroupName, serviceName, filter, top, skip, orderby).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByOperationNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists report records by API Operations. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| timestamp | filter | ge, le | | </br>| displayName | select, orderBy | | | </br>| apiRegion | filter | eq | | </br>| userId | filter | eq | | </br>| productId | filter | eq | | </br>| subscriptionId | filter | eq | | </br>| apiId | filter | eq | | </br>| operationId | select, filter | eq | | </br>| callCountSuccess | select, orderBy | | | </br>| callCountBlocked | select, orderBy | | | </br>| callCountFailed | select, orderBy | | | </br>| callCountOther | select, orderBy | | | </br>| callCountTotal | select, orderBy | | | </br>| bandwidth | select, orderBy | | | </br>| cacheHitsCount | select | | | </br>| cacheMissCount | select | | | </br>| apiTimeAvg | select, orderBy | | | </br>| apiTimeMin | select | | | </br>| apiTimeMax | select | | | </br>| serviceTimeAvg | select | | | </br>| serviceTimeMin | select | | | </br>| serviceTimeMax | select | | | </br> + * @param top Number of records to return. + * @param skip Number of records to skip. + * @param orderby OData order by query option. + * @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> listByOperationAsync(final String resourceGroupName, final String serviceName, final String filter, final Integer top, final Integer skip, final String orderby, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByOperationSinglePageAsync(resourceGroupName, serviceName, filter, top, skip, orderby), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByOperationNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists report records by API Operations. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| timestamp | filter | ge, le | | </br>| displayName | select, orderBy | | | </br>| apiRegion | filter | eq | | </br>| userId | filter | eq | | </br>| productId | filter | eq | | </br>| subscriptionId | filter | eq | | </br>| apiId | filter | eq | | </br>| operationId | select, filter | eq | | </br>| callCountSuccess | select, orderBy | | | </br>| callCountBlocked | select, orderBy | | | </br>| callCountFailed | select, orderBy | | | </br>| callCountOther | select, orderBy | | | </br>| callCountTotal | select, orderBy | | | </br>| bandwidth | select, orderBy | | | </br>| cacheHitsCount | select | | | </br>| cacheMissCount | select | | | </br>| apiTimeAvg | select, orderBy | | | </br>| apiTimeMin | select | | | </br>| apiTimeMax | select | | | </br>| serviceTimeAvg | select | | | </br>| serviceTimeMin | select | | | </br>| serviceTimeMax | select | | | </br> + * @param top Number of records to return. + * @param skip Number of records to skip. + * @param orderby OData order by query option. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ReportRecordContractInner> object + */ + public Observable> listByOperationAsync(final String resourceGroupName, final String serviceName, final String filter, final Integer top, final Integer skip, final String orderby) { + return listByOperationWithServiceResponseAsync(resourceGroupName, serviceName, filter, top, skip, orderby) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists report records by API Operations. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| timestamp | filter | ge, le | | </br>| displayName | select, orderBy | | | </br>| apiRegion | filter | eq | | </br>| userId | filter | eq | | </br>| productId | filter | eq | | </br>| subscriptionId | filter | eq | | </br>| apiId | filter | eq | | </br>| operationId | select, filter | eq | | </br>| callCountSuccess | select, orderBy | | | </br>| callCountBlocked | select, orderBy | | | </br>| callCountFailed | select, orderBy | | | </br>| callCountOther | select, orderBy | | | </br>| callCountTotal | select, orderBy | | | </br>| bandwidth | select, orderBy | | | </br>| cacheHitsCount | select | | | </br>| cacheMissCount | select | | | </br>| apiTimeAvg | select, orderBy | | | </br>| apiTimeMin | select | | | </br>| apiTimeMax | select | | | </br>| serviceTimeAvg | select | | | </br>| serviceTimeMin | select | | | </br>| serviceTimeMax | select | | | </br> + * @param top Number of records to return. + * @param skip Number of records to skip. + * @param orderby OData order by query option. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ReportRecordContractInner> object + */ + public Observable>> listByOperationWithServiceResponseAsync(final String resourceGroupName, final String serviceName, final String filter, final Integer top, final Integer skip, final String orderby) { + return listByOperationSinglePageAsync(resourceGroupName, serviceName, filter, top, skip, orderby) + .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(listByOperationNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists report records by API Operations. + * + ServiceResponse> * @param resourceGroupName The name of the resource group. + ServiceResponse> * @param serviceName The name of the API Management service. + ServiceResponse> * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| timestamp | filter | ge, le | | </br>| displayName | select, orderBy | | | </br>| apiRegion | filter | eq | | </br>| userId | filter | eq | | </br>| productId | filter | eq | | </br>| subscriptionId | filter | eq | | </br>| apiId | filter | eq | | </br>| operationId | select, filter | eq | | </br>| callCountSuccess | select, orderBy | | | </br>| callCountBlocked | select, orderBy | | | </br>| callCountFailed | select, orderBy | | | </br>| callCountOther | select, orderBy | | | </br>| callCountTotal | select, orderBy | | | </br>| bandwidth | select, orderBy | | | </br>| cacheHitsCount | select | | | </br>| cacheMissCount | select | | | </br>| apiTimeAvg | select, orderBy | | | </br>| apiTimeMin | select | | | </br>| apiTimeMax | select | | | </br>| serviceTimeAvg | select | | | </br>| serviceTimeMin | select | | | </br>| serviceTimeMax | select | | | </br> + ServiceResponse> * @param top Number of records to return. + ServiceResponse> * @param skip Number of records to skip. + ServiceResponse> * @param orderby OData order by query option. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ReportRecordContractInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByOperationSinglePageAsync(final String resourceGroupName, final String serviceName, final String filter, final Integer top, final Integer skip, final String orderby) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (filter == null) { + throw new IllegalArgumentException("Parameter filter 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.listByOperation(resourceGroupName, serviceName, this.client.subscriptionId(), filter, top, skip, orderby, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByOperationDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByOperationDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Lists report records by Product. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| timestamp | filter | ge, le | | </br>| displayName | select, orderBy | | | </br>| apiRegion | filter | eq | | </br>| userId | filter | eq | | </br>| productId | select, filter | eq | | </br>| subscriptionId | filter | eq | | </br>| callCountSuccess | select, orderBy | | | </br>| callCountBlocked | select, orderBy | | | </br>| callCountFailed | select, orderBy | | | </br>| callCountOther | select, orderBy | | | </br>| callCountTotal | select, orderBy | | | </br>| bandwidth | select, orderBy | | | </br>| cacheHitsCount | select | | | </br>| cacheMissCount | select | | | </br>| apiTimeAvg | select, orderBy | | | </br>| apiTimeMin | select | | | </br>| apiTimeMax | select | | | </br>| serviceTimeAvg | select | | | </br>| serviceTimeMin | select | | | </br>| serviceTimeMax | select | | | </br> + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException 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<ReportRecordContractInner> object if successful. + */ + public PagedList listByProduct(final String resourceGroupName, final String serviceName, final String filter) { + ServiceResponse> response = listByProductSinglePageAsync(resourceGroupName, serviceName, filter).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByProductNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists report records by Product. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| timestamp | filter | ge, le | | </br>| displayName | select, orderBy | | | </br>| apiRegion | filter | eq | | </br>| userId | filter | eq | | </br>| productId | select, filter | eq | | </br>| subscriptionId | filter | eq | | </br>| callCountSuccess | select, orderBy | | | </br>| callCountBlocked | select, orderBy | | | </br>| callCountFailed | select, orderBy | | | </br>| callCountOther | select, orderBy | | | </br>| callCountTotal | select, orderBy | | | </br>| bandwidth | select, orderBy | | | </br>| cacheHitsCount | select | | | </br>| cacheMissCount | select | | | </br>| apiTimeAvg | select, orderBy | | | </br>| apiTimeMin | select | | | </br>| apiTimeMax | select | | | </br>| serviceTimeAvg | select | | | </br>| serviceTimeMin | select | | | </br>| serviceTimeMax | select | | | </br> + * @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> listByProductAsync(final String resourceGroupName, final String serviceName, final String filter, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByProductSinglePageAsync(resourceGroupName, serviceName, filter), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByProductNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists report records by Product. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| timestamp | filter | ge, le | | </br>| displayName | select, orderBy | | | </br>| apiRegion | filter | eq | | </br>| userId | filter | eq | | </br>| productId | select, filter | eq | | </br>| subscriptionId | filter | eq | | </br>| callCountSuccess | select, orderBy | | | </br>| callCountBlocked | select, orderBy | | | </br>| callCountFailed | select, orderBy | | | </br>| callCountOther | select, orderBy | | | </br>| callCountTotal | select, orderBy | | | </br>| bandwidth | select, orderBy | | | </br>| cacheHitsCount | select | | | </br>| cacheMissCount | select | | | </br>| apiTimeAvg | select, orderBy | | | </br>| apiTimeMin | select | | | </br>| apiTimeMax | select | | | </br>| serviceTimeAvg | select | | | </br>| serviceTimeMin | select | | | </br>| serviceTimeMax | select | | | </br> + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ReportRecordContractInner> object + */ + public Observable> listByProductAsync(final String resourceGroupName, final String serviceName, final String filter) { + return listByProductWithServiceResponseAsync(resourceGroupName, serviceName, filter) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists report records by Product. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| timestamp | filter | ge, le | | </br>| displayName | select, orderBy | | | </br>| apiRegion | filter | eq | | </br>| userId | filter | eq | | </br>| productId | select, filter | eq | | </br>| subscriptionId | filter | eq | | </br>| callCountSuccess | select, orderBy | | | </br>| callCountBlocked | select, orderBy | | | </br>| callCountFailed | select, orderBy | | | </br>| callCountOther | select, orderBy | | | </br>| callCountTotal | select, orderBy | | | </br>| bandwidth | select, orderBy | | | </br>| cacheHitsCount | select | | | </br>| cacheMissCount | select | | | </br>| apiTimeAvg | select, orderBy | | | </br>| apiTimeMin | select | | | </br>| apiTimeMax | select | | | </br>| serviceTimeAvg | select | | | </br>| serviceTimeMin | select | | | </br>| serviceTimeMax | select | | | </br> + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ReportRecordContractInner> object + */ + public Observable>> listByProductWithServiceResponseAsync(final String resourceGroupName, final String serviceName, final String filter) { + return listByProductSinglePageAsync(resourceGroupName, serviceName, filter) + .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(listByProductNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists report records by Product. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| timestamp | filter | ge, le | | </br>| displayName | select, orderBy | | | </br>| apiRegion | filter | eq | | </br>| userId | filter | eq | | </br>| productId | select, filter | eq | | </br>| subscriptionId | filter | eq | | </br>| callCountSuccess | select, orderBy | | | </br>| callCountBlocked | select, orderBy | | | </br>| callCountFailed | select, orderBy | | | </br>| callCountOther | select, orderBy | | | </br>| callCountTotal | select, orderBy | | | </br>| bandwidth | select, orderBy | | | </br>| cacheHitsCount | select | | | </br>| cacheMissCount | select | | | </br>| apiTimeAvg | select, orderBy | | | </br>| apiTimeMin | select | | | </br>| apiTimeMax | select | | | </br>| serviceTimeAvg | select | | | </br>| serviceTimeMin | select | | | </br>| serviceTimeMax | select | | | </br> + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ReportRecordContractInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByProductSinglePageAsync(final String resourceGroupName, final String serviceName, final String filter) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (filter == null) { + throw new IllegalArgumentException("Parameter filter 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 Integer top = null; + final Integer skip = null; + final String orderby = null; + return service.listByProduct(resourceGroupName, serviceName, this.client.subscriptionId(), filter, top, skip, orderby, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByProductDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Lists report records by Product. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| timestamp | filter | ge, le | | </br>| displayName | select, orderBy | | | </br>| apiRegion | filter | eq | | </br>| userId | filter | eq | | </br>| productId | select, filter | eq | | </br>| subscriptionId | filter | eq | | </br>| callCountSuccess | select, orderBy | | | </br>| callCountBlocked | select, orderBy | | | </br>| callCountFailed | select, orderBy | | | </br>| callCountOther | select, orderBy | | | </br>| callCountTotal | select, orderBy | | | </br>| bandwidth | select, orderBy | | | </br>| cacheHitsCount | select | | | </br>| cacheMissCount | select | | | </br>| apiTimeAvg | select, orderBy | | | </br>| apiTimeMin | select | | | </br>| apiTimeMax | select | | | </br>| serviceTimeAvg | select | | | </br>| serviceTimeMin | select | | | </br>| serviceTimeMax | select | | | </br> + * @param top Number of records to return. + * @param skip Number of records to skip. + * @param orderby OData order by query option. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException 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<ReportRecordContractInner> object if successful. + */ + public PagedList listByProduct(final String resourceGroupName, final String serviceName, final String filter, final Integer top, final Integer skip, final String orderby) { + ServiceResponse> response = listByProductSinglePageAsync(resourceGroupName, serviceName, filter, top, skip, orderby).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByProductNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists report records by Product. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| timestamp | filter | ge, le | | </br>| displayName | select, orderBy | | | </br>| apiRegion | filter | eq | | </br>| userId | filter | eq | | </br>| productId | select, filter | eq | | </br>| subscriptionId | filter | eq | | </br>| callCountSuccess | select, orderBy | | | </br>| callCountBlocked | select, orderBy | | | </br>| callCountFailed | select, orderBy | | | </br>| callCountOther | select, orderBy | | | </br>| callCountTotal | select, orderBy | | | </br>| bandwidth | select, orderBy | | | </br>| cacheHitsCount | select | | | </br>| cacheMissCount | select | | | </br>| apiTimeAvg | select, orderBy | | | </br>| apiTimeMin | select | | | </br>| apiTimeMax | select | | | </br>| serviceTimeAvg | select | | | </br>| serviceTimeMin | select | | | </br>| serviceTimeMax | select | | | </br> + * @param top Number of records to return. + * @param skip Number of records to skip. + * @param orderby OData order by query option. + * @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> listByProductAsync(final String resourceGroupName, final String serviceName, final String filter, final Integer top, final Integer skip, final String orderby, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByProductSinglePageAsync(resourceGroupName, serviceName, filter, top, skip, orderby), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByProductNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists report records by Product. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| timestamp | filter | ge, le | | </br>| displayName | select, orderBy | | | </br>| apiRegion | filter | eq | | </br>| userId | filter | eq | | </br>| productId | select, filter | eq | | </br>| subscriptionId | filter | eq | | </br>| callCountSuccess | select, orderBy | | | </br>| callCountBlocked | select, orderBy | | | </br>| callCountFailed | select, orderBy | | | </br>| callCountOther | select, orderBy | | | </br>| callCountTotal | select, orderBy | | | </br>| bandwidth | select, orderBy | | | </br>| cacheHitsCount | select | | | </br>| cacheMissCount | select | | | </br>| apiTimeAvg | select, orderBy | | | </br>| apiTimeMin | select | | | </br>| apiTimeMax | select | | | </br>| serviceTimeAvg | select | | | </br>| serviceTimeMin | select | | | </br>| serviceTimeMax | select | | | </br> + * @param top Number of records to return. + * @param skip Number of records to skip. + * @param orderby OData order by query option. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ReportRecordContractInner> object + */ + public Observable> listByProductAsync(final String resourceGroupName, final String serviceName, final String filter, final Integer top, final Integer skip, final String orderby) { + return listByProductWithServiceResponseAsync(resourceGroupName, serviceName, filter, top, skip, orderby) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists report records by Product. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| timestamp | filter | ge, le | | </br>| displayName | select, orderBy | | | </br>| apiRegion | filter | eq | | </br>| userId | filter | eq | | </br>| productId | select, filter | eq | | </br>| subscriptionId | filter | eq | | </br>| callCountSuccess | select, orderBy | | | </br>| callCountBlocked | select, orderBy | | | </br>| callCountFailed | select, orderBy | | | </br>| callCountOther | select, orderBy | | | </br>| callCountTotal | select, orderBy | | | </br>| bandwidth | select, orderBy | | | </br>| cacheHitsCount | select | | | </br>| cacheMissCount | select | | | </br>| apiTimeAvg | select, orderBy | | | </br>| apiTimeMin | select | | | </br>| apiTimeMax | select | | | </br>| serviceTimeAvg | select | | | </br>| serviceTimeMin | select | | | </br>| serviceTimeMax | select | | | </br> + * @param top Number of records to return. + * @param skip Number of records to skip. + * @param orderby OData order by query option. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ReportRecordContractInner> object + */ + public Observable>> listByProductWithServiceResponseAsync(final String resourceGroupName, final String serviceName, final String filter, final Integer top, final Integer skip, final String orderby) { + return listByProductSinglePageAsync(resourceGroupName, serviceName, filter, top, skip, orderby) + .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(listByProductNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists report records by Product. + * + ServiceResponse> * @param resourceGroupName The name of the resource group. + ServiceResponse> * @param serviceName The name of the API Management service. + ServiceResponse> * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| timestamp | filter | ge, le | | </br>| displayName | select, orderBy | | | </br>| apiRegion | filter | eq | | </br>| userId | filter | eq | | </br>| productId | select, filter | eq | | </br>| subscriptionId | filter | eq | | </br>| callCountSuccess | select, orderBy | | | </br>| callCountBlocked | select, orderBy | | | </br>| callCountFailed | select, orderBy | | | </br>| callCountOther | select, orderBy | | | </br>| callCountTotal | select, orderBy | | | </br>| bandwidth | select, orderBy | | | </br>| cacheHitsCount | select | | | </br>| cacheMissCount | select | | | </br>| apiTimeAvg | select, orderBy | | | </br>| apiTimeMin | select | | | </br>| apiTimeMax | select | | | </br>| serviceTimeAvg | select | | | </br>| serviceTimeMin | select | | | </br>| serviceTimeMax | select | | | </br> + ServiceResponse> * @param top Number of records to return. + ServiceResponse> * @param skip Number of records to skip. + ServiceResponse> * @param orderby OData order by query option. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ReportRecordContractInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByProductSinglePageAsync(final String resourceGroupName, final String serviceName, final String filter, final Integer top, final Integer skip, final String orderby) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (filter == null) { + throw new IllegalArgumentException("Parameter filter 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.listByProduct(resourceGroupName, serviceName, this.client.subscriptionId(), filter, top, skip, orderby, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByProductDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByProductDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Lists report records by geography. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| timestamp | filter | ge, le | | </br>| country | select | | | </br>| region | select | | | </br>| zip | select | | | </br>| apiRegion | filter | eq | | </br>| userId | filter | eq | | </br>| productId | filter | eq | | </br>| subscriptionId | filter | eq | | </br>| apiId | filter | eq | | </br>| operationId | filter | eq | | </br>| callCountSuccess | select | | | </br>| callCountBlocked | select | | | </br>| callCountFailed | select | | | </br>| callCountOther | select | | | </br>| bandwidth | select, orderBy | | | </br>| cacheHitsCount | select | | | </br>| cacheMissCount | select | | | </br>| apiTimeAvg | select | | | </br>| apiTimeMin | select | | | </br>| apiTimeMax | select | | | </br>| serviceTimeAvg | select | | | </br>| serviceTimeMin | select | | | </br>| serviceTimeMax | select | | | </br> + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException 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<ReportRecordContractInner> object if successful. + */ + public PagedList listByGeo(final String resourceGroupName, final String serviceName, final String filter) { + ServiceResponse> response = listByGeoSinglePageAsync(resourceGroupName, serviceName, filter).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByGeoNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists report records by geography. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| timestamp | filter | ge, le | | </br>| country | select | | | </br>| region | select | | | </br>| zip | select | | | </br>| apiRegion | filter | eq | | </br>| userId | filter | eq | | </br>| productId | filter | eq | | </br>| subscriptionId | filter | eq | | </br>| apiId | filter | eq | | </br>| operationId | filter | eq | | </br>| callCountSuccess | select | | | </br>| callCountBlocked | select | | | </br>| callCountFailed | select | | | </br>| callCountOther | select | | | </br>| bandwidth | select, orderBy | | | </br>| cacheHitsCount | select | | | </br>| cacheMissCount | select | | | </br>| apiTimeAvg | select | | | </br>| apiTimeMin | select | | | </br>| apiTimeMax | select | | | </br>| serviceTimeAvg | select | | | </br>| serviceTimeMin | select | | | </br>| serviceTimeMax | select | | | </br> + * @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> listByGeoAsync(final String resourceGroupName, final String serviceName, final String filter, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByGeoSinglePageAsync(resourceGroupName, serviceName, filter), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByGeoNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists report records by geography. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| timestamp | filter | ge, le | | </br>| country | select | | | </br>| region | select | | | </br>| zip | select | | | </br>| apiRegion | filter | eq | | </br>| userId | filter | eq | | </br>| productId | filter | eq | | </br>| subscriptionId | filter | eq | | </br>| apiId | filter | eq | | </br>| operationId | filter | eq | | </br>| callCountSuccess | select | | | </br>| callCountBlocked | select | | | </br>| callCountFailed | select | | | </br>| callCountOther | select | | | </br>| bandwidth | select, orderBy | | | </br>| cacheHitsCount | select | | | </br>| cacheMissCount | select | | | </br>| apiTimeAvg | select | | | </br>| apiTimeMin | select | | | </br>| apiTimeMax | select | | | </br>| serviceTimeAvg | select | | | </br>| serviceTimeMin | select | | | </br>| serviceTimeMax | select | | | </br> + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ReportRecordContractInner> object + */ + public Observable> listByGeoAsync(final String resourceGroupName, final String serviceName, final String filter) { + return listByGeoWithServiceResponseAsync(resourceGroupName, serviceName, filter) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists report records by geography. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| timestamp | filter | ge, le | | </br>| country | select | | | </br>| region | select | | | </br>| zip | select | | | </br>| apiRegion | filter | eq | | </br>| userId | filter | eq | | </br>| productId | filter | eq | | </br>| subscriptionId | filter | eq | | </br>| apiId | filter | eq | | </br>| operationId | filter | eq | | </br>| callCountSuccess | select | | | </br>| callCountBlocked | select | | | </br>| callCountFailed | select | | | </br>| callCountOther | select | | | </br>| bandwidth | select, orderBy | | | </br>| cacheHitsCount | select | | | </br>| cacheMissCount | select | | | </br>| apiTimeAvg | select | | | </br>| apiTimeMin | select | | | </br>| apiTimeMax | select | | | </br>| serviceTimeAvg | select | | | </br>| serviceTimeMin | select | | | </br>| serviceTimeMax | select | | | </br> + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ReportRecordContractInner> object + */ + public Observable>> listByGeoWithServiceResponseAsync(final String resourceGroupName, final String serviceName, final String filter) { + return listByGeoSinglePageAsync(resourceGroupName, serviceName, filter) + .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(listByGeoNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists report records by geography. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| timestamp | filter | ge, le | | </br>| country | select | | | </br>| region | select | | | </br>| zip | select | | | </br>| apiRegion | filter | eq | | </br>| userId | filter | eq | | </br>| productId | filter | eq | | </br>| subscriptionId | filter | eq | | </br>| apiId | filter | eq | | </br>| operationId | filter | eq | | </br>| callCountSuccess | select | | | </br>| callCountBlocked | select | | | </br>| callCountFailed | select | | | </br>| callCountOther | select | | | </br>| bandwidth | select, orderBy | | | </br>| cacheHitsCount | select | | | </br>| cacheMissCount | select | | | </br>| apiTimeAvg | select | | | </br>| apiTimeMin | select | | | </br>| apiTimeMax | select | | | </br>| serviceTimeAvg | select | | | </br>| serviceTimeMin | select | | | </br>| serviceTimeMax | select | | | </br> + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ReportRecordContractInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByGeoSinglePageAsync(final String resourceGroupName, final String serviceName, final String filter) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (filter == null) { + throw new IllegalArgumentException("Parameter filter 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 Integer top = null; + final Integer skip = null; + return service.listByGeo(resourceGroupName, serviceName, this.client.subscriptionId(), filter, top, skip, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByGeoDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Lists report records by geography. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| timestamp | filter | ge, le | | </br>| country | select | | | </br>| region | select | | | </br>| zip | select | | | </br>| apiRegion | filter | eq | | </br>| userId | filter | eq | | </br>| productId | filter | eq | | </br>| subscriptionId | filter | eq | | </br>| apiId | filter | eq | | </br>| operationId | filter | eq | | </br>| callCountSuccess | select | | | </br>| callCountBlocked | select | | | </br>| callCountFailed | select | | | </br>| callCountOther | select | | | </br>| bandwidth | select, orderBy | | | </br>| cacheHitsCount | select | | | </br>| cacheMissCount | select | | | </br>| apiTimeAvg | select | | | </br>| apiTimeMin | select | | | </br>| apiTimeMax | select | | | </br>| serviceTimeAvg | select | | | </br>| serviceTimeMin | select | | | </br>| serviceTimeMax | select | | | </br> + * @param top Number of records to return. + * @param skip Number of records to skip. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException 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<ReportRecordContractInner> object if successful. + */ + public PagedList listByGeo(final String resourceGroupName, final String serviceName, final String filter, final Integer top, final Integer skip) { + ServiceResponse> response = listByGeoSinglePageAsync(resourceGroupName, serviceName, filter, top, skip).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByGeoNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists report records by geography. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| timestamp | filter | ge, le | | </br>| country | select | | | </br>| region | select | | | </br>| zip | select | | | </br>| apiRegion | filter | eq | | </br>| userId | filter | eq | | </br>| productId | filter | eq | | </br>| subscriptionId | filter | eq | | </br>| apiId | filter | eq | | </br>| operationId | filter | eq | | </br>| callCountSuccess | select | | | </br>| callCountBlocked | select | | | </br>| callCountFailed | select | | | </br>| callCountOther | select | | | </br>| bandwidth | select, orderBy | | | </br>| cacheHitsCount | select | | | </br>| cacheMissCount | select | | | </br>| apiTimeAvg | select | | | </br>| apiTimeMin | select | | | </br>| apiTimeMax | select | | | </br>| serviceTimeAvg | select | | | </br>| serviceTimeMin | select | | | </br>| serviceTimeMax | select | | | </br> + * @param top Number of records to return. + * @param skip Number of records to skip. + * @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> listByGeoAsync(final String resourceGroupName, final String serviceName, final String filter, final Integer top, final Integer skip, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByGeoSinglePageAsync(resourceGroupName, serviceName, filter, top, skip), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByGeoNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists report records by geography. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| timestamp | filter | ge, le | | </br>| country | select | | | </br>| region | select | | | </br>| zip | select | | | </br>| apiRegion | filter | eq | | </br>| userId | filter | eq | | </br>| productId | filter | eq | | </br>| subscriptionId | filter | eq | | </br>| apiId | filter | eq | | </br>| operationId | filter | eq | | </br>| callCountSuccess | select | | | </br>| callCountBlocked | select | | | </br>| callCountFailed | select | | | </br>| callCountOther | select | | | </br>| bandwidth | select, orderBy | | | </br>| cacheHitsCount | select | | | </br>| cacheMissCount | select | | | </br>| apiTimeAvg | select | | | </br>| apiTimeMin | select | | | </br>| apiTimeMax | select | | | </br>| serviceTimeAvg | select | | | </br>| serviceTimeMin | select | | | </br>| serviceTimeMax | select | | | </br> + * @param top Number of records to return. + * @param skip Number of records to skip. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ReportRecordContractInner> object + */ + public Observable> listByGeoAsync(final String resourceGroupName, final String serviceName, final String filter, final Integer top, final Integer skip) { + return listByGeoWithServiceResponseAsync(resourceGroupName, serviceName, filter, top, skip) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists report records by geography. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| timestamp | filter | ge, le | | </br>| country | select | | | </br>| region | select | | | </br>| zip | select | | | </br>| apiRegion | filter | eq | | </br>| userId | filter | eq | | </br>| productId | filter | eq | | </br>| subscriptionId | filter | eq | | </br>| apiId | filter | eq | | </br>| operationId | filter | eq | | </br>| callCountSuccess | select | | | </br>| callCountBlocked | select | | | </br>| callCountFailed | select | | | </br>| callCountOther | select | | | </br>| bandwidth | select, orderBy | | | </br>| cacheHitsCount | select | | | </br>| cacheMissCount | select | | | </br>| apiTimeAvg | select | | | </br>| apiTimeMin | select | | | </br>| apiTimeMax | select | | | </br>| serviceTimeAvg | select | | | </br>| serviceTimeMin | select | | | </br>| serviceTimeMax | select | | | </br> + * @param top Number of records to return. + * @param skip Number of records to skip. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ReportRecordContractInner> object + */ + public Observable>> listByGeoWithServiceResponseAsync(final String resourceGroupName, final String serviceName, final String filter, final Integer top, final Integer skip) { + return listByGeoSinglePageAsync(resourceGroupName, serviceName, filter, top, skip) + .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(listByGeoNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists report records by geography. + * + ServiceResponse> * @param resourceGroupName The name of the resource group. + ServiceResponse> * @param serviceName The name of the API Management service. + ServiceResponse> * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| timestamp | filter | ge, le | | </br>| country | select | | | </br>| region | select | | | </br>| zip | select | | | </br>| apiRegion | filter | eq | | </br>| userId | filter | eq | | </br>| productId | filter | eq | | </br>| subscriptionId | filter | eq | | </br>| apiId | filter | eq | | </br>| operationId | filter | eq | | </br>| callCountSuccess | select | | | </br>| callCountBlocked | select | | | </br>| callCountFailed | select | | | </br>| callCountOther | select | | | </br>| bandwidth | select, orderBy | | | </br>| cacheHitsCount | select | | | </br>| cacheMissCount | select | | | </br>| apiTimeAvg | select | | | </br>| apiTimeMin | select | | | </br>| apiTimeMax | select | | | </br>| serviceTimeAvg | select | | | </br>| serviceTimeMin | select | | | </br>| serviceTimeMax | select | | | </br> + ServiceResponse> * @param top Number of records to return. + ServiceResponse> * @param skip Number of records to skip. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ReportRecordContractInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByGeoSinglePageAsync(final String resourceGroupName, final String serviceName, final String filter, final Integer top, final Integer skip) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (filter == null) { + throw new IllegalArgumentException("Parameter filter 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.listByGeo(resourceGroupName, serviceName, this.client.subscriptionId(), filter, top, skip, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByGeoDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByGeoDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Lists report records by subscription. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| timestamp | filter | ge, le | | </br>| displayName | select, orderBy | | | </br>| apiRegion | filter | eq | | </br>| userId | select, filter | eq | | </br>| productId | select, filter | eq | | </br>| subscriptionId | select, filter | eq | | </br>| callCountSuccess | select, orderBy | | | </br>| callCountBlocked | select, orderBy | | | </br>| callCountFailed | select, orderBy | | | </br>| callCountOther | select, orderBy | | | </br>| callCountTotal | select, orderBy | | | </br>| bandwidth | select, orderBy | | | </br>| cacheHitsCount | select | | | </br>| cacheMissCount | select | | | </br>| apiTimeAvg | select, orderBy | | | </br>| apiTimeMin | select | | | </br>| apiTimeMax | select | | | </br>| serviceTimeAvg | select | | | </br>| serviceTimeMin | select | | | </br>| serviceTimeMax | select | | | </br> + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException 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<ReportRecordContractInner> object if successful. + */ + public PagedList listBySubscription(final String resourceGroupName, final String serviceName, final String filter) { + ServiceResponse> response = listBySubscriptionSinglePageAsync(resourceGroupName, serviceName, filter).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listBySubscriptionNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists report records by subscription. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| timestamp | filter | ge, le | | </br>| displayName | select, orderBy | | | </br>| apiRegion | filter | eq | | </br>| userId | select, filter | eq | | </br>| productId | select, filter | eq | | </br>| subscriptionId | select, filter | eq | | </br>| callCountSuccess | select, orderBy | | | </br>| callCountBlocked | select, orderBy | | | </br>| callCountFailed | select, orderBy | | | </br>| callCountOther | select, orderBy | | | </br>| callCountTotal | select, orderBy | | | </br>| bandwidth | select, orderBy | | | </br>| cacheHitsCount | select | | | </br>| cacheMissCount | select | | | </br>| apiTimeAvg | select, orderBy | | | </br>| apiTimeMin | select | | | </br>| apiTimeMax | select | | | </br>| serviceTimeAvg | select | | | </br>| serviceTimeMin | select | | | </br>| serviceTimeMax | select | | | </br> + * @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> listBySubscriptionAsync(final String resourceGroupName, final String serviceName, final String filter, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listBySubscriptionSinglePageAsync(resourceGroupName, serviceName, filter), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listBySubscriptionNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists report records by subscription. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| timestamp | filter | ge, le | | </br>| displayName | select, orderBy | | | </br>| apiRegion | filter | eq | | </br>| userId | select, filter | eq | | </br>| productId | select, filter | eq | | </br>| subscriptionId | select, filter | eq | | </br>| callCountSuccess | select, orderBy | | | </br>| callCountBlocked | select, orderBy | | | </br>| callCountFailed | select, orderBy | | | </br>| callCountOther | select, orderBy | | | </br>| callCountTotal | select, orderBy | | | </br>| bandwidth | select, orderBy | | | </br>| cacheHitsCount | select | | | </br>| cacheMissCount | select | | | </br>| apiTimeAvg | select, orderBy | | | </br>| apiTimeMin | select | | | </br>| apiTimeMax | select | | | </br>| serviceTimeAvg | select | | | </br>| serviceTimeMin | select | | | </br>| serviceTimeMax | select | | | </br> + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ReportRecordContractInner> object + */ + public Observable> listBySubscriptionAsync(final String resourceGroupName, final String serviceName, final String filter) { + return listBySubscriptionWithServiceResponseAsync(resourceGroupName, serviceName, filter) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists report records by subscription. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| timestamp | filter | ge, le | | </br>| displayName | select, orderBy | | | </br>| apiRegion | filter | eq | | </br>| userId | select, filter | eq | | </br>| productId | select, filter | eq | | </br>| subscriptionId | select, filter | eq | | </br>| callCountSuccess | select, orderBy | | | </br>| callCountBlocked | select, orderBy | | | </br>| callCountFailed | select, orderBy | | | </br>| callCountOther | select, orderBy | | | </br>| callCountTotal | select, orderBy | | | </br>| bandwidth | select, orderBy | | | </br>| cacheHitsCount | select | | | </br>| cacheMissCount | select | | | </br>| apiTimeAvg | select, orderBy | | | </br>| apiTimeMin | select | | | </br>| apiTimeMax | select | | | </br>| serviceTimeAvg | select | | | </br>| serviceTimeMin | select | | | </br>| serviceTimeMax | select | | | </br> + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ReportRecordContractInner> object + */ + public Observable>> listBySubscriptionWithServiceResponseAsync(final String resourceGroupName, final String serviceName, final String filter) { + return listBySubscriptionSinglePageAsync(resourceGroupName, serviceName, filter) + .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(listBySubscriptionNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists report records by subscription. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| timestamp | filter | ge, le | | </br>| displayName | select, orderBy | | | </br>| apiRegion | filter | eq | | </br>| userId | select, filter | eq | | </br>| productId | select, filter | eq | | </br>| subscriptionId | select, filter | eq | | </br>| callCountSuccess | select, orderBy | | | </br>| callCountBlocked | select, orderBy | | | </br>| callCountFailed | select, orderBy | | | </br>| callCountOther | select, orderBy | | | </br>| callCountTotal | select, orderBy | | | </br>| bandwidth | select, orderBy | | | </br>| cacheHitsCount | select | | | </br>| cacheMissCount | select | | | </br>| apiTimeAvg | select, orderBy | | | </br>| apiTimeMin | select | | | </br>| apiTimeMax | select | | | </br>| serviceTimeAvg | select | | | </br>| serviceTimeMin | select | | | </br>| serviceTimeMax | select | | | </br> + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ReportRecordContractInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listBySubscriptionSinglePageAsync(final String resourceGroupName, final String serviceName, final String filter) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (filter == null) { + throw new IllegalArgumentException("Parameter filter 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 Integer top = null; + final Integer skip = null; + final String orderby = null; + return service.listBySubscription(resourceGroupName, serviceName, this.client.subscriptionId(), filter, top, skip, orderby, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listBySubscriptionDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Lists report records by subscription. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| timestamp | filter | ge, le | | </br>| displayName | select, orderBy | | | </br>| apiRegion | filter | eq | | </br>| userId | select, filter | eq | | </br>| productId | select, filter | eq | | </br>| subscriptionId | select, filter | eq | | </br>| callCountSuccess | select, orderBy | | | </br>| callCountBlocked | select, orderBy | | | </br>| callCountFailed | select, orderBy | | | </br>| callCountOther | select, orderBy | | | </br>| callCountTotal | select, orderBy | | | </br>| bandwidth | select, orderBy | | | </br>| cacheHitsCount | select | | | </br>| cacheMissCount | select | | | </br>| apiTimeAvg | select, orderBy | | | </br>| apiTimeMin | select | | | </br>| apiTimeMax | select | | | </br>| serviceTimeAvg | select | | | </br>| serviceTimeMin | select | | | </br>| serviceTimeMax | select | | | </br> + * @param top Number of records to return. + * @param skip Number of records to skip. + * @param orderby OData order by query option. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException 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<ReportRecordContractInner> object if successful. + */ + public PagedList listBySubscription(final String resourceGroupName, final String serviceName, final String filter, final Integer top, final Integer skip, final String orderby) { + ServiceResponse> response = listBySubscriptionSinglePageAsync(resourceGroupName, serviceName, filter, top, skip, orderby).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listBySubscriptionNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists report records by subscription. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| timestamp | filter | ge, le | | </br>| displayName | select, orderBy | | | </br>| apiRegion | filter | eq | | </br>| userId | select, filter | eq | | </br>| productId | select, filter | eq | | </br>| subscriptionId | select, filter | eq | | </br>| callCountSuccess | select, orderBy | | | </br>| callCountBlocked | select, orderBy | | | </br>| callCountFailed | select, orderBy | | | </br>| callCountOther | select, orderBy | | | </br>| callCountTotal | select, orderBy | | | </br>| bandwidth | select, orderBy | | | </br>| cacheHitsCount | select | | | </br>| cacheMissCount | select | | | </br>| apiTimeAvg | select, orderBy | | | </br>| apiTimeMin | select | | | </br>| apiTimeMax | select | | | </br>| serviceTimeAvg | select | | | </br>| serviceTimeMin | select | | | </br>| serviceTimeMax | select | | | </br> + * @param top Number of records to return. + * @param skip Number of records to skip. + * @param orderby OData order by query option. + * @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> listBySubscriptionAsync(final String resourceGroupName, final String serviceName, final String filter, final Integer top, final Integer skip, final String orderby, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listBySubscriptionSinglePageAsync(resourceGroupName, serviceName, filter, top, skip, orderby), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listBySubscriptionNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists report records by subscription. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| timestamp | filter | ge, le | | </br>| displayName | select, orderBy | | | </br>| apiRegion | filter | eq | | </br>| userId | select, filter | eq | | </br>| productId | select, filter | eq | | </br>| subscriptionId | select, filter | eq | | </br>| callCountSuccess | select, orderBy | | | </br>| callCountBlocked | select, orderBy | | | </br>| callCountFailed | select, orderBy | | | </br>| callCountOther | select, orderBy | | | </br>| callCountTotal | select, orderBy | | | </br>| bandwidth | select, orderBy | | | </br>| cacheHitsCount | select | | | </br>| cacheMissCount | select | | | </br>| apiTimeAvg | select, orderBy | | | </br>| apiTimeMin | select | | | </br>| apiTimeMax | select | | | </br>| serviceTimeAvg | select | | | </br>| serviceTimeMin | select | | | </br>| serviceTimeMax | select | | | </br> + * @param top Number of records to return. + * @param skip Number of records to skip. + * @param orderby OData order by query option. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ReportRecordContractInner> object + */ + public Observable> listBySubscriptionAsync(final String resourceGroupName, final String serviceName, final String filter, final Integer top, final Integer skip, final String orderby) { + return listBySubscriptionWithServiceResponseAsync(resourceGroupName, serviceName, filter, top, skip, orderby) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists report records by subscription. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| timestamp | filter | ge, le | | </br>| displayName | select, orderBy | | | </br>| apiRegion | filter | eq | | </br>| userId | select, filter | eq | | </br>| productId | select, filter | eq | | </br>| subscriptionId | select, filter | eq | | </br>| callCountSuccess | select, orderBy | | | </br>| callCountBlocked | select, orderBy | | | </br>| callCountFailed | select, orderBy | | | </br>| callCountOther | select, orderBy | | | </br>| callCountTotal | select, orderBy | | | </br>| bandwidth | select, orderBy | | | </br>| cacheHitsCount | select | | | </br>| cacheMissCount | select | | | </br>| apiTimeAvg | select, orderBy | | | </br>| apiTimeMin | select | | | </br>| apiTimeMax | select | | | </br>| serviceTimeAvg | select | | | </br>| serviceTimeMin | select | | | </br>| serviceTimeMax | select | | | </br> + * @param top Number of records to return. + * @param skip Number of records to skip. + * @param orderby OData order by query option. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ReportRecordContractInner> object + */ + public Observable>> listBySubscriptionWithServiceResponseAsync(final String resourceGroupName, final String serviceName, final String filter, final Integer top, final Integer skip, final String orderby) { + return listBySubscriptionSinglePageAsync(resourceGroupName, serviceName, filter, top, skip, orderby) + .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(listBySubscriptionNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists report records by subscription. + * + ServiceResponse> * @param resourceGroupName The name of the resource group. + ServiceResponse> * @param serviceName The name of the API Management service. + ServiceResponse> * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| timestamp | filter | ge, le | | </br>| displayName | select, orderBy | | | </br>| apiRegion | filter | eq | | </br>| userId | select, filter | eq | | </br>| productId | select, filter | eq | | </br>| subscriptionId | select, filter | eq | | </br>| callCountSuccess | select, orderBy | | | </br>| callCountBlocked | select, orderBy | | | </br>| callCountFailed | select, orderBy | | | </br>| callCountOther | select, orderBy | | | </br>| callCountTotal | select, orderBy | | | </br>| bandwidth | select, orderBy | | | </br>| cacheHitsCount | select | | | </br>| cacheMissCount | select | | | </br>| apiTimeAvg | select, orderBy | | | </br>| apiTimeMin | select | | | </br>| apiTimeMax | select | | | </br>| serviceTimeAvg | select | | | </br>| serviceTimeMin | select | | | </br>| serviceTimeMax | select | | | </br> + ServiceResponse> * @param top Number of records to return. + ServiceResponse> * @param skip Number of records to skip. + ServiceResponse> * @param orderby OData order by query option. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ReportRecordContractInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listBySubscriptionSinglePageAsync(final String resourceGroupName, final String serviceName, final String filter, final Integer top, final Integer skip, final String orderby) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (filter == null) { + throw new IllegalArgumentException("Parameter filter 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.listBySubscription(resourceGroupName, serviceName, this.client.subscriptionId(), filter, top, skip, orderby, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listBySubscriptionDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listBySubscriptionDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Lists report records by Time. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| timestamp | filter, select | ge, le | | </br>| interval | select | | | </br>| apiRegion | filter | eq | | </br>| userId | filter | eq | | </br>| productId | filter | eq | | </br>| subscriptionId | filter | eq | | </br>| apiId | filter | eq | | </br>| operationId | filter | eq | | </br>| callCountSuccess | select | | | </br>| callCountBlocked | select | | | </br>| callCountFailed | select | | | </br>| callCountOther | select | | | </br>| bandwidth | select, orderBy | | | </br>| cacheHitsCount | select | | | </br>| cacheMissCount | select | | | </br>| apiTimeAvg | select | | | </br>| apiTimeMin | select | | | </br>| apiTimeMax | select | | | </br>| serviceTimeAvg | select | | | </br>| serviceTimeMin | select | | | </br>| serviceTimeMax | select | | | </br> + * @param interval By time interval. Interval must be multiple of 15 minutes and may not be zero. The value should be in ISO 8601 format (http://en.wikipedia.org/wiki/ISO_8601#Durations).This code can be used to convert TimeSpan to a valid interval string: XmlConvert.ToString(new TimeSpan(hours, minutes, seconds)). + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException 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<ReportRecordContractInner> object if successful. + */ + public PagedList listByTime(final String resourceGroupName, final String serviceName, final String filter, final Period interval) { + ServiceResponse> response = listByTimeSinglePageAsync(resourceGroupName, serviceName, filter, interval).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByTimeNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists report records by Time. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| timestamp | filter, select | ge, le | | </br>| interval | select | | | </br>| apiRegion | filter | eq | | </br>| userId | filter | eq | | </br>| productId | filter | eq | | </br>| subscriptionId | filter | eq | | </br>| apiId | filter | eq | | </br>| operationId | filter | eq | | </br>| callCountSuccess | select | | | </br>| callCountBlocked | select | | | </br>| callCountFailed | select | | | </br>| callCountOther | select | | | </br>| bandwidth | select, orderBy | | | </br>| cacheHitsCount | select | | | </br>| cacheMissCount | select | | | </br>| apiTimeAvg | select | | | </br>| apiTimeMin | select | | | </br>| apiTimeMax | select | | | </br>| serviceTimeAvg | select | | | </br>| serviceTimeMin | select | | | </br>| serviceTimeMax | select | | | </br> + * @param interval By time interval. Interval must be multiple of 15 minutes and may not be zero. The value should be in ISO 8601 format (http://en.wikipedia.org/wiki/ISO_8601#Durations).This code can be used to convert TimeSpan to a valid interval string: XmlConvert.ToString(new TimeSpan(hours, minutes, seconds)). + * @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> listByTimeAsync(final String resourceGroupName, final String serviceName, final String filter, final Period interval, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByTimeSinglePageAsync(resourceGroupName, serviceName, filter, interval), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByTimeNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists report records by Time. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| timestamp | filter, select | ge, le | | </br>| interval | select | | | </br>| apiRegion | filter | eq | | </br>| userId | filter | eq | | </br>| productId | filter | eq | | </br>| subscriptionId | filter | eq | | </br>| apiId | filter | eq | | </br>| operationId | filter | eq | | </br>| callCountSuccess | select | | | </br>| callCountBlocked | select | | | </br>| callCountFailed | select | | | </br>| callCountOther | select | | | </br>| bandwidth | select, orderBy | | | </br>| cacheHitsCount | select | | | </br>| cacheMissCount | select | | | </br>| apiTimeAvg | select | | | </br>| apiTimeMin | select | | | </br>| apiTimeMax | select | | | </br>| serviceTimeAvg | select | | | </br>| serviceTimeMin | select | | | </br>| serviceTimeMax | select | | | </br> + * @param interval By time interval. Interval must be multiple of 15 minutes and may not be zero. The value should be in ISO 8601 format (http://en.wikipedia.org/wiki/ISO_8601#Durations).This code can be used to convert TimeSpan to a valid interval string: XmlConvert.ToString(new TimeSpan(hours, minutes, seconds)). + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ReportRecordContractInner> object + */ + public Observable> listByTimeAsync(final String resourceGroupName, final String serviceName, final String filter, final Period interval) { + return listByTimeWithServiceResponseAsync(resourceGroupName, serviceName, filter, interval) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists report records by Time. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| timestamp | filter, select | ge, le | | </br>| interval | select | | | </br>| apiRegion | filter | eq | | </br>| userId | filter | eq | | </br>| productId | filter | eq | | </br>| subscriptionId | filter | eq | | </br>| apiId | filter | eq | | </br>| operationId | filter | eq | | </br>| callCountSuccess | select | | | </br>| callCountBlocked | select | | | </br>| callCountFailed | select | | | </br>| callCountOther | select | | | </br>| bandwidth | select, orderBy | | | </br>| cacheHitsCount | select | | | </br>| cacheMissCount | select | | | </br>| apiTimeAvg | select | | | </br>| apiTimeMin | select | | | </br>| apiTimeMax | select | | | </br>| serviceTimeAvg | select | | | </br>| serviceTimeMin | select | | | </br>| serviceTimeMax | select | | | </br> + * @param interval By time interval. Interval must be multiple of 15 minutes and may not be zero. The value should be in ISO 8601 format (http://en.wikipedia.org/wiki/ISO_8601#Durations).This code can be used to convert TimeSpan to a valid interval string: XmlConvert.ToString(new TimeSpan(hours, minutes, seconds)). + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ReportRecordContractInner> object + */ + public Observable>> listByTimeWithServiceResponseAsync(final String resourceGroupName, final String serviceName, final String filter, final Period interval) { + return listByTimeSinglePageAsync(resourceGroupName, serviceName, filter, interval) + .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(listByTimeNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists report records by Time. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| timestamp | filter, select | ge, le | | </br>| interval | select | | | </br>| apiRegion | filter | eq | | </br>| userId | filter | eq | | </br>| productId | filter | eq | | </br>| subscriptionId | filter | eq | | </br>| apiId | filter | eq | | </br>| operationId | filter | eq | | </br>| callCountSuccess | select | | | </br>| callCountBlocked | select | | | </br>| callCountFailed | select | | | </br>| callCountOther | select | | | </br>| bandwidth | select, orderBy | | | </br>| cacheHitsCount | select | | | </br>| cacheMissCount | select | | | </br>| apiTimeAvg | select | | | </br>| apiTimeMin | select | | | </br>| apiTimeMax | select | | | </br>| serviceTimeAvg | select | | | </br>| serviceTimeMin | select | | | </br>| serviceTimeMax | select | | | </br> + * @param interval By time interval. Interval must be multiple of 15 minutes and may not be zero. The value should be in ISO 8601 format (http://en.wikipedia.org/wiki/ISO_8601#Durations).This code can be used to convert TimeSpan to a valid interval string: XmlConvert.ToString(new TimeSpan(hours, minutes, seconds)). + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ReportRecordContractInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByTimeSinglePageAsync(final String resourceGroupName, final String serviceName, final String filter, final Period interval) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (filter == null) { + throw new IllegalArgumentException("Parameter filter is required and cannot be null."); + } + if (interval == null) { + throw new IllegalArgumentException("Parameter interval 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 Integer top = null; + final Integer skip = null; + final String orderby = null; + return service.listByTime(resourceGroupName, serviceName, this.client.subscriptionId(), filter, top, skip, orderby, interval, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByTimeDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Lists report records by Time. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| timestamp | filter, select | ge, le | | </br>| interval | select | | | </br>| apiRegion | filter | eq | | </br>| userId | filter | eq | | </br>| productId | filter | eq | | </br>| subscriptionId | filter | eq | | </br>| apiId | filter | eq | | </br>| operationId | filter | eq | | </br>| callCountSuccess | select | | | </br>| callCountBlocked | select | | | </br>| callCountFailed | select | | | </br>| callCountOther | select | | | </br>| bandwidth | select, orderBy | | | </br>| cacheHitsCount | select | | | </br>| cacheMissCount | select | | | </br>| apiTimeAvg | select | | | </br>| apiTimeMin | select | | | </br>| apiTimeMax | select | | | </br>| serviceTimeAvg | select | | | </br>| serviceTimeMin | select | | | </br>| serviceTimeMax | select | | | </br> + * @param interval By time interval. Interval must be multiple of 15 minutes and may not be zero. The value should be in ISO 8601 format (http://en.wikipedia.org/wiki/ISO_8601#Durations).This code can be used to convert TimeSpan to a valid interval string: XmlConvert.ToString(new TimeSpan(hours, minutes, seconds)). + * @param top Number of records to return. + * @param skip Number of records to skip. + * @param orderby OData order by query option. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException 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<ReportRecordContractInner> object if successful. + */ + public PagedList listByTime(final String resourceGroupName, final String serviceName, final String filter, final Period interval, final Integer top, final Integer skip, final String orderby) { + ServiceResponse> response = listByTimeSinglePageAsync(resourceGroupName, serviceName, filter, interval, top, skip, orderby).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByTimeNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists report records by Time. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| timestamp | filter, select | ge, le | | </br>| interval | select | | | </br>| apiRegion | filter | eq | | </br>| userId | filter | eq | | </br>| productId | filter | eq | | </br>| subscriptionId | filter | eq | | </br>| apiId | filter | eq | | </br>| operationId | filter | eq | | </br>| callCountSuccess | select | | | </br>| callCountBlocked | select | | | </br>| callCountFailed | select | | | </br>| callCountOther | select | | | </br>| bandwidth | select, orderBy | | | </br>| cacheHitsCount | select | | | </br>| cacheMissCount | select | | | </br>| apiTimeAvg | select | | | </br>| apiTimeMin | select | | | </br>| apiTimeMax | select | | | </br>| serviceTimeAvg | select | | | </br>| serviceTimeMin | select | | | </br>| serviceTimeMax | select | | | </br> + * @param interval By time interval. Interval must be multiple of 15 minutes and may not be zero. The value should be in ISO 8601 format (http://en.wikipedia.org/wiki/ISO_8601#Durations).This code can be used to convert TimeSpan to a valid interval string: XmlConvert.ToString(new TimeSpan(hours, minutes, seconds)). + * @param top Number of records to return. + * @param skip Number of records to skip. + * @param orderby OData order by query option. + * @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> listByTimeAsync(final String resourceGroupName, final String serviceName, final String filter, final Period interval, final Integer top, final Integer skip, final String orderby, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByTimeSinglePageAsync(resourceGroupName, serviceName, filter, interval, top, skip, orderby), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByTimeNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists report records by Time. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| timestamp | filter, select | ge, le | | </br>| interval | select | | | </br>| apiRegion | filter | eq | | </br>| userId | filter | eq | | </br>| productId | filter | eq | | </br>| subscriptionId | filter | eq | | </br>| apiId | filter | eq | | </br>| operationId | filter | eq | | </br>| callCountSuccess | select | | | </br>| callCountBlocked | select | | | </br>| callCountFailed | select | | | </br>| callCountOther | select | | | </br>| bandwidth | select, orderBy | | | </br>| cacheHitsCount | select | | | </br>| cacheMissCount | select | | | </br>| apiTimeAvg | select | | | </br>| apiTimeMin | select | | | </br>| apiTimeMax | select | | | </br>| serviceTimeAvg | select | | | </br>| serviceTimeMin | select | | | </br>| serviceTimeMax | select | | | </br> + * @param interval By time interval. Interval must be multiple of 15 minutes and may not be zero. The value should be in ISO 8601 format (http://en.wikipedia.org/wiki/ISO_8601#Durations).This code can be used to convert TimeSpan to a valid interval string: XmlConvert.ToString(new TimeSpan(hours, minutes, seconds)). + * @param top Number of records to return. + * @param skip Number of records to skip. + * @param orderby OData order by query option. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ReportRecordContractInner> object + */ + public Observable> listByTimeAsync(final String resourceGroupName, final String serviceName, final String filter, final Period interval, final Integer top, final Integer skip, final String orderby) { + return listByTimeWithServiceResponseAsync(resourceGroupName, serviceName, filter, interval, top, skip, orderby) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists report records by Time. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| timestamp | filter, select | ge, le | | </br>| interval | select | | | </br>| apiRegion | filter | eq | | </br>| userId | filter | eq | | </br>| productId | filter | eq | | </br>| subscriptionId | filter | eq | | </br>| apiId | filter | eq | | </br>| operationId | filter | eq | | </br>| callCountSuccess | select | | | </br>| callCountBlocked | select | | | </br>| callCountFailed | select | | | </br>| callCountOther | select | | | </br>| bandwidth | select, orderBy | | | </br>| cacheHitsCount | select | | | </br>| cacheMissCount | select | | | </br>| apiTimeAvg | select | | | </br>| apiTimeMin | select | | | </br>| apiTimeMax | select | | | </br>| serviceTimeAvg | select | | | </br>| serviceTimeMin | select | | | </br>| serviceTimeMax | select | | | </br> + * @param interval By time interval. Interval must be multiple of 15 minutes and may not be zero. The value should be in ISO 8601 format (http://en.wikipedia.org/wiki/ISO_8601#Durations).This code can be used to convert TimeSpan to a valid interval string: XmlConvert.ToString(new TimeSpan(hours, minutes, seconds)). + * @param top Number of records to return. + * @param skip Number of records to skip. + * @param orderby OData order by query option. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ReportRecordContractInner> object + */ + public Observable>> listByTimeWithServiceResponseAsync(final String resourceGroupName, final String serviceName, final String filter, final Period interval, final Integer top, final Integer skip, final String orderby) { + return listByTimeSinglePageAsync(resourceGroupName, serviceName, filter, interval, top, skip, orderby) + .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(listByTimeNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists report records by Time. + * + ServiceResponse> * @param resourceGroupName The name of the resource group. + ServiceResponse> * @param serviceName The name of the API Management service. + ServiceResponse> * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| timestamp | filter, select | ge, le | | </br>| interval | select | | | </br>| apiRegion | filter | eq | | </br>| userId | filter | eq | | </br>| productId | filter | eq | | </br>| subscriptionId | filter | eq | | </br>| apiId | filter | eq | | </br>| operationId | filter | eq | | </br>| callCountSuccess | select | | | </br>| callCountBlocked | select | | | </br>| callCountFailed | select | | | </br>| callCountOther | select | | | </br>| bandwidth | select, orderBy | | | </br>| cacheHitsCount | select | | | </br>| cacheMissCount | select | | | </br>| apiTimeAvg | select | | | </br>| apiTimeMin | select | | | </br>| apiTimeMax | select | | | </br>| serviceTimeAvg | select | | | </br>| serviceTimeMin | select | | | </br>| serviceTimeMax | select | | | </br> + ServiceResponse> * @param interval By time interval. Interval must be multiple of 15 minutes and may not be zero. The value should be in ISO 8601 format (http://en.wikipedia.org/wiki/ISO_8601#Durations).This code can be used to convert TimeSpan to a valid interval string: XmlConvert.ToString(new TimeSpan(hours, minutes, seconds)). + ServiceResponse> * @param top Number of records to return. + ServiceResponse> * @param skip Number of records to skip. + ServiceResponse> * @param orderby OData order by query option. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ReportRecordContractInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByTimeSinglePageAsync(final String resourceGroupName, final String serviceName, final String filter, final Period interval, final Integer top, final Integer skip, final String orderby) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (filter == null) { + throw new IllegalArgumentException("Parameter filter is required and cannot be null."); + } + if (interval == null) { + throw new IllegalArgumentException("Parameter interval 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.listByTime(resourceGroupName, serviceName, this.client.subscriptionId(), filter, top, skip, orderby, interval, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByTimeDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByTimeDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Lists report records by Request. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| timestamp | filter | ge, le | | </br>| apiId | filter | eq | | </br>| operationId | filter | eq | | </br>| productId | filter | eq | | </br>| userId | filter | eq | | </br>| apiRegion | filter | eq | | </br>| subscriptionId | filter | eq | | </br> + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the List<RequestReportRecordContractInner> object if successful. + */ + public List listByRequest(String resourceGroupName, String serviceName, String filter) { + return listByRequestWithServiceResponseAsync(resourceGroupName, serviceName, filter).toBlocking().single().body(); + } + + /** + * Lists report records by Request. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| timestamp | filter | ge, le | | </br>| apiId | filter | eq | | </br>| operationId | filter | eq | | </br>| productId | filter | eq | | </br>| userId | filter | eq | | </br>| apiRegion | filter | eq | | </br>| subscriptionId | filter | eq | | </br> + * @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> listByRequestAsync(String resourceGroupName, String serviceName, String filter, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listByRequestWithServiceResponseAsync(resourceGroupName, serviceName, filter), serviceCallback); + } + + /** + * Lists report records by Request. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| timestamp | filter | ge, le | | </br>| apiId | filter | eq | | </br>| operationId | filter | eq | | </br>| productId | filter | eq | | </br>| userId | filter | eq | | </br>| apiRegion | filter | eq | | </br>| subscriptionId | filter | eq | | </br> + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<RequestReportRecordContractInner> object + */ + public Observable> listByRequestAsync(String resourceGroupName, String serviceName, String filter) { + return listByRequestWithServiceResponseAsync(resourceGroupName, serviceName, filter).map(new Func1>, List>() { + @Override + public List call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists report records by Request. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| timestamp | filter | ge, le | | </br>| apiId | filter | eq | | </br>| operationId | filter | eq | | </br>| productId | filter | eq | | </br>| userId | filter | eq | | </br>| apiRegion | filter | eq | | </br>| subscriptionId | filter | eq | | </br> + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<RequestReportRecordContractInner> object + */ + public Observable>> listByRequestWithServiceResponseAsync(String resourceGroupName, String serviceName, String filter) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (filter == null) { + throw new IllegalArgumentException("Parameter filter 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 Integer top = null; + final Integer skip = null; + return service.listByRequest(resourceGroupName, serviceName, this.client.subscriptionId(), filter, top, skip, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByRequestDelegate(response); + List items = null; + if (result.body() != null) { + items = result.body().items(); + } + ServiceResponse> clientResponse = new ServiceResponse>(items, result.response()); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Lists report records by Request. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| timestamp | filter | ge, le | | </br>| apiId | filter | eq | | </br>| operationId | filter | eq | | </br>| productId | filter | eq | | </br>| userId | filter | eq | | </br>| apiRegion | filter | eq | | </br>| subscriptionId | filter | eq | | </br> + * @param top Number of records to return. + * @param skip Number of records to skip. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the List<RequestReportRecordContractInner> object if successful. + */ + public List listByRequest(String resourceGroupName, String serviceName, String filter, Integer top, Integer skip) { + return listByRequestWithServiceResponseAsync(resourceGroupName, serviceName, filter, top, skip).toBlocking().single().body(); + } + + /** + * Lists report records by Request. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| timestamp | filter | ge, le | | </br>| apiId | filter | eq | | </br>| operationId | filter | eq | | </br>| productId | filter | eq | | </br>| userId | filter | eq | | </br>| apiRegion | filter | eq | | </br>| subscriptionId | filter | eq | | </br> + * @param top Number of records to return. + * @param skip Number of records to skip. + * @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> listByRequestAsync(String resourceGroupName, String serviceName, String filter, Integer top, Integer skip, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listByRequestWithServiceResponseAsync(resourceGroupName, serviceName, filter, top, skip), serviceCallback); + } + + /** + * Lists report records by Request. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| timestamp | filter | ge, le | | </br>| apiId | filter | eq | | </br>| operationId | filter | eq | | </br>| productId | filter | eq | | </br>| userId | filter | eq | | </br>| apiRegion | filter | eq | | </br>| subscriptionId | filter | eq | | </br> + * @param top Number of records to return. + * @param skip Number of records to skip. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<RequestReportRecordContractInner> object + */ + public Observable> listByRequestAsync(String resourceGroupName, String serviceName, String filter, Integer top, Integer skip) { + return listByRequestWithServiceResponseAsync(resourceGroupName, serviceName, filter, top, skip).map(new Func1>, List>() { + @Override + public List call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists report records by Request. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| timestamp | filter | ge, le | | </br>| apiId | filter | eq | | </br>| operationId | filter | eq | | </br>| productId | filter | eq | | </br>| userId | filter | eq | | </br>| apiRegion | filter | eq | | </br>| subscriptionId | filter | eq | | </br> + * @param top Number of records to return. + * @param skip Number of records to skip. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<RequestReportRecordContractInner> object + */ + public Observable>> listByRequestWithServiceResponseAsync(String resourceGroupName, String serviceName, String filter, Integer top, Integer skip) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (filter == null) { + throw new IllegalArgumentException("Parameter filter 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.listByRequest(resourceGroupName, serviceName, this.client.subscriptionId(), filter, top, skip, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByRequestDelegate(response); + List items = null; + if (result.body() != null) { + items = result.body().items(); + } + ServiceResponse> clientResponse = new ServiceResponse>(items, result.response()); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByRequestDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Lists report records by API. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException 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<ReportRecordContractInner> object if successful. + */ + public PagedList listByApiNext(final String nextPageLink) { + ServiceResponse> response = listByApiNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByApiNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists report records by API. + * + * @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> listByApiNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByApiNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByApiNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists report records by API. + * + * @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<ReportRecordContractInner> object + */ + public Observable> listByApiNextAsync(final String nextPageLink) { + return listByApiNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists report records by API. + * + * @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<ReportRecordContractInner> object + */ + public Observable>> listByApiNextWithServiceResponseAsync(final String nextPageLink) { + return listByApiNextSinglePageAsync(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(listByApiNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists report records by API. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ReportRecordContractInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByApiNextSinglePageAsync(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.listByApiNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByApiNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByApiNextDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Lists report records by User. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException 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<ReportRecordContractInner> object if successful. + */ + public PagedList listByUserNext(final String nextPageLink) { + ServiceResponse> response = listByUserNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByUserNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists report records by User. + * + * @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> listByUserNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByUserNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByUserNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists report records by User. + * + * @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<ReportRecordContractInner> object + */ + public Observable> listByUserNextAsync(final String nextPageLink) { + return listByUserNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists report records by User. + * + * @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<ReportRecordContractInner> object + */ + public Observable>> listByUserNextWithServiceResponseAsync(final String nextPageLink) { + return listByUserNextSinglePageAsync(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(listByUserNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists report records by User. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ReportRecordContractInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByUserNextSinglePageAsync(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.listByUserNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByUserNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByUserNextDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Lists report records by API Operations. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException 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<ReportRecordContractInner> object if successful. + */ + public PagedList listByOperationNext(final String nextPageLink) { + ServiceResponse> response = listByOperationNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByOperationNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists report records by API Operations. + * + * @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> listByOperationNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByOperationNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByOperationNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists report records by API Operations. + * + * @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<ReportRecordContractInner> object + */ + public Observable> listByOperationNextAsync(final String nextPageLink) { + return listByOperationNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists report records by API Operations. + * + * @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<ReportRecordContractInner> object + */ + public Observable>> listByOperationNextWithServiceResponseAsync(final String nextPageLink) { + return listByOperationNextSinglePageAsync(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(listByOperationNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists report records by API Operations. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ReportRecordContractInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByOperationNextSinglePageAsync(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.listByOperationNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByOperationNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByOperationNextDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Lists report records by Product. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException 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<ReportRecordContractInner> object if successful. + */ + public PagedList listByProductNext(final String nextPageLink) { + ServiceResponse> response = listByProductNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByProductNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists report records by Product. + * + * @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> listByProductNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByProductNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByProductNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists report records by Product. + * + * @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<ReportRecordContractInner> object + */ + public Observable> listByProductNextAsync(final String nextPageLink) { + return listByProductNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists report records by Product. + * + * @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<ReportRecordContractInner> object + */ + public Observable>> listByProductNextWithServiceResponseAsync(final String nextPageLink) { + return listByProductNextSinglePageAsync(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(listByProductNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists report records by Product. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ReportRecordContractInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByProductNextSinglePageAsync(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.listByProductNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByProductNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByProductNextDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Lists report records by geography. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException 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<ReportRecordContractInner> object if successful. + */ + public PagedList listByGeoNext(final String nextPageLink) { + ServiceResponse> response = listByGeoNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByGeoNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists report records by geography. + * + * @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> listByGeoNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByGeoNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByGeoNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists report records by geography. + * + * @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<ReportRecordContractInner> object + */ + public Observable> listByGeoNextAsync(final String nextPageLink) { + return listByGeoNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists report records by geography. + * + * @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<ReportRecordContractInner> object + */ + public Observable>> listByGeoNextWithServiceResponseAsync(final String nextPageLink) { + return listByGeoNextSinglePageAsync(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(listByGeoNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists report records by geography. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ReportRecordContractInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByGeoNextSinglePageAsync(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.listByGeoNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByGeoNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByGeoNextDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Lists report records by subscription. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException 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<ReportRecordContractInner> object if successful. + */ + public PagedList listBySubscriptionNext(final String nextPageLink) { + ServiceResponse> response = listBySubscriptionNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listBySubscriptionNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists report records by 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> listBySubscriptionNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listBySubscriptionNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listBySubscriptionNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists report records by 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<ReportRecordContractInner> object + */ + public Observable> listBySubscriptionNextAsync(final String nextPageLink) { + return listBySubscriptionNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists report records by 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<ReportRecordContractInner> object + */ + public Observable>> listBySubscriptionNextWithServiceResponseAsync(final String nextPageLink) { + return listBySubscriptionNextSinglePageAsync(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(listBySubscriptionNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists report records by 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<ReportRecordContractInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listBySubscriptionNextSinglePageAsync(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.listBySubscriptionNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listBySubscriptionNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listBySubscriptionNextDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Lists report records by Time. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException 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<ReportRecordContractInner> object if successful. + */ + public PagedList listByTimeNext(final String nextPageLink) { + ServiceResponse> response = listByTimeNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByTimeNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists report records by Time. + * + * @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> listByTimeNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByTimeNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByTimeNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists report records by Time. + * + * @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<ReportRecordContractInner> object + */ + public Observable> listByTimeNextAsync(final String nextPageLink) { + return listByTimeNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists report records by Time. + * + * @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<ReportRecordContractInner> object + */ + public Observable>> listByTimeNextWithServiceResponseAsync(final String nextPageLink) { + return listByTimeNextSinglePageAsync(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(listByTimeNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists report records by Time. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ReportRecordContractInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByTimeNextSinglePageAsync(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.listByTimeNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByTimeNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByTimeNextDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/RequestReportRecordContractImpl.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/RequestReportRecordContractImpl.java new file mode 100644 index 0000000000000..105271cfac6a1 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/RequestReportRecordContractImpl.java @@ -0,0 +1,117 @@ +/** + * 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.apimanagement.v2019_01_01.implementation; + +import com.microsoft.azure.management.apimanagement.v2019_01_01.RequestReportRecordContract; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import org.joda.time.DateTime; + +class RequestReportRecordContractImpl extends WrapperImpl implements RequestReportRecordContract { + private final ApiManagementManager manager; + RequestReportRecordContractImpl(RequestReportRecordContractInner inner, ApiManagementManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public ApiManagementManager manager() { + return this.manager; + } + + @Override + public String apiId() { + return this.inner().apiId(); + } + + @Override + public String apiRegion() { + return this.inner().apiRegion(); + } + + @Override + public Double apiTime() { + return this.inner().apiTime(); + } + + @Override + public String backendResponseCode() { + return this.inner().backendResponseCode(); + } + + @Override + public String cache() { + return this.inner().cache(); + } + + @Override + public String ipAddress() { + return this.inner().ipAddress(); + } + + @Override + public String method() { + return this.inner().method(); + } + + @Override + public String operationId() { + return this.inner().operationId(); + } + + @Override + public String productId() { + return this.inner().productId(); + } + + @Override + public String requestId() { + return this.inner().requestId(); + } + + @Override + public Integer requestSize() { + return this.inner().requestSize(); + } + + @Override + public Integer responseCode() { + return this.inner().responseCode(); + } + + @Override + public Integer responseSize() { + return this.inner().responseSize(); + } + + @Override + public Double serviceTime() { + return this.inner().serviceTime(); + } + + @Override + public String subscriptionId() { + return this.inner().subscriptionId(); + } + + @Override + public DateTime timestamp() { + return this.inner().timestamp(); + } + + @Override + public String url() { + return this.inner().url(); + } + + @Override + public String userId() { + return this.inner().userId(); + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/RequestReportRecordContractInner.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/RequestReportRecordContractInner.java new file mode 100644 index 0000000000000..f71ae24b2395f --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/RequestReportRecordContractInner.java @@ -0,0 +1,470 @@ +/** + * 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.apimanagement.v2019_01_01.implementation; + +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Request Report data. + */ +public class RequestReportRecordContractInner { + /** + * API identifier path. /apis/{apiId}. + */ + @JsonProperty(value = "apiId") + private String apiId; + + /** + * Operation identifier path. /apis/{apiId}/operations/{operationId}. + */ + @JsonProperty(value = "operationId") + private String operationId; + + /** + * Product identifier path. /products/{productId}. + */ + @JsonProperty(value = "productId", access = JsonProperty.Access.WRITE_ONLY) + private String productId; + + /** + * User identifier path. /users/{userId}. + */ + @JsonProperty(value = "userId", access = JsonProperty.Access.WRITE_ONLY) + private String userId; + + /** + * The HTTP method associated with this request.. + */ + @JsonProperty(value = "method") + private String method; + + /** + * The full URL associated with this request. + */ + @JsonProperty(value = "url") + private String url; + + /** + * The client IP address associated with this request. + */ + @JsonProperty(value = "ipAddress") + private String ipAddress; + + /** + * The HTTP status code received by the gateway as a result of forwarding + * this request to the backend. + */ + @JsonProperty(value = "backendResponseCode") + private String backendResponseCode; + + /** + * The HTTP status code returned by the gateway. + */ + @JsonProperty(value = "responseCode") + private Integer responseCode; + + /** + * The size of the response returned by the gateway. + */ + @JsonProperty(value = "responseSize") + private Integer responseSize; + + /** + * The date and time when this request was received by the gateway in ISO + * 8601 format. + */ + @JsonProperty(value = "timestamp") + private DateTime timestamp; + + /** + * Specifies if response cache was involved in generating the response. If + * the value is none, the cache was not used. If the value is hit, cached + * response was returned. If the value is miss, the cache was used but + * lookup resulted in a miss and request was fulfilled by the backend. + */ + @JsonProperty(value = "cache") + private String cache; + + /** + * The total time it took to process this request. + */ + @JsonProperty(value = "apiTime") + private Double apiTime; + + /** + * he time it took to forward this request to the backend and get the + * response back. + */ + @JsonProperty(value = "serviceTime") + private Double serviceTime; + + /** + * Azure region where the gateway that processed this request is located. + */ + @JsonProperty(value = "apiRegion") + private String apiRegion; + + /** + * Subscription identifier path. /subscriptions/{subscriptionId}. + */ + @JsonProperty(value = "subscriptionId") + private String subscriptionId; + + /** + * Request Identifier. + */ + @JsonProperty(value = "requestId") + private String requestId; + + /** + * The size of this request.. + */ + @JsonProperty(value = "requestSize") + private Integer requestSize; + + /** + * Get aPI identifier path. /apis/{apiId}. + * + * @return the apiId value + */ + public String apiId() { + return this.apiId; + } + + /** + * Set aPI identifier path. /apis/{apiId}. + * + * @param apiId the apiId value to set + * @return the RequestReportRecordContractInner object itself. + */ + public RequestReportRecordContractInner withApiId(String apiId) { + this.apiId = apiId; + return this; + } + + /** + * Get operation identifier path. /apis/{apiId}/operations/{operationId}. + * + * @return the operationId value + */ + public String operationId() { + return this.operationId; + } + + /** + * Set operation identifier path. /apis/{apiId}/operations/{operationId}. + * + * @param operationId the operationId value to set + * @return the RequestReportRecordContractInner object itself. + */ + public RequestReportRecordContractInner withOperationId(String operationId) { + this.operationId = operationId; + return this; + } + + /** + * Get product identifier path. /products/{productId}. + * + * @return the productId value + */ + public String productId() { + return this.productId; + } + + /** + * Get user identifier path. /users/{userId}. + * + * @return the userId value + */ + public String userId() { + return this.userId; + } + + /** + * Get the HTTP method associated with this request.. + * + * @return the method value + */ + public String method() { + return this.method; + } + + /** + * Set the HTTP method associated with this request.. + * + * @param method the method value to set + * @return the RequestReportRecordContractInner object itself. + */ + public RequestReportRecordContractInner withMethod(String method) { + this.method = method; + return this; + } + + /** + * Get the full URL associated with this request. + * + * @return the url value + */ + public String url() { + return this.url; + } + + /** + * Set the full URL associated with this request. + * + * @param url the url value to set + * @return the RequestReportRecordContractInner object itself. + */ + public RequestReportRecordContractInner withUrl(String url) { + this.url = url; + return this; + } + + /** + * Get the client IP address associated with this request. + * + * @return the ipAddress value + */ + public String ipAddress() { + return this.ipAddress; + } + + /** + * Set the client IP address associated with this request. + * + * @param ipAddress the ipAddress value to set + * @return the RequestReportRecordContractInner object itself. + */ + public RequestReportRecordContractInner withIpAddress(String ipAddress) { + this.ipAddress = ipAddress; + return this; + } + + /** + * Get the HTTP status code received by the gateway as a result of forwarding this request to the backend. + * + * @return the backendResponseCode value + */ + public String backendResponseCode() { + return this.backendResponseCode; + } + + /** + * Set the HTTP status code received by the gateway as a result of forwarding this request to the backend. + * + * @param backendResponseCode the backendResponseCode value to set + * @return the RequestReportRecordContractInner object itself. + */ + public RequestReportRecordContractInner withBackendResponseCode(String backendResponseCode) { + this.backendResponseCode = backendResponseCode; + return this; + } + + /** + * Get the HTTP status code returned by the gateway. + * + * @return the responseCode value + */ + public Integer responseCode() { + return this.responseCode; + } + + /** + * Set the HTTP status code returned by the gateway. + * + * @param responseCode the responseCode value to set + * @return the RequestReportRecordContractInner object itself. + */ + public RequestReportRecordContractInner withResponseCode(Integer responseCode) { + this.responseCode = responseCode; + return this; + } + + /** + * Get the size of the response returned by the gateway. + * + * @return the responseSize value + */ + public Integer responseSize() { + return this.responseSize; + } + + /** + * Set the size of the response returned by the gateway. + * + * @param responseSize the responseSize value to set + * @return the RequestReportRecordContractInner object itself. + */ + public RequestReportRecordContractInner withResponseSize(Integer responseSize) { + this.responseSize = responseSize; + return this; + } + + /** + * Get the date and time when this request was received by the gateway in ISO 8601 format. + * + * @return the timestamp value + */ + public DateTime timestamp() { + return this.timestamp; + } + + /** + * Set the date and time when this request was received by the gateway in ISO 8601 format. + * + * @param timestamp the timestamp value to set + * @return the RequestReportRecordContractInner object itself. + */ + public RequestReportRecordContractInner withTimestamp(DateTime timestamp) { + this.timestamp = timestamp; + return this; + } + + /** + * Get specifies if response cache was involved in generating the response. If the value is none, the cache was not used. If the value is hit, cached response was returned. If the value is miss, the cache was used but lookup resulted in a miss and request was fulfilled by the backend. + * + * @return the cache value + */ + public String cache() { + return this.cache; + } + + /** + * Set specifies if response cache was involved in generating the response. If the value is none, the cache was not used. If the value is hit, cached response was returned. If the value is miss, the cache was used but lookup resulted in a miss and request was fulfilled by the backend. + * + * @param cache the cache value to set + * @return the RequestReportRecordContractInner object itself. + */ + public RequestReportRecordContractInner withCache(String cache) { + this.cache = cache; + return this; + } + + /** + * Get the total time it took to process this request. + * + * @return the apiTime value + */ + public Double apiTime() { + return this.apiTime; + } + + /** + * Set the total time it took to process this request. + * + * @param apiTime the apiTime value to set + * @return the RequestReportRecordContractInner object itself. + */ + public RequestReportRecordContractInner withApiTime(Double apiTime) { + this.apiTime = apiTime; + return this; + } + + /** + * Get he time it took to forward this request to the backend and get the response back. + * + * @return the serviceTime value + */ + public Double serviceTime() { + return this.serviceTime; + } + + /** + * Set he time it took to forward this request to the backend and get the response back. + * + * @param serviceTime the serviceTime value to set + * @return the RequestReportRecordContractInner object itself. + */ + public RequestReportRecordContractInner withServiceTime(Double serviceTime) { + this.serviceTime = serviceTime; + return this; + } + + /** + * Get azure region where the gateway that processed this request is located. + * + * @return the apiRegion value + */ + public String apiRegion() { + return this.apiRegion; + } + + /** + * Set azure region where the gateway that processed this request is located. + * + * @param apiRegion the apiRegion value to set + * @return the RequestReportRecordContractInner object itself. + */ + public RequestReportRecordContractInner withApiRegion(String apiRegion) { + this.apiRegion = apiRegion; + return this; + } + + /** + * Get subscription identifier path. /subscriptions/{subscriptionId}. + * + * @return the subscriptionId value + */ + public String subscriptionId() { + return this.subscriptionId; + } + + /** + * Set subscription identifier path. /subscriptions/{subscriptionId}. + * + * @param subscriptionId the subscriptionId value to set + * @return the RequestReportRecordContractInner object itself. + */ + public RequestReportRecordContractInner withSubscriptionId(String subscriptionId) { + this.subscriptionId = subscriptionId; + return this; + } + + /** + * Get request Identifier. + * + * @return the requestId value + */ + public String requestId() { + return this.requestId; + } + + /** + * Set request Identifier. + * + * @param requestId the requestId value to set + * @return the RequestReportRecordContractInner object itself. + */ + public RequestReportRecordContractInner withRequestId(String requestId) { + this.requestId = requestId; + return this; + } + + /** + * Get the size of this request.. + * + * @return the requestSize value + */ + public Integer requestSize() { + return this.requestSize; + } + + /** + * Set the size of this request.. + * + * @param requestSize the requestSize value to set + * @return the RequestReportRecordContractInner object itself. + */ + public RequestReportRecordContractInner withRequestSize(Integer requestSize) { + this.requestSize = requestSize; + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ResourceSkuResultImpl.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ResourceSkuResultImpl.java new file mode 100644 index 0000000000000..8273a13ab8c17 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ResourceSkuResultImpl.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.apimanagement.v2019_01_01.implementation; + +import com.microsoft.azure.management.apimanagement.v2019_01_01.ResourceSkuResult; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.apimanagement.v2019_01_01.ResourceSkuCapacity; +import com.microsoft.azure.management.apimanagement.v2019_01_01.ResourceSku; + +class ResourceSkuResultImpl extends WrapperImpl implements ResourceSkuResult { + private final ApiManagementManager manager; + ResourceSkuResultImpl(ResourceSkuResultInner inner, ApiManagementManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public ApiManagementManager manager() { + return this.manager; + } + + @Override + public ResourceSkuCapacity capacity() { + return this.inner().capacity(); + } + + @Override + public String resourceType() { + return this.inner().resourceType(); + } + + @Override + public ResourceSku sku() { + return this.inner().sku(); + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ResourceSkuResultInner.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ResourceSkuResultInner.java new file mode 100644 index 0000000000000..5518d61feaed1 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ResourceSkuResultInner.java @@ -0,0 +1,64 @@ +/** + * 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.apimanagement.v2019_01_01.implementation; + +import com.microsoft.azure.management.apimanagement.v2019_01_01.ResourceSku; +import com.microsoft.azure.management.apimanagement.v2019_01_01.ResourceSkuCapacity; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Describes an available API Management service SKU. + */ +public class ResourceSkuResultInner { + /** + * The type of resource the SKU applies to. + */ + @JsonProperty(value = "resourceType", access = JsonProperty.Access.WRITE_ONLY) + private String resourceType; + + /** + * Specifies API Management SKU. + */ + @JsonProperty(value = "sku", access = JsonProperty.Access.WRITE_ONLY) + private ResourceSku sku; + + /** + * Specifies the number of API Management units. + */ + @JsonProperty(value = "capacity", access = JsonProperty.Access.WRITE_ONLY) + private ResourceSkuCapacity capacity; + + /** + * Get the type of resource the SKU applies to. + * + * @return the resourceType value + */ + public String resourceType() { + return this.resourceType; + } + + /** + * Get specifies API Management SKU. + * + * @return the sku value + */ + public ResourceSku sku() { + return this.sku; + } + + /** + * Get specifies the number of API Management units. + * + * @return the capacity value + */ + public ResourceSkuCapacity capacity() { + return this.capacity; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/SchemaContractImpl.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/SchemaContractImpl.java new file mode 100644 index 0000000000000..e4fdf1a7ccbf4 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/SchemaContractImpl.java @@ -0,0 +1,153 @@ +/** + * 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.apimanagement.v2019_01_01.implementation; + +import com.microsoft.azure.management.apimanagement.v2019_01_01.SchemaContract; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import com.microsoft.azure.management.apimanagement.v2019_01_01.SchemaCreateOrUpdateContract; +import rx.functions.Func1; + +class SchemaContractImpl extends CreatableUpdatableImpl implements SchemaContract, SchemaContract.Definition, SchemaContract.Update { + private final ApiManagementManager manager; + private String resourceGroupName; + private String serviceName; + private String apiId; + private String schemaId; + private String cifMatch; + private String uifMatch; + private SchemaCreateOrUpdateContract createOrUpdateParameter; + + SchemaContractImpl(String name, ApiManagementManager manager) { + super(name, new SchemaContractInner()); + this.manager = manager; + // Set resource name + this.schemaId = name; + // + this.createOrUpdateParameter = new SchemaCreateOrUpdateContract(); + } + + SchemaContractImpl(SchemaContractInner inner, ApiManagementManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.schemaId = inner.name(); + // set resource ancestor and positional variables + this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourceGroups"); + this.serviceName = IdParsingUtils.getValueFromIdByName(inner.id(), "service"); + this.apiId = IdParsingUtils.getValueFromIdByName(inner.id(), "apis"); + this.schemaId = IdParsingUtils.getValueFromIdByName(inner.id(), "schemas"); + // + this.createOrUpdateParameter = new SchemaCreateOrUpdateContract(); + } + + @Override + public ApiManagementManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + ApiSchemasInner client = this.manager().inner().apiSchemas(); + return client.createOrUpdateAsync(this.resourceGroupName, this.serviceName, this.apiId, this.schemaId, this.createOrUpdateParameter, this.cifMatch) + .map(new Func1() { + @Override + public SchemaContractInner call(SchemaContractInner resource) { + resetCreateUpdateParameters(); + return resource; + } + }) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + ApiSchemasInner client = this.manager().inner().apiSchemas(); + return client.createOrUpdateAsync(this.resourceGroupName, this.serviceName, this.apiId, this.schemaId, this.createOrUpdateParameter, this.uifMatch) + .map(new Func1() { + @Override + public SchemaContractInner call(SchemaContractInner resource) { + resetCreateUpdateParameters(); + return resource; + } + }) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + ApiSchemasInner client = this.manager().inner().apiSchemas(); + return client.getAsync(this.resourceGroupName, this.serviceName, this.apiId, this.schemaId); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + private void resetCreateUpdateParameters() { + this.createOrUpdateParameter = new SchemaCreateOrUpdateContract(); + } + + @Override + public String contentType() { + return this.inner().contentType(); + } + + @Override + public Object document() { + return this.inner().document(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public SchemaContractImpl withExistingApi(String resourceGroupName, String serviceName, String apiId) { + this.resourceGroupName = resourceGroupName; + this.serviceName = serviceName; + this.apiId = apiId; + return this; + } + + @Override + public SchemaContractImpl withContentType(String contentType) { + this.createOrUpdateParameter.withContentType(contentType); + return this; + } + + @Override + public SchemaContractImpl withIfMatch(String ifMatch) { + if (isInCreateMode()) { + this.cifMatch = ifMatch; + } else { + this.uifMatch = ifMatch; + } + return this; + } + + @Override + public SchemaContractImpl withValue(String value) { + this.createOrUpdateParameter.withValue(value); + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/SchemaContractInner.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/SchemaContractInner.java new file mode 100644 index 0000000000000..185013e037f2b --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/SchemaContractInner.java @@ -0,0 +1,79 @@ +/** + * 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.apimanagement.v2019_01_01.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * Schema Contract details. + */ +@JsonFlatten +public class SchemaContractInner extends ProxyResource { + /** + * Must be a valid a media type used in a Content-Type header as defined in + * the RFC 2616. Media type of the schema document (e.g. application/json, + * application/xml). </br> - `Swagger` Schema use + * `application/vnd.ms-azure-apim.swagger.definitions+json` </br> - + * `WSDL` Schema use `application/vnd.ms-azure-apim.xsd+xml` </br> - + * `OpenApi` Schema use `application/vnd.oai.openapi.components+json` + * </br> - `WADL Schema` use + * `application/vnd.ms-azure-apim.wadl.grammars+xml`. + */ + @JsonProperty(value = "properties.contentType", required = true) + private String contentType; + + /** + * Properties of the Schema Document. + */ + @JsonProperty(value = "properties.document") + private Object document; + + /** + * Get must be a valid a media type used in a Content-Type header as defined in the RFC 2616. Media type of the schema document (e.g. application/json, application/xml). </br> - `Swagger` Schema use `application/vnd.ms-azure-apim.swagger.definitions+json` </br> - `WSDL` Schema use `application/vnd.ms-azure-apim.xsd+xml` </br> - `OpenApi` Schema use `application/vnd.oai.openapi.components+json` </br> - `WADL Schema` use `application/vnd.ms-azure-apim.wadl.grammars+xml`. + * + * @return the contentType value + */ + public String contentType() { + return this.contentType; + } + + /** + * Set must be a valid a media type used in a Content-Type header as defined in the RFC 2616. Media type of the schema document (e.g. application/json, application/xml). </br> - `Swagger` Schema use `application/vnd.ms-azure-apim.swagger.definitions+json` </br> - `WSDL` Schema use `application/vnd.ms-azure-apim.xsd+xml` </br> - `OpenApi` Schema use `application/vnd.oai.openapi.components+json` </br> - `WADL Schema` use `application/vnd.ms-azure-apim.wadl.grammars+xml`. + * + * @param contentType the contentType value to set + * @return the SchemaContractInner object itself. + */ + public SchemaContractInner withContentType(String contentType) { + this.contentType = contentType; + return this; + } + + /** + * Get properties of the Schema Document. + * + * @return the document value + */ + public Object document() { + return this.document; + } + + /** + * Set properties of the Schema Document. + * + * @param document the document value to set + * @return the SchemaContractInner object itself. + */ + public SchemaContractInner withDocument(Object document) { + this.document = document; + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/SignInSettingsImpl.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/SignInSettingsImpl.java new file mode 100644 index 0000000000000..d3e96d1f0e8c3 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/SignInSettingsImpl.java @@ -0,0 +1,67 @@ +/** + * 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. + * abc + */ + +package com.microsoft.azure.management.apimanagement.v2019_01_01.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.apimanagement.v2019_01_01.SignInSettings; +import rx.Completable; +import rx.functions.Func1; +import rx.Observable; +import com.microsoft.azure.management.apimanagement.v2019_01_01.PortalSigninSettings; + +class SignInSettingsImpl extends WrapperImpl implements SignInSettings { + private final ApiManagementManager manager; + + SignInSettingsImpl(ApiManagementManager manager) { + super(manager.inner().signInSettings()); + this.manager = manager; + } + + public ApiManagementManager manager() { + return this.manager; + } + + @Override + public Completable getEntityTagAsync(String resourceGroupName, String serviceName) { + SignInSettingsInner client = this.inner(); + return client.getEntityTagAsync(resourceGroupName, serviceName).toCompletable(); + } + + @Override + public Observable getAsync(String resourceGroupName, String serviceName) { + SignInSettingsInner client = this.inner(); + return client.getAsync(resourceGroupName, serviceName) + .map(new Func1() { + @Override + public PortalSigninSettings call(PortalSigninSettingsInner inner) { + return new PortalSigninSettingsImpl(inner, manager()); + } + }); + } + + @Override + public Completable updateAsync(String resourceGroupName, String serviceName, String ifMatch) { + SignInSettingsInner client = this.inner(); + return client.updateAsync(resourceGroupName, serviceName, ifMatch).toCompletable(); + } + + @Override + public Observable createOrUpdateAsync(String resourceGroupName, String serviceName) { + SignInSettingsInner client = this.inner(); + return client.createOrUpdateAsync(resourceGroupName, serviceName) + .map(new Func1() { + @Override + public PortalSigninSettings call(PortalSigninSettingsInner inner) { + return new PortalSigninSettingsImpl(inner, manager()); + } + }); + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/SignInSettingsInner.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/SignInSettingsInner.java new file mode 100644 index 0000000000000..c30de5df901da --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/SignInSettingsInner.java @@ -0,0 +1,615 @@ +/** + * 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.apimanagement.v2019_01_01.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.management.apimanagement.v2019_01_01.ErrorResponseException; +import com.microsoft.azure.management.apimanagement.v2019_01_01.SignInSettingsGetEntityTagHeaders; +import com.microsoft.azure.management.apimanagement.v2019_01_01.SignInSettingsGetHeaders; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import com.microsoft.rest.ServiceResponseWithHeaders; +import java.io.IOException; +import okhttp3.ResponseBody; +import retrofit2.http.Body; +import retrofit2.http.GET; +import retrofit2.http.HEAD; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.PATCH; +import retrofit2.http.Path; +import retrofit2.http.PUT; +import retrofit2.http.Query; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in SignInSettings. + */ +public class SignInSettingsInner { + /** The Retrofit service to perform REST calls. */ + private SignInSettingsService service; + /** The service client containing this operation class. */ + private ApiManagementClientImpl client; + + /** + * Initializes an instance of SignInSettingsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public SignInSettingsInner(Retrofit retrofit, ApiManagementClientImpl client) { + this.service = retrofit.create(SignInSettingsService.class); + this.client = client; + } + + /** + * The interface defining all the services for SignInSettings to be + * used by Retrofit to perform actually REST calls. + */ + interface SignInSettingsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.apimanagement.v2019_01_01.SignInSettings getEntityTag" }) + @HEAD("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalsettings/signin") + Observable> getEntityTag(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("subscriptionId") String subscriptionId, @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.apimanagement.v2019_01_01.SignInSettings get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalsettings/signin") + Observable> get(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("subscriptionId") String subscriptionId, @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.apimanagement.v2019_01_01.SignInSettings update" }) + @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalsettings/signin") + Observable> update(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("subscriptionId") String subscriptionId, @Header("If-Match") String ifMatch, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body PortalSigninSettingsInner parameters, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.apimanagement.v2019_01_01.SignInSettings createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalsettings/signin") + Observable> createOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("subscriptionId") String subscriptionId, @Header("If-Match") String ifMatch, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body PortalSigninSettingsInner parameters, @Header("User-Agent") String userAgent); + + } + + /** + * Gets the entity state (Etag) version of the SignInSettings. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void getEntityTag(String resourceGroupName, String serviceName) { + getEntityTagWithServiceResponseAsync(resourceGroupName, serviceName).toBlocking().single().body(); + } + + /** + * Gets the entity state (Etag) version of the SignInSettings. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @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 getEntityTagAsync(String resourceGroupName, String serviceName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(getEntityTagWithServiceResponseAsync(resourceGroupName, serviceName), serviceCallback); + } + + /** + * Gets the entity state (Etag) version of the SignInSettings. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public Observable getEntityTagAsync(String resourceGroupName, String serviceName) { + return getEntityTagWithServiceResponseAsync(resourceGroupName, serviceName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Gets the entity state (Etag) version of the SignInSettings. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public Observable> getEntityTagWithServiceResponseAsync(String resourceGroupName, String serviceName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + 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.getEntityTag(resourceGroupName, serviceName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = getEntityTagDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponseWithHeaders getEntityTagDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .buildEmptyWithHeaders(response, SignInSettingsGetEntityTagHeaders.class); + } + + /** + * Get Sign In Settings for the Portal. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PortalSigninSettingsInner object if successful. + */ + public PortalSigninSettingsInner get(String resourceGroupName, String serviceName) { + return getWithServiceResponseAsync(resourceGroupName, serviceName).toBlocking().single().body(); + } + + /** + * Get Sign In Settings for the Portal. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @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 getAsync(String resourceGroupName, String serviceName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(getWithServiceResponseAsync(resourceGroupName, serviceName), serviceCallback); + } + + /** + * Get Sign In Settings for the Portal. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PortalSigninSettingsInner object + */ + public Observable getAsync(String resourceGroupName, String serviceName) { + return getWithServiceResponseAsync(resourceGroupName, serviceName).map(new Func1, PortalSigninSettingsInner>() { + @Override + public PortalSigninSettingsInner call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Get Sign In Settings for the Portal. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PortalSigninSettingsInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String serviceName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + 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.get(resourceGroupName, serviceName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = getDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponseWithHeaders getDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .buildWithHeaders(response, SignInSettingsGetHeaders.class); + } + + /** + * Update Sign-In settings. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void update(String resourceGroupName, String serviceName, String ifMatch) { + updateWithServiceResponseAsync(resourceGroupName, serviceName, ifMatch).toBlocking().single().body(); + } + + /** + * Update Sign-In settings. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @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 serviceName, String ifMatch, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateWithServiceResponseAsync(resourceGroupName, serviceName, ifMatch), serviceCallback); + } + + /** + * Update Sign-In settings. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable updateAsync(String resourceGroupName, String serviceName, String ifMatch) { + return updateWithServiceResponseAsync(resourceGroupName, serviceName, ifMatch).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Update Sign-In settings. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> updateWithServiceResponseAsync(String resourceGroupName, String serviceName, String ifMatch) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (ifMatch == null) { + throw new IllegalArgumentException("Parameter ifMatch 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 Boolean enabled = null; + PortalSigninSettingsInner parameters = new PortalSigninSettingsInner(); + parameters.withEnabled(null); + return service.update(resourceGroupName, serviceName, this.client.subscriptionId(), ifMatch, this.client.apiVersion(), this.client.acceptLanguage(), parameters, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = updateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Update Sign-In settings. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @param enabled Redirect Anonymous users to the Sign-In page. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void update(String resourceGroupName, String serviceName, String ifMatch, Boolean enabled) { + updateWithServiceResponseAsync(resourceGroupName, serviceName, ifMatch, enabled).toBlocking().single().body(); + } + + /** + * Update Sign-In settings. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @param enabled Redirect Anonymous users to the Sign-In page. + * @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 serviceName, String ifMatch, Boolean enabled, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateWithServiceResponseAsync(resourceGroupName, serviceName, ifMatch, enabled), serviceCallback); + } + + /** + * Update Sign-In settings. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @param enabled Redirect Anonymous users to the Sign-In page. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable updateAsync(String resourceGroupName, String serviceName, String ifMatch, Boolean enabled) { + return updateWithServiceResponseAsync(resourceGroupName, serviceName, ifMatch, enabled).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Update Sign-In settings. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @param enabled Redirect Anonymous users to the Sign-In page. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> updateWithServiceResponseAsync(String resourceGroupName, String serviceName, String ifMatch, Boolean enabled) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (ifMatch == null) { + throw new IllegalArgumentException("Parameter ifMatch is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + PortalSigninSettingsInner parameters = new PortalSigninSettingsInner(); + parameters.withEnabled(enabled); + return service.update(resourceGroupName, serviceName, this.client.subscriptionId(), ifMatch, this.client.apiVersion(), this.client.acceptLanguage(), parameters, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = updateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse updateDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(204, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Create or Update Sign-In settings. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PortalSigninSettingsInner object if successful. + */ + public PortalSigninSettingsInner createOrUpdate(String resourceGroupName, String serviceName) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serviceName).toBlocking().single().body(); + } + + /** + * Create or Update Sign-In settings. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @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 createOrUpdateAsync(String resourceGroupName, String serviceName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, serviceName), serviceCallback); + } + + /** + * Create or Update Sign-In settings. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PortalSigninSettingsInner object + */ + public Observable createOrUpdateAsync(String resourceGroupName, String serviceName) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serviceName).map(new Func1, PortalSigninSettingsInner>() { + @Override + public PortalSigninSettingsInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Create or Update Sign-In settings. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PortalSigninSettingsInner object + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String serviceName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + 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 ifMatch = null; + final Boolean enabled = null; + PortalSigninSettingsInner parameters = new PortalSigninSettingsInner(); + parameters.withEnabled(null); + return service.createOrUpdate(resourceGroupName, serviceName, this.client.subscriptionId(), ifMatch, this.client.apiVersion(), this.client.acceptLanguage(), parameters, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = createOrUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Create or Update Sign-In settings. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param ifMatch ETag of the Entity. Not required when creating an entity, but required when updating an entity. + * @param enabled Redirect Anonymous users to the Sign-In page. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PortalSigninSettingsInner object if successful. + */ + public PortalSigninSettingsInner createOrUpdate(String resourceGroupName, String serviceName, String ifMatch, Boolean enabled) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serviceName, ifMatch, enabled).toBlocking().single().body(); + } + + /** + * Create or Update Sign-In settings. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param ifMatch ETag of the Entity. Not required when creating an entity, but required when updating an entity. + * @param enabled Redirect Anonymous users to the Sign-In page. + * @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 createOrUpdateAsync(String resourceGroupName, String serviceName, String ifMatch, Boolean enabled, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, serviceName, ifMatch, enabled), serviceCallback); + } + + /** + * Create or Update Sign-In settings. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param ifMatch ETag of the Entity. Not required when creating an entity, but required when updating an entity. + * @param enabled Redirect Anonymous users to the Sign-In page. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PortalSigninSettingsInner object + */ + public Observable createOrUpdateAsync(String resourceGroupName, String serviceName, String ifMatch, Boolean enabled) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serviceName, ifMatch, enabled).map(new Func1, PortalSigninSettingsInner>() { + @Override + public PortalSigninSettingsInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Create or Update Sign-In settings. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param ifMatch ETag of the Entity. Not required when creating an entity, but required when updating an entity. + * @param enabled Redirect Anonymous users to the Sign-In page. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PortalSigninSettingsInner object + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String serviceName, String ifMatch, Boolean enabled) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + 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."); + } + PortalSigninSettingsInner parameters = new PortalSigninSettingsInner(); + parameters.withEnabled(enabled); + return service.createOrUpdate(resourceGroupName, serviceName, this.client.subscriptionId(), ifMatch, this.client.apiVersion(), this.client.acceptLanguage(), parameters, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = createOrUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse createOrUpdateDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/SignUpSettingsImpl.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/SignUpSettingsImpl.java new file mode 100644 index 0000000000000..2eab30bf2085d --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/SignUpSettingsImpl.java @@ -0,0 +1,67 @@ +/** + * 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. + * abc + */ + +package com.microsoft.azure.management.apimanagement.v2019_01_01.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.apimanagement.v2019_01_01.SignUpSettings; +import rx.Completable; +import rx.functions.Func1; +import rx.Observable; +import com.microsoft.azure.management.apimanagement.v2019_01_01.PortalSignupSettings; + +class SignUpSettingsImpl extends WrapperImpl implements SignUpSettings { + private final ApiManagementManager manager; + + SignUpSettingsImpl(ApiManagementManager manager) { + super(manager.inner().signUpSettings()); + this.manager = manager; + } + + public ApiManagementManager manager() { + return this.manager; + } + + @Override + public Completable getEntityTagAsync(String resourceGroupName, String serviceName) { + SignUpSettingsInner client = this.inner(); + return client.getEntityTagAsync(resourceGroupName, serviceName).toCompletable(); + } + + @Override + public Observable getAsync(String resourceGroupName, String serviceName) { + SignUpSettingsInner client = this.inner(); + return client.getAsync(resourceGroupName, serviceName) + .map(new Func1() { + @Override + public PortalSignupSettings call(PortalSignupSettingsInner inner) { + return new PortalSignupSettingsImpl(inner, manager()); + } + }); + } + + @Override + public Completable updateAsync(String resourceGroupName, String serviceName, PortalSignupSettingsInner parameters, String ifMatch) { + SignUpSettingsInner client = this.inner(); + return client.updateAsync(resourceGroupName, serviceName, parameters, ifMatch).toCompletable(); + } + + @Override + public Observable createOrUpdateAsync(String resourceGroupName, String serviceName, PortalSignupSettingsInner parameters) { + SignUpSettingsInner client = this.inner(); + return client.createOrUpdateAsync(resourceGroupName, serviceName, parameters) + .map(new Func1() { + @Override + public PortalSignupSettings call(PortalSignupSettingsInner inner) { + return new PortalSignupSettingsImpl(inner, manager()); + } + }); + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/SignUpSettingsInner.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/SignUpSettingsInner.java new file mode 100644 index 0000000000000..16be6a5433634 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/SignUpSettingsInner.java @@ -0,0 +1,537 @@ +/** + * 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.apimanagement.v2019_01_01.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.management.apimanagement.v2019_01_01.ErrorResponseException; +import com.microsoft.azure.management.apimanagement.v2019_01_01.SignUpSettingsGetEntityTagHeaders; +import com.microsoft.azure.management.apimanagement.v2019_01_01.SignUpSettingsGetHeaders; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import com.microsoft.rest.ServiceResponseWithHeaders; +import com.microsoft.rest.Validator; +import java.io.IOException; +import okhttp3.ResponseBody; +import retrofit2.http.Body; +import retrofit2.http.GET; +import retrofit2.http.HEAD; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.PATCH; +import retrofit2.http.Path; +import retrofit2.http.PUT; +import retrofit2.http.Query; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in SignUpSettings. + */ +public class SignUpSettingsInner { + /** The Retrofit service to perform REST calls. */ + private SignUpSettingsService service; + /** The service client containing this operation class. */ + private ApiManagementClientImpl client; + + /** + * Initializes an instance of SignUpSettingsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public SignUpSettingsInner(Retrofit retrofit, ApiManagementClientImpl client) { + this.service = retrofit.create(SignUpSettingsService.class); + this.client = client; + } + + /** + * The interface defining all the services for SignUpSettings to be + * used by Retrofit to perform actually REST calls. + */ + interface SignUpSettingsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.apimanagement.v2019_01_01.SignUpSettings getEntityTag" }) + @HEAD("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalsettings/signup") + Observable> getEntityTag(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("subscriptionId") String subscriptionId, @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.apimanagement.v2019_01_01.SignUpSettings get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalsettings/signup") + Observable> get(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("subscriptionId") String subscriptionId, @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.apimanagement.v2019_01_01.SignUpSettings update" }) + @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalsettings/signup") + Observable> update(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("subscriptionId") String subscriptionId, @Body PortalSignupSettingsInner parameters, @Header("If-Match") String ifMatch, @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.apimanagement.v2019_01_01.SignUpSettings createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalsettings/signup") + Observable> createOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("subscriptionId") String subscriptionId, @Body PortalSignupSettingsInner parameters, @Header("If-Match") String ifMatch, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Gets the entity state (Etag) version of the SignUpSettings. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void getEntityTag(String resourceGroupName, String serviceName) { + getEntityTagWithServiceResponseAsync(resourceGroupName, serviceName).toBlocking().single().body(); + } + + /** + * Gets the entity state (Etag) version of the SignUpSettings. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @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 getEntityTagAsync(String resourceGroupName, String serviceName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(getEntityTagWithServiceResponseAsync(resourceGroupName, serviceName), serviceCallback); + } + + /** + * Gets the entity state (Etag) version of the SignUpSettings. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public Observable getEntityTagAsync(String resourceGroupName, String serviceName) { + return getEntityTagWithServiceResponseAsync(resourceGroupName, serviceName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Gets the entity state (Etag) version of the SignUpSettings. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public Observable> getEntityTagWithServiceResponseAsync(String resourceGroupName, String serviceName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + 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.getEntityTag(resourceGroupName, serviceName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = getEntityTagDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponseWithHeaders getEntityTagDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .buildEmptyWithHeaders(response, SignUpSettingsGetEntityTagHeaders.class); + } + + /** + * Get Sign Up Settings for the Portal. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PortalSignupSettingsInner object if successful. + */ + public PortalSignupSettingsInner get(String resourceGroupName, String serviceName) { + return getWithServiceResponseAsync(resourceGroupName, serviceName).toBlocking().single().body(); + } + + /** + * Get Sign Up Settings for the Portal. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @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 getAsync(String resourceGroupName, String serviceName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(getWithServiceResponseAsync(resourceGroupName, serviceName), serviceCallback); + } + + /** + * Get Sign Up Settings for the Portal. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PortalSignupSettingsInner object + */ + public Observable getAsync(String resourceGroupName, String serviceName) { + return getWithServiceResponseAsync(resourceGroupName, serviceName).map(new Func1, PortalSignupSettingsInner>() { + @Override + public PortalSignupSettingsInner call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Get Sign Up Settings for the Portal. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PortalSignupSettingsInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String serviceName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + 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.get(resourceGroupName, serviceName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = getDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponseWithHeaders getDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .buildWithHeaders(response, SignUpSettingsGetHeaders.class); + } + + /** + * Update Sign-Up settings. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param parameters Update Sign-Up settings. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void update(String resourceGroupName, String serviceName, PortalSignupSettingsInner parameters, String ifMatch) { + updateWithServiceResponseAsync(resourceGroupName, serviceName, parameters, ifMatch).toBlocking().single().body(); + } + + /** + * Update Sign-Up settings. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param parameters Update Sign-Up settings. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @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 serviceName, PortalSignupSettingsInner parameters, String ifMatch, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateWithServiceResponseAsync(resourceGroupName, serviceName, parameters, ifMatch), serviceCallback); + } + + /** + * Update Sign-Up settings. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param parameters Update Sign-Up settings. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable updateAsync(String resourceGroupName, String serviceName, PortalSignupSettingsInner parameters, String ifMatch) { + return updateWithServiceResponseAsync(resourceGroupName, serviceName, parameters, ifMatch).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Update Sign-Up settings. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param parameters Update Sign-Up settings. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> updateWithServiceResponseAsync(String resourceGroupName, String serviceName, PortalSignupSettingsInner parameters, String ifMatch) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + if (ifMatch == null) { + throw new IllegalArgumentException("Parameter ifMatch is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(parameters); + return service.update(resourceGroupName, serviceName, this.client.subscriptionId(), parameters, ifMatch, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = updateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse updateDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(204, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Create or Update Sign-Up settings. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param parameters Create or update parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PortalSignupSettingsInner object if successful. + */ + public PortalSignupSettingsInner createOrUpdate(String resourceGroupName, String serviceName, PortalSignupSettingsInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serviceName, parameters).toBlocking().single().body(); + } + + /** + * Create or Update Sign-Up settings. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param parameters Create or update parameters. + * @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 createOrUpdateAsync(String resourceGroupName, String serviceName, PortalSignupSettingsInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, serviceName, parameters), serviceCallback); + } + + /** + * Create or Update Sign-Up settings. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param parameters Create or update parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PortalSignupSettingsInner object + */ + public Observable createOrUpdateAsync(String resourceGroupName, String serviceName, PortalSignupSettingsInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serviceName, parameters).map(new Func1, PortalSignupSettingsInner>() { + @Override + public PortalSignupSettingsInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Create or Update Sign-Up settings. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param parameters Create or update parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PortalSignupSettingsInner object + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String serviceName, PortalSignupSettingsInner parameters) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(parameters); + final String ifMatch = null; + return service.createOrUpdate(resourceGroupName, serviceName, this.client.subscriptionId(), parameters, ifMatch, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = createOrUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Create or Update Sign-Up settings. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param parameters Create or update parameters. + * @param ifMatch ETag of the Entity. Not required when creating an entity, but required when updating an entity. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PortalSignupSettingsInner object if successful. + */ + public PortalSignupSettingsInner createOrUpdate(String resourceGroupName, String serviceName, PortalSignupSettingsInner parameters, String ifMatch) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serviceName, parameters, ifMatch).toBlocking().single().body(); + } + + /** + * Create or Update Sign-Up settings. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param parameters Create or update parameters. + * @param ifMatch ETag of the Entity. Not required when creating an entity, but required when updating an entity. + * @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 createOrUpdateAsync(String resourceGroupName, String serviceName, PortalSignupSettingsInner parameters, String ifMatch, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, serviceName, parameters, ifMatch), serviceCallback); + } + + /** + * Create or Update Sign-Up settings. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param parameters Create or update parameters. + * @param ifMatch ETag of the Entity. Not required when creating an entity, but required when updating an entity. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PortalSignupSettingsInner object + */ + public Observable createOrUpdateAsync(String resourceGroupName, String serviceName, PortalSignupSettingsInner parameters, String ifMatch) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serviceName, parameters, ifMatch).map(new Func1, PortalSignupSettingsInner>() { + @Override + public PortalSignupSettingsInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Create or Update Sign-Up settings. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param parameters Create or update parameters. + * @param ifMatch ETag of the Entity. Not required when creating an entity, but required when updating an entity. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PortalSignupSettingsInner object + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String serviceName, PortalSignupSettingsInner parameters, String ifMatch) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(parameters); + return service.createOrUpdate(resourceGroupName, serviceName, this.client.subscriptionId(), parameters, ifMatch, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = createOrUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse createOrUpdateDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/SubscriptionContractImpl.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/SubscriptionContractImpl.java new file mode 100644 index 0000000000000..5d5078a38e106 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/SubscriptionContractImpl.java @@ -0,0 +1,255 @@ +/** + * 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.apimanagement.v2019_01_01.implementation; + +import com.microsoft.azure.management.apimanagement.v2019_01_01.SubscriptionContract; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import com.microsoft.azure.management.apimanagement.v2019_01_01.SubscriptionCreateParameters; +import org.joda.time.DateTime; +import com.microsoft.azure.management.apimanagement.v2019_01_01.SubscriptionState; +import rx.functions.Func1; + +class SubscriptionContractImpl extends CreatableUpdatableImpl implements SubscriptionContract, SubscriptionContract.Definition, SubscriptionContract.Update { + private String resourceGroupName; + private String serviceName; + private String sid; + private Boolean cnotify; + private String cifMatch; + private Boolean unotify; + private String uifMatch; + private SubscriptionCreateParameters createOrUpdateParameter; + private final ApiManagementManager manager; + + SubscriptionContractImpl(String name, ApiManagementManager manager) { + super(name, new SubscriptionContractInner()); + this.manager = manager; + // Set resource name + this.sid = name; + // + this.createOrUpdateParameter = new SubscriptionCreateParameters(); + } + + SubscriptionContractImpl(SubscriptionContractInner inner, ApiManagementManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.sid = inner.name(); + // set resource ancestor and positional variables + this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourceGroups"); + this.serviceName = IdParsingUtils.getValueFromIdByName(inner.id(), "service"); + this.sid = IdParsingUtils.getValueFromIdByName(inner.id(), "subscriptions"); + // set other parameters for create and update + this.createOrUpdateParameter = new SubscriptionCreateParameters(); + } + + @Override + public ApiManagementManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + SubscriptionsInner client = this.manager().inner().subscriptions(); + return client.createOrUpdateAsync(this.resourceGroupName, this.serviceName, this.sid, this.createOrUpdateParameter, this.cnotify, this.cifMatch) + .map(new Func1() { + @Override + public SubscriptionContractInner call(SubscriptionContractInner resource) { + resetCreateUpdateParameters(); + return resource; + } + }) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + SubscriptionsInner client = this.manager().inner().subscriptions(); + return client.createOrUpdateAsync(this.resourceGroupName, this.serviceName, this.sid, this.createOrUpdateParameter, this.unotify, this.uifMatch) + .map(new Func1() { + @Override + public SubscriptionContractInner call(SubscriptionContractInner resource) { + resetCreateUpdateParameters(); + return resource; + } + }) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + SubscriptionsInner client = this.manager().inner().subscriptions(); + return null; // NOP getInnerAsync implementation as get is not supported + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + private void resetCreateUpdateParameters() { + this.createOrUpdateParameter = new SubscriptionCreateParameters(); + } + + @Override + public Boolean allowTracing() { + return this.inner().allowTracing(); + } + + @Override + public DateTime createdDate() { + return this.inner().createdDate(); + } + + @Override + public String displayName() { + return this.inner().displayName(); + } + + @Override + public DateTime endDate() { + return this.inner().endDate(); + } + + @Override + public DateTime expirationDate() { + return this.inner().expirationDate(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public DateTime notificationDate() { + return this.inner().notificationDate(); + } + + @Override + public String ownerId() { + return this.inner().ownerId(); + } + + @Override + public String primaryKey() { + return this.inner().primaryKey(); + } + + @Override + public String scope() { + return this.inner().scope(); + } + + @Override + public String secondaryKey() { + return this.inner().secondaryKey(); + } + + @Override + public DateTime startDate() { + return this.inner().startDate(); + } + + @Override + public SubscriptionState state() { + return this.inner().state(); + } + + @Override + public String stateComment() { + return this.inner().stateComment(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public SubscriptionContractImpl withResourceGroupName(String resourceGroupName) { + this.resourceGroupName = resourceGroupName; + return this; + } + + @Override + public SubscriptionContractImpl withServiceName(String serviceName) { + this.serviceName = serviceName; + return this; + } + + @Override + public SubscriptionContractImpl withDisplayName(String displayName) { + this.createOrUpdateParameter.withDisplayName(displayName); + return this; + } + + @Override + public SubscriptionContractImpl withScope(String scope) { + this.createOrUpdateParameter.withScope(scope); + return this; + } + + @Override + public SubscriptionContractImpl withNotify(Boolean notify) { + if (isInCreateMode()) { + this.cnotify = notify; + } else { + this.unotify = notify; + } + return this; + } + + @Override + public SubscriptionContractImpl withIfMatch(String ifMatch) { + if (isInCreateMode()) { + this.cifMatch = ifMatch; + } else { + this.uifMatch = ifMatch; + } + return this; + } + + @Override + public SubscriptionContractImpl withAllowTracing(Boolean allowTracing) { + this.createOrUpdateParameter.withAllowTracing(allowTracing); + return this; + } + + @Override + public SubscriptionContractImpl withOwnerId(String ownerId) { + this.createOrUpdateParameter.withOwnerId(ownerId); + return this; + } + + @Override + public SubscriptionContractImpl withPrimaryKey(String primaryKey) { + this.createOrUpdateParameter.withPrimaryKey(primaryKey); + return this; + } + + @Override + public SubscriptionContractImpl withSecondaryKey(String secondaryKey) { + this.createOrUpdateParameter.withSecondaryKey(secondaryKey); + return this; + } + + @Override + public SubscriptionContractImpl withState(SubscriptionState state) { + this.createOrUpdateParameter.withState(state); + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/SubscriptionContractInner.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/SubscriptionContractInner.java new file mode 100644 index 0000000000000..9e7b28bd515ec --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/SubscriptionContractInner.java @@ -0,0 +1,374 @@ +/** + * 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.apimanagement.v2019_01_01.implementation; + +import com.microsoft.azure.management.apimanagement.v2019_01_01.SubscriptionState; +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * Subscription details. + */ +@JsonFlatten +public class SubscriptionContractInner extends ProxyResource { + /** + * The user resource identifier of the subscription owner. The value is a + * valid relative URL in the format of /users/{userId} where {userId} is a + * user identifier. + */ + @JsonProperty(value = "properties.ownerId") + private String ownerId; + + /** + * Scope like /products/{productId} or /apis or /apis/{apiId}. + */ + @JsonProperty(value = "properties.scope", required = true) + private String scope; + + /** + * The name of the subscription, or null if the subscription has no name. + */ + @JsonProperty(value = "properties.displayName") + private String displayName; + + /** + * Subscription state. Possible states are * active – the subscription is + * active, * suspended – the subscription is blocked, and the subscriber + * cannot call any APIs of the product, * submitted – the subscription + * request has been made by the developer, but has not yet been approved or + * rejected, * rejected – the subscription request has been denied by an + * administrator, * cancelled – the subscription has been cancelled by the + * developer or administrator, * expired – the subscription reached its + * expiration date and was deactivated. Possible values include: + * 'suspended', 'active', 'expired', 'submitted', 'rejected', 'cancelled'. + */ + @JsonProperty(value = "properties.state", required = true) + private SubscriptionState state; + + /** + * Subscription creation date. The date conforms to the following format: + * `yyyy-MM-ddTHH:mm:ssZ` as specified by the ISO 8601 standard. + */ + @JsonProperty(value = "properties.createdDate", access = JsonProperty.Access.WRITE_ONLY) + private DateTime createdDate; + + /** + * Subscription activation date. The setting is for audit purposes only and + * the subscription is not automatically activated. The subscription + * lifecycle can be managed by using the `state` property. The date + * conforms to the following format: `yyyy-MM-ddTHH:mm:ssZ` as specified by + * the ISO 8601 standard. + */ + @JsonProperty(value = "properties.startDate") + private DateTime startDate; + + /** + * Subscription expiration date. The setting is for audit purposes only and + * the subscription is not automatically expired. The subscription + * lifecycle can be managed by using the `state` property. The date + * conforms to the following format: `yyyy-MM-ddTHH:mm:ssZ` as specified by + * the ISO 8601 standard. + */ + @JsonProperty(value = "properties.expirationDate") + private DateTime expirationDate; + + /** + * Date when subscription was cancelled or expired. The setting is for + * audit purposes only and the subscription is not automatically cancelled. + * The subscription lifecycle can be managed by using the `state` property. + * The date conforms to the following format: `yyyy-MM-ddTHH:mm:ssZ` as + * specified by the ISO 8601 standard. + */ + @JsonProperty(value = "properties.endDate") + private DateTime endDate; + + /** + * Upcoming subscription expiration notification date. The date conforms to + * the following format: `yyyy-MM-ddTHH:mm:ssZ` as specified by the ISO + * 8601 standard. + */ + @JsonProperty(value = "properties.notificationDate") + private DateTime notificationDate; + + /** + * Subscription primary key. + */ + @JsonProperty(value = "properties.primaryKey", required = true) + private String primaryKey; + + /** + * Subscription secondary key. + */ + @JsonProperty(value = "properties.secondaryKey", required = true) + private String secondaryKey; + + /** + * Optional subscription comment added by an administrator. + */ + @JsonProperty(value = "properties.stateComment") + private String stateComment; + + /** + * Determines whether tracing is enabled. + */ + @JsonProperty(value = "properties.allowTracing") + private Boolean allowTracing; + + /** + * Get the user resource identifier of the subscription owner. The value is a valid relative URL in the format of /users/{userId} where {userId} is a user identifier. + * + * @return the ownerId value + */ + public String ownerId() { + return this.ownerId; + } + + /** + * Set the user resource identifier of the subscription owner. The value is a valid relative URL in the format of /users/{userId} where {userId} is a user identifier. + * + * @param ownerId the ownerId value to set + * @return the SubscriptionContractInner object itself. + */ + public SubscriptionContractInner withOwnerId(String ownerId) { + this.ownerId = ownerId; + return this; + } + + /** + * Get scope like /products/{productId} or /apis or /apis/{apiId}. + * + * @return the scope value + */ + public String scope() { + return this.scope; + } + + /** + * Set scope like /products/{productId} or /apis or /apis/{apiId}. + * + * @param scope the scope value to set + * @return the SubscriptionContractInner object itself. + */ + public SubscriptionContractInner withScope(String scope) { + this.scope = scope; + return this; + } + + /** + * Get the name of the subscription, or null if the subscription has no name. + * + * @return the displayName value + */ + public String displayName() { + return this.displayName; + } + + /** + * Set the name of the subscription, or null if the subscription has no name. + * + * @param displayName the displayName value to set + * @return the SubscriptionContractInner object itself. + */ + public SubscriptionContractInner withDisplayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Get subscription state. Possible states are * active – the subscription is active, * suspended – the subscription is blocked, and the subscriber cannot call any APIs of the product, * submitted – the subscription request has been made by the developer, but has not yet been approved or rejected, * rejected – the subscription request has been denied by an administrator, * cancelled – the subscription has been cancelled by the developer or administrator, * expired – the subscription reached its expiration date and was deactivated. Possible values include: 'suspended', 'active', 'expired', 'submitted', 'rejected', 'cancelled'. + * + * @return the state value + */ + public SubscriptionState state() { + return this.state; + } + + /** + * Set subscription state. Possible states are * active – the subscription is active, * suspended – the subscription is blocked, and the subscriber cannot call any APIs of the product, * submitted – the subscription request has been made by the developer, but has not yet been approved or rejected, * rejected – the subscription request has been denied by an administrator, * cancelled – the subscription has been cancelled by the developer or administrator, * expired – the subscription reached its expiration date and was deactivated. Possible values include: 'suspended', 'active', 'expired', 'submitted', 'rejected', 'cancelled'. + * + * @param state the state value to set + * @return the SubscriptionContractInner object itself. + */ + public SubscriptionContractInner withState(SubscriptionState state) { + this.state = state; + return this; + } + + /** + * Get subscription creation date. The date conforms to the following format: `yyyy-MM-ddTHH:mm:ssZ` as specified by the ISO 8601 standard. + * + * @return the createdDate value + */ + public DateTime createdDate() { + return this.createdDate; + } + + /** + * Get subscription activation date. The setting is for audit purposes only and the subscription is not automatically activated. The subscription lifecycle can be managed by using the `state` property. The date conforms to the following format: `yyyy-MM-ddTHH:mm:ssZ` as specified by the ISO 8601 standard. + * + * @return the startDate value + */ + public DateTime startDate() { + return this.startDate; + } + + /** + * Set subscription activation date. The setting is for audit purposes only and the subscription is not automatically activated. The subscription lifecycle can be managed by using the `state` property. The date conforms to the following format: `yyyy-MM-ddTHH:mm:ssZ` as specified by the ISO 8601 standard. + * + * @param startDate the startDate value to set + * @return the SubscriptionContractInner object itself. + */ + public SubscriptionContractInner withStartDate(DateTime startDate) { + this.startDate = startDate; + return this; + } + + /** + * Get subscription expiration date. The setting is for audit purposes only and the subscription is not automatically expired. The subscription lifecycle can be managed by using the `state` property. The date conforms to the following format: `yyyy-MM-ddTHH:mm:ssZ` as specified by the ISO 8601 standard. + * + * @return the expirationDate value + */ + public DateTime expirationDate() { + return this.expirationDate; + } + + /** + * Set subscription expiration date. The setting is for audit purposes only and the subscription is not automatically expired. The subscription lifecycle can be managed by using the `state` property. The date conforms to the following format: `yyyy-MM-ddTHH:mm:ssZ` as specified by the ISO 8601 standard. + * + * @param expirationDate the expirationDate value to set + * @return the SubscriptionContractInner object itself. + */ + public SubscriptionContractInner withExpirationDate(DateTime expirationDate) { + this.expirationDate = expirationDate; + return this; + } + + /** + * Get date when subscription was cancelled or expired. The setting is for audit purposes only and the subscription is not automatically cancelled. The subscription lifecycle can be managed by using the `state` property. The date conforms to the following format: `yyyy-MM-ddTHH:mm:ssZ` as specified by the ISO 8601 standard. + * + * @return the endDate value + */ + public DateTime endDate() { + return this.endDate; + } + + /** + * Set date when subscription was cancelled or expired. The setting is for audit purposes only and the subscription is not automatically cancelled. The subscription lifecycle can be managed by using the `state` property. The date conforms to the following format: `yyyy-MM-ddTHH:mm:ssZ` as specified by the ISO 8601 standard. + * + * @param endDate the endDate value to set + * @return the SubscriptionContractInner object itself. + */ + public SubscriptionContractInner withEndDate(DateTime endDate) { + this.endDate = endDate; + return this; + } + + /** + * Get upcoming subscription expiration notification date. The date conforms to the following format: `yyyy-MM-ddTHH:mm:ssZ` as specified by the ISO 8601 standard. + * + * @return the notificationDate value + */ + public DateTime notificationDate() { + return this.notificationDate; + } + + /** + * Set upcoming subscription expiration notification date. The date conforms to the following format: `yyyy-MM-ddTHH:mm:ssZ` as specified by the ISO 8601 standard. + * + * @param notificationDate the notificationDate value to set + * @return the SubscriptionContractInner object itself. + */ + public SubscriptionContractInner withNotificationDate(DateTime notificationDate) { + this.notificationDate = notificationDate; + return this; + } + + /** + * Get subscription primary key. + * + * @return the primaryKey value + */ + public String primaryKey() { + return this.primaryKey; + } + + /** + * Set subscription primary key. + * + * @param primaryKey the primaryKey value to set + * @return the SubscriptionContractInner object itself. + */ + public SubscriptionContractInner withPrimaryKey(String primaryKey) { + this.primaryKey = primaryKey; + return this; + } + + /** + * Get subscription secondary key. + * + * @return the secondaryKey value + */ + public String secondaryKey() { + return this.secondaryKey; + } + + /** + * Set subscription secondary key. + * + * @param secondaryKey the secondaryKey value to set + * @return the SubscriptionContractInner object itself. + */ + public SubscriptionContractInner withSecondaryKey(String secondaryKey) { + this.secondaryKey = secondaryKey; + return this; + } + + /** + * Get optional subscription comment added by an administrator. + * + * @return the stateComment value + */ + public String stateComment() { + return this.stateComment; + } + + /** + * Set optional subscription comment added by an administrator. + * + * @param stateComment the stateComment value to set + * @return the SubscriptionContractInner object itself. + */ + public SubscriptionContractInner withStateComment(String stateComment) { + this.stateComment = stateComment; + return this; + } + + /** + * Get determines whether tracing is enabled. + * + * @return the allowTracing value + */ + public Boolean allowTracing() { + return this.allowTracing; + } + + /** + * Set determines whether tracing is enabled. + * + * @param allowTracing the allowTracing value to set + * @return the SubscriptionContractInner object itself. + */ + public SubscriptionContractInner withAllowTracing(Boolean allowTracing) { + this.allowTracing = allowTracing; + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/SubscriptionsImpl.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/SubscriptionsImpl.java new file mode 100644 index 0000000000000..a5cb904ab22f0 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/SubscriptionsImpl.java @@ -0,0 +1,99 @@ +/** + * 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. + * jkl + */ + +package com.microsoft.azure.management.apimanagement.v2019_01_01.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.apimanagement.v2019_01_01.Subscriptions; +import rx.Completable; +import rx.functions.Func1; +import rx.Observable; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.apimanagement.v2019_01_01.ProductSubscriptionContract; + +class SubscriptionsImpl extends WrapperImpl implements Subscriptions { + private final ApiManagementManager manager; + + SubscriptionsImpl(ApiManagementManager manager) { + super(manager.inner().subscriptions()); + this.manager = manager; + } + + public ApiManagementManager manager() { + return this.manager; + } + + @Override + public SubscriptionContractImpl define(String name) { + return wrapModel(name); + } + + private SubscriptionContractImpl wrapModel(SubscriptionContractInner inner) { + return new SubscriptionContractImpl(inner, manager()); + } + + private SubscriptionContractImpl wrapModel(String name) { + return new SubscriptionContractImpl(name, this.manager()); + } + + @Override + public Observable listAsync(final String resourceGroupName, final String serviceName) { + SubscriptionsInner client = this.inner(); + return client.listAsync(resourceGroupName, serviceName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public ProductSubscriptionContract call(SubscriptionContractInner inner) { + return new ProductSubscriptionContractImpl(inner, manager()); + } + }); + } + + @Override + public Completable getEntityTagAsync(String resourceGroupName, String serviceName, String sid) { + SubscriptionsInner client = this.inner(); + return client.getEntityTagAsync(resourceGroupName, serviceName, sid).toCompletable(); + } + + @Override + public Observable getAsync(String resourceGroupName, String serviceName, String sid) { + SubscriptionsInner client = this.inner(); + return client.getAsync(resourceGroupName, serviceName, sid) + .map(new Func1() { + @Override + public ProductSubscriptionContract call(SubscriptionContractInner inner) { + return new ProductSubscriptionContractImpl(inner, manager()); + } + }); + } + + @Override + public Completable deleteAsync(String resourceGroupName, String serviceName, String sid, String ifMatch) { + SubscriptionsInner client = this.inner(); + return client.deleteAsync(resourceGroupName, serviceName, sid, ifMatch).toCompletable(); + } + + @Override + public Completable regeneratePrimaryKeyAsync(String resourceGroupName, String serviceName, String sid) { + SubscriptionsInner client = this.inner(); + return client.regeneratePrimaryKeyAsync(resourceGroupName, serviceName, sid).toCompletable(); + } + + @Override + public Completable regenerateSecondaryKeyAsync(String resourceGroupName, String serviceName, String sid) { + SubscriptionsInner client = this.inner(); + return client.regenerateSecondaryKeyAsync(resourceGroupName, serviceName, sid).toCompletable(); + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/SubscriptionsInner.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/SubscriptionsInner.java new file mode 100644 index 0000000000000..f68a670f119e8 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/SubscriptionsInner.java @@ -0,0 +1,1382 @@ +/** + * 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.apimanagement.v2019_01_01.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.apimanagement.v2019_01_01.ErrorResponseException; +import com.microsoft.azure.management.apimanagement.v2019_01_01.SubscriptionCreateOrUpdateHeaders; +import com.microsoft.azure.management.apimanagement.v2019_01_01.SubscriptionCreateParameters; +import com.microsoft.azure.management.apimanagement.v2019_01_01.SubscriptionGetEntityTagHeaders; +import com.microsoft.azure.management.apimanagement.v2019_01_01.SubscriptionGetHeaders; +import com.microsoft.azure.management.apimanagement.v2019_01_01.SubscriptionUpdateParameters; +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.ServiceResponseWithHeaders; +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.HEAD; +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 Subscriptions. + */ +public class SubscriptionsInner { + /** The Retrofit service to perform REST calls. */ + private SubscriptionsService service; + /** The service client containing this operation class. */ + private ApiManagementClientImpl client; + + /** + * Initializes an instance of SubscriptionsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public SubscriptionsInner(Retrofit retrofit, ApiManagementClientImpl client) { + this.service = retrofit.create(SubscriptionsService.class); + this.client = client; + } + + /** + * The interface defining all the services for Subscriptions to be + * used by Retrofit to perform actually REST calls. + */ + interface SubscriptionsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.apimanagement.v2019_01_01.Subscriptions list" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/subscriptions") + Observable> list(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("subscriptionId") String subscriptionId, @Query("$filter") String filter, @Query("$top") Integer top, @Query("$skip") Integer skip, @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.apimanagement.v2019_01_01.Subscriptions getEntityTag" }) + @HEAD("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/subscriptions/{sid}") + Observable> getEntityTag(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("sid") String sid, @Path("subscriptionId") String subscriptionId, @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.apimanagement.v2019_01_01.Subscriptions get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/subscriptions/{sid}") + Observable> get(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("sid") String sid, @Path("subscriptionId") String subscriptionId, @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.apimanagement.v2019_01_01.Subscriptions createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/subscriptions/{sid}") + Observable> createOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("sid") String sid, @Path("subscriptionId") String subscriptionId, @Body SubscriptionCreateParameters parameters, @Query("notify") Boolean notify, @Header("If-Match") String ifMatch, @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.apimanagement.v2019_01_01.Subscriptions update" }) + @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/subscriptions/{sid}") + Observable> update(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("sid") String sid, @Path("subscriptionId") String subscriptionId, @Body SubscriptionUpdateParameters parameters, @Query("notify") Boolean notify, @Header("If-Match") String ifMatch, @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.apimanagement.v2019_01_01.Subscriptions delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/subscriptions/{sid}", method = "DELETE", hasBody = true) + Observable> delete(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("sid") String sid, @Path("subscriptionId") String subscriptionId, @Header("If-Match") String ifMatch, @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.apimanagement.v2019_01_01.Subscriptions regeneratePrimaryKey" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/subscriptions/{sid}/regeneratePrimaryKey") + Observable> regeneratePrimaryKey(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("sid") String sid, @Path("subscriptionId") String subscriptionId, @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.apimanagement.v2019_01_01.Subscriptions regenerateSecondaryKey" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/subscriptions/{sid}/regenerateSecondaryKey") + Observable> regenerateSecondaryKey(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("sid") String sid, @Path("subscriptionId") String subscriptionId, @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.apimanagement.v2019_01_01.Subscriptions listNext" }) + @GET + Observable> listNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Lists all subscriptions of the API Management service instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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<SubscriptionContractInner> object if successful. + */ + public PagedList list(final String resourceGroupName, final String serviceName) { + ServiceResponse> response = listSinglePageAsync(resourceGroupName, serviceName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists all subscriptions of the API Management service instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @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 resourceGroupName, final String serviceName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(resourceGroupName, serviceName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists all subscriptions of the API Management service instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<SubscriptionContractInner> object + */ + public Observable> listAsync(final String resourceGroupName, final String serviceName) { + return listWithServiceResponseAsync(resourceGroupName, serviceName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all subscriptions of the API Management service instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<SubscriptionContractInner> object + */ + public Observable>> listWithServiceResponseAsync(final String resourceGroupName, final String serviceName) { + return listSinglePageAsync(resourceGroupName, serviceName) + .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 all subscriptions of the API Management service instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<SubscriptionContractInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync(final String resourceGroupName, final String serviceName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + 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 filter = null; + final Integer top = null; + final Integer skip = null; + return service.list(resourceGroupName, serviceName, this.client.subscriptionId(), filter, top, skip, this.client.apiVersion(), 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 all subscriptions of the API Management service instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| stateComment | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| ownerId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| scope | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| userId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| productId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| state | filter | eq | | </br>| user | expand | | | </br> + * @param top Number of records to return. + * @param skip Number of records to skip. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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<SubscriptionContractInner> object if successful. + */ + public PagedList list(final String resourceGroupName, final String serviceName, final String filter, final Integer top, final Integer skip) { + ServiceResponse> response = listSinglePageAsync(resourceGroupName, serviceName, filter, top, skip).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists all subscriptions of the API Management service instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| stateComment | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| ownerId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| scope | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| userId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| productId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| state | filter | eq | | </br>| user | expand | | | </br> + * @param top Number of records to return. + * @param skip Number of records to skip. + * @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 resourceGroupName, final String serviceName, final String filter, final Integer top, final Integer skip, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(resourceGroupName, serviceName, filter, top, skip), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists all subscriptions of the API Management service instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| stateComment | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| ownerId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| scope | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| userId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| productId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| state | filter | eq | | </br>| user | expand | | | </br> + * @param top Number of records to return. + * @param skip Number of records to skip. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<SubscriptionContractInner> object + */ + public Observable> listAsync(final String resourceGroupName, final String serviceName, final String filter, final Integer top, final Integer skip) { + return listWithServiceResponseAsync(resourceGroupName, serviceName, filter, top, skip) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all subscriptions of the API Management service instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| stateComment | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| ownerId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| scope | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| userId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| productId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| state | filter | eq | | </br>| user | expand | | | </br> + * @param top Number of records to return. + * @param skip Number of records to skip. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<SubscriptionContractInner> object + */ + public Observable>> listWithServiceResponseAsync(final String resourceGroupName, final String serviceName, final String filter, final Integer top, final Integer skip) { + return listSinglePageAsync(resourceGroupName, serviceName, filter, top, skip) + .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 all subscriptions of the API Management service instance. + * + ServiceResponse> * @param resourceGroupName The name of the resource group. + ServiceResponse> * @param serviceName The name of the API Management service. + ServiceResponse> * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| stateComment | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| ownerId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| scope | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| userId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| productId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| state | filter | eq | | </br>| user | expand | | | </br> + ServiceResponse> * @param top Number of records to return. + ServiceResponse> * @param skip Number of records to skip. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<SubscriptionContractInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync(final String resourceGroupName, final String serviceName, final String filter, final Integer top, final Integer skip) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + 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(resourceGroupName, serviceName, this.client.subscriptionId(), filter, top, skip, this.client.apiVersion(), 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 ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Gets the entity state (Etag) version of the apimanagement subscription specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param sid Subscription entity Identifier. The entity represents the association between a user and a product in API Management. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void getEntityTag(String resourceGroupName, String serviceName, String sid) { + getEntityTagWithServiceResponseAsync(resourceGroupName, serviceName, sid).toBlocking().single().body(); + } + + /** + * Gets the entity state (Etag) version of the apimanagement subscription specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param sid Subscription entity Identifier. The entity represents the association between a user and a product in API Management. + * @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 getEntityTagAsync(String resourceGroupName, String serviceName, String sid, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(getEntityTagWithServiceResponseAsync(resourceGroupName, serviceName, sid), serviceCallback); + } + + /** + * Gets the entity state (Etag) version of the apimanagement subscription specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param sid Subscription entity Identifier. The entity represents the association between a user and a product in API Management. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public Observable getEntityTagAsync(String resourceGroupName, String serviceName, String sid) { + return getEntityTagWithServiceResponseAsync(resourceGroupName, serviceName, sid).map(new Func1, Void>() { + @Override + public Void call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Gets the entity state (Etag) version of the apimanagement subscription specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param sid Subscription entity Identifier. The entity represents the association between a user and a product in API Management. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public Observable> getEntityTagWithServiceResponseAsync(String resourceGroupName, String serviceName, String sid) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (sid == null) { + throw new IllegalArgumentException("Parameter sid is required and cannot be null."); + } + 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.getEntityTag(resourceGroupName, serviceName, sid, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = getEntityTagDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponseWithHeaders getEntityTagDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .buildEmptyWithHeaders(response, SubscriptionGetEntityTagHeaders.class); + } + + /** + * Gets the specified Subscription entity. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param sid Subscription entity Identifier. The entity represents the association between a user and a product in API Management. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the SubscriptionContractInner object if successful. + */ + public SubscriptionContractInner get(String resourceGroupName, String serviceName, String sid) { + return getWithServiceResponseAsync(resourceGroupName, serviceName, sid).toBlocking().single().body(); + } + + /** + * Gets the specified Subscription entity. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param sid Subscription entity Identifier. The entity represents the association between a user and a product in API Management. + * @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 getAsync(String resourceGroupName, String serviceName, String sid, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(getWithServiceResponseAsync(resourceGroupName, serviceName, sid), serviceCallback); + } + + /** + * Gets the specified Subscription entity. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param sid Subscription entity Identifier. The entity represents the association between a user and a product in API Management. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SubscriptionContractInner object + */ + public Observable getAsync(String resourceGroupName, String serviceName, String sid) { + return getWithServiceResponseAsync(resourceGroupName, serviceName, sid).map(new Func1, SubscriptionContractInner>() { + @Override + public SubscriptionContractInner call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Gets the specified Subscription entity. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param sid Subscription entity Identifier. The entity represents the association between a user and a product in API Management. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SubscriptionContractInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String serviceName, String sid) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (sid == null) { + throw new IllegalArgumentException("Parameter sid is required and cannot be null."); + } + 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.get(resourceGroupName, serviceName, sid, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = getDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponseWithHeaders getDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .buildWithHeaders(response, SubscriptionGetHeaders.class); + } + + /** + * Creates or updates the subscription of specified user to the specified product. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param sid Subscription entity Identifier. The entity represents the association between a user and a product in API Management. + * @param parameters Create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the SubscriptionContractInner object if successful. + */ + public SubscriptionContractInner createOrUpdate(String resourceGroupName, String serviceName, String sid, SubscriptionCreateParameters parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serviceName, sid, parameters).toBlocking().single().body(); + } + + /** + * Creates or updates the subscription of specified user to the specified product. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param sid Subscription entity Identifier. The entity represents the association between a user and a product in API Management. + * @param parameters Create parameters. + * @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 createOrUpdateAsync(String resourceGroupName, String serviceName, String sid, SubscriptionCreateParameters parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, serviceName, sid, parameters), serviceCallback); + } + + /** + * Creates or updates the subscription of specified user to the specified product. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param sid Subscription entity Identifier. The entity represents the association between a user and a product in API Management. + * @param parameters Create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SubscriptionContractInner object + */ + public Observable createOrUpdateAsync(String resourceGroupName, String serviceName, String sid, SubscriptionCreateParameters parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serviceName, sid, parameters).map(new Func1, SubscriptionContractInner>() { + @Override + public SubscriptionContractInner call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Creates or updates the subscription of specified user to the specified product. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param sid Subscription entity Identifier. The entity represents the association between a user and a product in API Management. + * @param parameters Create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SubscriptionContractInner object + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String serviceName, String sid, SubscriptionCreateParameters parameters) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (sid == null) { + throw new IllegalArgumentException("Parameter sid is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(parameters); + final Boolean notify = null; + final String ifMatch = null; + return service.createOrUpdate(resourceGroupName, serviceName, sid, this.client.subscriptionId(), parameters, notify, ifMatch, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = createOrUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Creates or updates the subscription of specified user to the specified product. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param sid Subscription entity Identifier. The entity represents the association between a user and a product in API Management. + * @param parameters Create parameters. + * @param notify Notify change in Subscription State. + - If false, do not send any email notification for change of state of subscription + - If true, send email notification of change of state of subscription + * @param ifMatch ETag of the Entity. Not required when creating an entity, but required when updating an entity. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the SubscriptionContractInner object if successful. + */ + public SubscriptionContractInner createOrUpdate(String resourceGroupName, String serviceName, String sid, SubscriptionCreateParameters parameters, Boolean notify, String ifMatch) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serviceName, sid, parameters, notify, ifMatch).toBlocking().single().body(); + } + + /** + * Creates or updates the subscription of specified user to the specified product. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param sid Subscription entity Identifier. The entity represents the association between a user and a product in API Management. + * @param parameters Create parameters. + * @param notify Notify change in Subscription State. + - If false, do not send any email notification for change of state of subscription + - If true, send email notification of change of state of subscription + * @param ifMatch ETag of the Entity. Not required when creating an entity, but required when updating an entity. + * @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 createOrUpdateAsync(String resourceGroupName, String serviceName, String sid, SubscriptionCreateParameters parameters, Boolean notify, String ifMatch, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, serviceName, sid, parameters, notify, ifMatch), serviceCallback); + } + + /** + * Creates or updates the subscription of specified user to the specified product. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param sid Subscription entity Identifier. The entity represents the association between a user and a product in API Management. + * @param parameters Create parameters. + * @param notify Notify change in Subscription State. + - If false, do not send any email notification for change of state of subscription + - If true, send email notification of change of state of subscription + * @param ifMatch ETag of the Entity. Not required when creating an entity, but required when updating an entity. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SubscriptionContractInner object + */ + public Observable createOrUpdateAsync(String resourceGroupName, String serviceName, String sid, SubscriptionCreateParameters parameters, Boolean notify, String ifMatch) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serviceName, sid, parameters, notify, ifMatch).map(new Func1, SubscriptionContractInner>() { + @Override + public SubscriptionContractInner call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Creates or updates the subscription of specified user to the specified product. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param sid Subscription entity Identifier. The entity represents the association between a user and a product in API Management. + * @param parameters Create parameters. + * @param notify Notify change in Subscription State. + - If false, do not send any email notification for change of state of subscription + - If true, send email notification of change of state of subscription + * @param ifMatch ETag of the Entity. Not required when creating an entity, but required when updating an entity. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SubscriptionContractInner object + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String serviceName, String sid, SubscriptionCreateParameters parameters, Boolean notify, String ifMatch) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (sid == null) { + throw new IllegalArgumentException("Parameter sid is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(parameters); + return service.createOrUpdate(resourceGroupName, serviceName, sid, this.client.subscriptionId(), parameters, notify, ifMatch, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = createOrUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponseWithHeaders createOrUpdateDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(201, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .buildWithHeaders(response, SubscriptionCreateOrUpdateHeaders.class); + } + + /** + * Updates the details of a subscription specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param sid Subscription entity Identifier. The entity represents the association between a user and a product in API Management. + * @param parameters Update parameters. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void update(String resourceGroupName, String serviceName, String sid, SubscriptionUpdateParameters parameters, String ifMatch) { + updateWithServiceResponseAsync(resourceGroupName, serviceName, sid, parameters, ifMatch).toBlocking().single().body(); + } + + /** + * Updates the details of a subscription specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param sid Subscription entity Identifier. The entity represents the association between a user and a product in API Management. + * @param parameters Update parameters. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @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 serviceName, String sid, SubscriptionUpdateParameters parameters, String ifMatch, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateWithServiceResponseAsync(resourceGroupName, serviceName, sid, parameters, ifMatch), serviceCallback); + } + + /** + * Updates the details of a subscription specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param sid Subscription entity Identifier. The entity represents the association between a user and a product in API Management. + * @param parameters Update parameters. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable updateAsync(String resourceGroupName, String serviceName, String sid, SubscriptionUpdateParameters parameters, String ifMatch) { + return updateWithServiceResponseAsync(resourceGroupName, serviceName, sid, parameters, ifMatch).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates the details of a subscription specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param sid Subscription entity Identifier. The entity represents the association between a user and a product in API Management. + * @param parameters Update parameters. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> updateWithServiceResponseAsync(String resourceGroupName, String serviceName, String sid, SubscriptionUpdateParameters parameters, String ifMatch) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (sid == null) { + throw new IllegalArgumentException("Parameter sid is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + if (ifMatch == null) { + throw new IllegalArgumentException("Parameter ifMatch is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(parameters); + final Boolean notify = null; + return service.update(resourceGroupName, serviceName, sid, this.client.subscriptionId(), parameters, notify, ifMatch, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = updateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Updates the details of a subscription specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param sid Subscription entity Identifier. The entity represents the association between a user and a product in API Management. + * @param parameters Update parameters. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @param notify Notify change in Subscription State. + - If false, do not send any email notification for change of state of subscription + - If true, send email notification of change of state of subscription + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void update(String resourceGroupName, String serviceName, String sid, SubscriptionUpdateParameters parameters, String ifMatch, Boolean notify) { + updateWithServiceResponseAsync(resourceGroupName, serviceName, sid, parameters, ifMatch, notify).toBlocking().single().body(); + } + + /** + * Updates the details of a subscription specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param sid Subscription entity Identifier. The entity represents the association between a user and a product in API Management. + * @param parameters Update parameters. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @param notify Notify change in Subscription State. + - If false, do not send any email notification for change of state of subscription + - If true, send email notification of change of state of 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 updateAsync(String resourceGroupName, String serviceName, String sid, SubscriptionUpdateParameters parameters, String ifMatch, Boolean notify, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateWithServiceResponseAsync(resourceGroupName, serviceName, sid, parameters, ifMatch, notify), serviceCallback); + } + + /** + * Updates the details of a subscription specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param sid Subscription entity Identifier. The entity represents the association between a user and a product in API Management. + * @param parameters Update parameters. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @param notify Notify change in Subscription State. + - If false, do not send any email notification for change of state of subscription + - If true, send email notification of change of state of subscription + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable updateAsync(String resourceGroupName, String serviceName, String sid, SubscriptionUpdateParameters parameters, String ifMatch, Boolean notify) { + return updateWithServiceResponseAsync(resourceGroupName, serviceName, sid, parameters, ifMatch, notify).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates the details of a subscription specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param sid Subscription entity Identifier. The entity represents the association between a user and a product in API Management. + * @param parameters Update parameters. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @param notify Notify change in Subscription State. + - If false, do not send any email notification for change of state of subscription + - If true, send email notification of change of state of subscription + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> updateWithServiceResponseAsync(String resourceGroupName, String serviceName, String sid, SubscriptionUpdateParameters parameters, String ifMatch, Boolean notify) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (sid == null) { + throw new IllegalArgumentException("Parameter sid is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + if (ifMatch == null) { + throw new IllegalArgumentException("Parameter ifMatch is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(parameters); + return service.update(resourceGroupName, serviceName, sid, this.client.subscriptionId(), parameters, notify, ifMatch, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = updateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse updateDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(204, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Deletes the specified subscription. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param sid Subscription entity Identifier. The entity represents the association between a user and a product in API Management. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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 serviceName, String sid, String ifMatch) { + deleteWithServiceResponseAsync(resourceGroupName, serviceName, sid, ifMatch).toBlocking().single().body(); + } + + /** + * Deletes the specified subscription. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param sid Subscription entity Identifier. The entity represents the association between a user and a product in API Management. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @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 serviceName, String sid, String ifMatch, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, serviceName, sid, ifMatch), serviceCallback); + } + + /** + * Deletes the specified subscription. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param sid Subscription entity Identifier. The entity represents the association between a user and a product in API Management. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable deleteAsync(String resourceGroupName, String serviceName, String sid, String ifMatch) { + return deleteWithServiceResponseAsync(resourceGroupName, serviceName, sid, ifMatch).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes the specified subscription. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param sid Subscription entity Identifier. The entity represents the association between a user and a product in API Management. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> deleteWithServiceResponseAsync(String resourceGroupName, String serviceName, String sid, String ifMatch) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (sid == null) { + throw new IllegalArgumentException("Parameter sid is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (ifMatch == null) { + throw new IllegalArgumentException("Parameter ifMatch 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.delete(resourceGroupName, serviceName, sid, this.client.subscriptionId(), ifMatch, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = deleteDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse deleteDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(204, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Regenerates primary key of existing subscription of the API Management service instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param sid Subscription entity Identifier. The entity represents the association between a user and a product in API Management. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void regeneratePrimaryKey(String resourceGroupName, String serviceName, String sid) { + regeneratePrimaryKeyWithServiceResponseAsync(resourceGroupName, serviceName, sid).toBlocking().single().body(); + } + + /** + * Regenerates primary key of existing subscription of the API Management service instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param sid Subscription entity Identifier. The entity represents the association between a user and a product in API Management. + * @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 regeneratePrimaryKeyAsync(String resourceGroupName, String serviceName, String sid, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(regeneratePrimaryKeyWithServiceResponseAsync(resourceGroupName, serviceName, sid), serviceCallback); + } + + /** + * Regenerates primary key of existing subscription of the API Management service instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param sid Subscription entity Identifier. The entity represents the association between a user and a product in API Management. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable regeneratePrimaryKeyAsync(String resourceGroupName, String serviceName, String sid) { + return regeneratePrimaryKeyWithServiceResponseAsync(resourceGroupName, serviceName, sid).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Regenerates primary key of existing subscription of the API Management service instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param sid Subscription entity Identifier. The entity represents the association between a user and a product in API Management. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> regeneratePrimaryKeyWithServiceResponseAsync(String resourceGroupName, String serviceName, String sid) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (sid == null) { + throw new IllegalArgumentException("Parameter sid is required and cannot be null."); + } + 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.regeneratePrimaryKey(resourceGroupName, serviceName, sid, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = regeneratePrimaryKeyDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse regeneratePrimaryKeyDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(204, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Regenerates secondary key of existing subscription of the API Management service instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param sid Subscription entity Identifier. The entity represents the association between a user and a product in API Management. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void regenerateSecondaryKey(String resourceGroupName, String serviceName, String sid) { + regenerateSecondaryKeyWithServiceResponseAsync(resourceGroupName, serviceName, sid).toBlocking().single().body(); + } + + /** + * Regenerates secondary key of existing subscription of the API Management service instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param sid Subscription entity Identifier. The entity represents the association between a user and a product in API Management. + * @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 regenerateSecondaryKeyAsync(String resourceGroupName, String serviceName, String sid, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(regenerateSecondaryKeyWithServiceResponseAsync(resourceGroupName, serviceName, sid), serviceCallback); + } + + /** + * Regenerates secondary key of existing subscription of the API Management service instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param sid Subscription entity Identifier. The entity represents the association between a user and a product in API Management. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable regenerateSecondaryKeyAsync(String resourceGroupName, String serviceName, String sid) { + return regenerateSecondaryKeyWithServiceResponseAsync(resourceGroupName, serviceName, sid).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Regenerates secondary key of existing subscription of the API Management service instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param sid Subscription entity Identifier. The entity represents the association between a user and a product in API Management. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> regenerateSecondaryKeyWithServiceResponseAsync(String resourceGroupName, String serviceName, String sid) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (sid == null) { + throw new IllegalArgumentException("Parameter sid is required and cannot be null."); + } + 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.regenerateSecondaryKey(resourceGroupName, serviceName, sid, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = regenerateSecondaryKeyDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse regenerateSecondaryKeyDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(204, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists all subscriptions of the API Management service instance. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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<SubscriptionContractInner> 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 all subscriptions of the API Management service instance. + * + * @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 all subscriptions of the API Management service instance. + * + * @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<SubscriptionContractInner> object + */ + public Observable> listNextAsync(final String nextPageLink) { + return listNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all subscriptions of the API Management service instance. + * + * @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<SubscriptionContractInner> 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 all subscriptions of the API Management service instance. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<SubscriptionContractInner> 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 ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/TagContractImpl.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/TagContractImpl.java new file mode 100644 index 0000000000000..b8180423e2472 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/TagContractImpl.java @@ -0,0 +1,105 @@ +/** + * 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.apimanagement.v2019_01_01.implementation; + +import com.microsoft.azure.management.apimanagement.v2019_01_01.TagContract; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; + +class TagContractImpl extends CreatableUpdatableImpl implements TagContract, TagContract.Definition, TagContract.Update { + private final ApiManagementManager manager; + private String resourceGroupName; + private String serviceName; + private String apiId; + private String operationId; + private String tagId; + + TagContractImpl(String name, ApiManagementManager manager) { + super(name, new TagContractInner()); + this.manager = manager; + // Set resource name + this.tagId = name; + // + } + + TagContractImpl(TagContractInner inner, ApiManagementManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.tagId = inner.name(); + // set resource ancestor and positional variables + this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourceGroups"); + this.serviceName = IdParsingUtils.getValueFromIdByName(inner.id(), "service"); + this.apiId = IdParsingUtils.getValueFromIdByName(inner.id(), "apis"); + this.operationId = IdParsingUtils.getValueFromIdByName(inner.id(), "operations"); + this.tagId = IdParsingUtils.getValueFromIdByName(inner.id(), "tags"); + // + } + + @Override + public ApiManagementManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + TagsInner client = this.manager().inner().tags(); + return client.assignToOperationAsync(this.resourceGroupName, this.serviceName, this.apiId, this.operationId, this.tagId) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + TagsInner client = this.manager().inner().tags(); + return client.assignToOperationAsync(this.resourceGroupName, this.serviceName, this.apiId, this.operationId, this.tagId) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + TagsInner client = this.manager().inner().tags(); + return client.getByOperationAsync(this.resourceGroupName, this.serviceName, this.apiId, this.operationId, this.tagId); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + + @Override + public String displayName() { + return this.inner().displayName(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public TagContractImpl withExistingOperation(String resourceGroupName, String serviceName, String apiId, String operationId) { + this.resourceGroupName = resourceGroupName; + this.serviceName = serviceName; + this.apiId = apiId; + this.operationId = operationId; + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/TagContractInner.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/TagContractInner.java new file mode 100644 index 0000000000000..6522033671743 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/TagContractInner.java @@ -0,0 +1,46 @@ +/** + * 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.apimanagement.v2019_01_01.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * Tag Contract details. + */ +@JsonFlatten +public class TagContractInner extends ProxyResource { + /** + * Tag name. + */ + @JsonProperty(value = "properties.displayName", required = true) + private String displayName; + + /** + * Get tag name. + * + * @return the displayName value + */ + public String displayName() { + return this.displayName; + } + + /** + * Set tag name. + * + * @param displayName the displayName value to set + * @return the TagContractInner object itself. + */ + public TagContractInner withDisplayName(String displayName) { + this.displayName = displayName; + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/TagDescriptionContractImpl.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/TagDescriptionContractImpl.java new file mode 100644 index 0000000000000..45d4194742ebd --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/TagDescriptionContractImpl.java @@ -0,0 +1,169 @@ +/** + * 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.apimanagement.v2019_01_01.implementation; + +import com.microsoft.azure.management.apimanagement.v2019_01_01.TagDescriptionContract; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import com.microsoft.azure.management.apimanagement.v2019_01_01.TagDescriptionCreateParameters; +import rx.functions.Func1; + +class TagDescriptionContractImpl extends CreatableUpdatableImpl implements TagDescriptionContract, TagDescriptionContract.Definition, TagDescriptionContract.Update { + private final ApiManagementManager manager; + private String resourceGroupName; + private String serviceName; + private String apiId; + private String tagId; + private String cifMatch; + private String uifMatch; + private TagDescriptionCreateParameters createOrUpdateParameter; + + TagDescriptionContractImpl(String name, ApiManagementManager manager) { + super(name, new TagDescriptionContractInner()); + this.manager = manager; + // Set resource name + this.tagId = name; + // + this.createOrUpdateParameter = new TagDescriptionCreateParameters(); + } + + TagDescriptionContractImpl(TagDescriptionContractInner inner, ApiManagementManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.tagId = inner.name(); + // set resource ancestor and positional variables + this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourceGroups"); + this.serviceName = IdParsingUtils.getValueFromIdByName(inner.id(), "service"); + this.apiId = IdParsingUtils.getValueFromIdByName(inner.id(), "apis"); + this.tagId = IdParsingUtils.getValueFromIdByName(inner.id(), "tagDescriptions"); + // + this.createOrUpdateParameter = new TagDescriptionCreateParameters(); + } + + @Override + public ApiManagementManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + ApiTagDescriptionsInner client = this.manager().inner().apiTagDescriptions(); + return client.createOrUpdateAsync(this.resourceGroupName, this.serviceName, this.apiId, this.tagId, this.createOrUpdateParameter, this.cifMatch) + .map(new Func1() { + @Override + public TagDescriptionContractInner call(TagDescriptionContractInner resource) { + resetCreateUpdateParameters(); + return resource; + } + }) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + ApiTagDescriptionsInner client = this.manager().inner().apiTagDescriptions(); + return client.createOrUpdateAsync(this.resourceGroupName, this.serviceName, this.apiId, this.tagId, this.createOrUpdateParameter, this.uifMatch) + .map(new Func1() { + @Override + public TagDescriptionContractInner call(TagDescriptionContractInner resource) { + resetCreateUpdateParameters(); + return resource; + } + }) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + ApiTagDescriptionsInner client = this.manager().inner().apiTagDescriptions(); + return client.getAsync(this.resourceGroupName, this.serviceName, this.apiId, this.tagId); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + private void resetCreateUpdateParameters() { + this.createOrUpdateParameter = new TagDescriptionCreateParameters(); + } + + @Override + public String description() { + return this.inner().description(); + } + + @Override + public String displayName() { + return this.inner().displayName(); + } + + @Override + public String externalDocsDescription() { + return this.inner().externalDocsDescription(); + } + + @Override + public String externalDocsUrl() { + return this.inner().externalDocsUrl(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public TagDescriptionContractImpl withExistingApi(String resourceGroupName, String serviceName, String apiId) { + this.resourceGroupName = resourceGroupName; + this.serviceName = serviceName; + this.apiId = apiId; + return this; + } + + @Override + public TagDescriptionContractImpl withIfMatch(String ifMatch) { + if (isInCreateMode()) { + this.cifMatch = ifMatch; + } else { + this.uifMatch = ifMatch; + } + return this; + } + + @Override + public TagDescriptionContractImpl withDescription(String description) { + this.createOrUpdateParameter.withDescription(description); + return this; + } + + @Override + public TagDescriptionContractImpl withExternalDocsDescription(String externalDocsDescription) { + this.createOrUpdateParameter.withExternalDocsDescription(externalDocsDescription); + return this; + } + + @Override + public TagDescriptionContractImpl withExternalDocsUrl(String externalDocsUrl) { + this.createOrUpdateParameter.withExternalDocsUrl(externalDocsUrl); + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/TagDescriptionContractInner.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/TagDescriptionContractInner.java new file mode 100644 index 0000000000000..e116c81c703c6 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/TagDescriptionContractInner.java @@ -0,0 +1,124 @@ +/** + * 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.apimanagement.v2019_01_01.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * Contract details. + */ +@JsonFlatten +public class TagDescriptionContractInner extends ProxyResource { + /** + * Description of the Tag. + */ + @JsonProperty(value = "properties.description") + private String description; + + /** + * Absolute URL of external resources describing the tag. + */ + @JsonProperty(value = "properties.externalDocsUrl") + private String externalDocsUrl; + + /** + * Description of the external resources describing the tag. + */ + @JsonProperty(value = "properties.externalDocsDescription") + private String externalDocsDescription; + + /** + * Tag name. + */ + @JsonProperty(value = "properties.displayName") + private String displayName; + + /** + * Get description of the Tag. + * + * @return the description value + */ + public String description() { + return this.description; + } + + /** + * Set description of the Tag. + * + * @param description the description value to set + * @return the TagDescriptionContractInner object itself. + */ + public TagDescriptionContractInner withDescription(String description) { + this.description = description; + return this; + } + + /** + * Get absolute URL of external resources describing the tag. + * + * @return the externalDocsUrl value + */ + public String externalDocsUrl() { + return this.externalDocsUrl; + } + + /** + * Set absolute URL of external resources describing the tag. + * + * @param externalDocsUrl the externalDocsUrl value to set + * @return the TagDescriptionContractInner object itself. + */ + public TagDescriptionContractInner withExternalDocsUrl(String externalDocsUrl) { + this.externalDocsUrl = externalDocsUrl; + return this; + } + + /** + * Get description of the external resources describing the tag. + * + * @return the externalDocsDescription value + */ + public String externalDocsDescription() { + return this.externalDocsDescription; + } + + /** + * Set description of the external resources describing the tag. + * + * @param externalDocsDescription the externalDocsDescription value to set + * @return the TagDescriptionContractInner object itself. + */ + public TagDescriptionContractInner withExternalDocsDescription(String externalDocsDescription) { + this.externalDocsDescription = externalDocsDescription; + return this; + } + + /** + * Get tag name. + * + * @return the displayName value + */ + public String displayName() { + return this.displayName; + } + + /** + * Set tag name. + * + * @param displayName the displayName value to set + * @return the TagDescriptionContractInner object itself. + */ + public TagDescriptionContractInner withDisplayName(String displayName) { + this.displayName = displayName; + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/TagResourceContractImpl.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/TagResourceContractImpl.java new file mode 100644 index 0000000000000..58dd46ccbf124 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/TagResourceContractImpl.java @@ -0,0 +1,54 @@ +/** + * 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.apimanagement.v2019_01_01.implementation; + +import com.microsoft.azure.management.apimanagement.v2019_01_01.TagResourceContract; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import rx.Observable; +import com.microsoft.azure.management.apimanagement.v2019_01_01.ApiTagResourceContractProperties; +import com.microsoft.azure.management.apimanagement.v2019_01_01.OperationTagResourceContractProperties; +import com.microsoft.azure.management.apimanagement.v2019_01_01.ProductTagResourceContractProperties; +import com.microsoft.azure.management.apimanagement.v2019_01_01.TagTagResourceContractProperties; + +class TagResourceContractImpl extends WrapperImpl implements TagResourceContract { + private final ApiManagementManager manager; + + TagResourceContractImpl(TagResourceContractInner inner, ApiManagementManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public ApiManagementManager manager() { + return this.manager; + } + + + + @Override + public ApiTagResourceContractProperties api() { + return this.inner().api(); + } + + @Override + public OperationTagResourceContractProperties operation() { + return this.inner().operation(); + } + + @Override + public ProductTagResourceContractProperties product() { + return this.inner().product(); + } + + @Override + public TagTagResourceContractProperties tag() { + return this.inner().tag(); + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/TagResourceContractInner.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/TagResourceContractInner.java new file mode 100644 index 0000000000000..37bd74365160b --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/TagResourceContractInner.java @@ -0,0 +1,125 @@ +/** + * 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.apimanagement.v2019_01_01.implementation; + +import com.microsoft.azure.management.apimanagement.v2019_01_01.TagTagResourceContractProperties; +import com.microsoft.azure.management.apimanagement.v2019_01_01.ApiTagResourceContractProperties; +import com.microsoft.azure.management.apimanagement.v2019_01_01.OperationTagResourceContractProperties; +import com.microsoft.azure.management.apimanagement.v2019_01_01.ProductTagResourceContractProperties; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * TagResource contract properties. + */ +public class TagResourceContractInner { + /** + * Tag associated with the resource. + */ + @JsonProperty(value = "tag", required = true) + private TagTagResourceContractProperties tag; + + /** + * Api associated with the tag. + */ + @JsonProperty(value = "api") + private ApiTagResourceContractProperties api; + + /** + * Operation associated with the tag. + */ + @JsonProperty(value = "operation") + private OperationTagResourceContractProperties operation; + + /** + * Product associated with the tag. + */ + @JsonProperty(value = "product") + private ProductTagResourceContractProperties product; + + /** + * Get tag associated with the resource. + * + * @return the tag value + */ + public TagTagResourceContractProperties tag() { + return this.tag; + } + + /** + * Set tag associated with the resource. + * + * @param tag the tag value to set + * @return the TagResourceContractInner object itself. + */ + public TagResourceContractInner withTag(TagTagResourceContractProperties tag) { + this.tag = tag; + return this; + } + + /** + * Get api associated with the tag. + * + * @return the api value + */ + public ApiTagResourceContractProperties api() { + return this.api; + } + + /** + * Set api associated with the tag. + * + * @param api the api value to set + * @return the TagResourceContractInner object itself. + */ + public TagResourceContractInner withApi(ApiTagResourceContractProperties api) { + this.api = api; + return this; + } + + /** + * Get operation associated with the tag. + * + * @return the operation value + */ + public OperationTagResourceContractProperties operation() { + return this.operation; + } + + /** + * Set operation associated with the tag. + * + * @param operation the operation value to set + * @return the TagResourceContractInner object itself. + */ + public TagResourceContractInner withOperation(OperationTagResourceContractProperties operation) { + this.operation = operation; + return this; + } + + /** + * Get product associated with the tag. + * + * @return the product value + */ + public ProductTagResourceContractProperties product() { + return this.product; + } + + /** + * Set product associated with the tag. + * + * @param product the product value to set + * @return the TagResourceContractInner object itself. + */ + public TagResourceContractInner withProduct(ProductTagResourceContractProperties product) { + this.product = product; + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/TagResourcesImpl.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/TagResourcesImpl.java new file mode 100644 index 0000000000000..131ab2aae94ed --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/TagResourcesImpl.java @@ -0,0 +1,49 @@ +/** + * 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. + * abc + */ + +package com.microsoft.azure.management.apimanagement.v2019_01_01.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.apimanagement.v2019_01_01.TagResources; +import rx.functions.Func1; +import rx.Observable; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.apimanagement.v2019_01_01.TagResourceContract; + +class TagResourcesImpl extends WrapperImpl implements TagResources { + private final ApiManagementManager manager; + + TagResourcesImpl(ApiManagementManager manager) { + super(manager.inner().tagResources()); + this.manager = manager; + } + + public ApiManagementManager manager() { + return this.manager; + } + + @Override + public Observable listByServiceAsync(final String resourceGroupName, final String serviceName) { + TagResourcesInner client = this.inner(); + return client.listByServiceAsync(resourceGroupName, serviceName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public TagResourceContract call(TagResourceContractInner inner) { + return new TagResourceContractImpl(inner, manager()); + } + }); + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/TagResourcesInner.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/TagResourcesInner.java new file mode 100644 index 0000000000000..aaef9ad73b87b --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/TagResourcesInner.java @@ -0,0 +1,437 @@ +/** + * 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.apimanagement.v2019_01_01.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.apimanagement.v2019_01_01.ErrorResponseException; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Path; +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 TagResources. + */ +public class TagResourcesInner { + /** The Retrofit service to perform REST calls. */ + private TagResourcesService service; + /** The service client containing this operation class. */ + private ApiManagementClientImpl client; + + /** + * Initializes an instance of TagResourcesInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public TagResourcesInner(Retrofit retrofit, ApiManagementClientImpl client) { + this.service = retrofit.create(TagResourcesService.class); + this.client = client; + } + + /** + * The interface defining all the services for TagResources to be + * used by Retrofit to perform actually REST calls. + */ + interface TagResourcesService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.apimanagement.v2019_01_01.TagResources listByService" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tagResources") + Observable> listByService(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("subscriptionId") String subscriptionId, @Query("$filter") String filter, @Query("$top") Integer top, @Query("$skip") Integer skip, @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.apimanagement.v2019_01_01.TagResources listByServiceNext" }) + @GET + Observable> listByServiceNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Lists a collection of resources associated with tags. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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<TagResourceContractInner> object if successful. + */ + public PagedList listByService(final String resourceGroupName, final String serviceName) { + ServiceResponse> response = listByServiceSinglePageAsync(resourceGroupName, serviceName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByServiceNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists a collection of resources associated with tags. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @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> listByServiceAsync(final String resourceGroupName, final String serviceName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByServiceSinglePageAsync(resourceGroupName, serviceName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByServiceNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists a collection of resources associated with tags. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<TagResourceContractInner> object + */ + public Observable> listByServiceAsync(final String resourceGroupName, final String serviceName) { + return listByServiceWithServiceResponseAsync(resourceGroupName, serviceName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists a collection of resources associated with tags. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<TagResourceContractInner> object + */ + public Observable>> listByServiceWithServiceResponseAsync(final String resourceGroupName, final String serviceName) { + return listByServiceSinglePageAsync(resourceGroupName, serviceName) + .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(listByServiceNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists a collection of resources associated with tags. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<TagResourceContractInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByServiceSinglePageAsync(final String resourceGroupName, final String serviceName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + 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 filter = null; + final Integer top = null; + final Integer skip = null; + return service.listByService(resourceGroupName, serviceName, this.client.subscriptionId(), filter, top, skip, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByServiceDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Lists a collection of resources associated with tags. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| aid | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| apiName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| apiRevision | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| path | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| serviceUrl | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| method | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| urlTemplate | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| terms | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| state | filter | eq | | </br>| isCurrent | filter | eq | | </br> + * @param top Number of records to return. + * @param skip Number of records to skip. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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<TagResourceContractInner> object if successful. + */ + public PagedList listByService(final String resourceGroupName, final String serviceName, final String filter, final Integer top, final Integer skip) { + ServiceResponse> response = listByServiceSinglePageAsync(resourceGroupName, serviceName, filter, top, skip).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByServiceNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists a collection of resources associated with tags. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| aid | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| apiName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| apiRevision | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| path | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| serviceUrl | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| method | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| urlTemplate | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| terms | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| state | filter | eq | | </br>| isCurrent | filter | eq | | </br> + * @param top Number of records to return. + * @param skip Number of records to skip. + * @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> listByServiceAsync(final String resourceGroupName, final String serviceName, final String filter, final Integer top, final Integer skip, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByServiceSinglePageAsync(resourceGroupName, serviceName, filter, top, skip), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByServiceNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists a collection of resources associated with tags. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| aid | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| apiName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| apiRevision | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| path | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| serviceUrl | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| method | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| urlTemplate | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| terms | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| state | filter | eq | | </br>| isCurrent | filter | eq | | </br> + * @param top Number of records to return. + * @param skip Number of records to skip. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<TagResourceContractInner> object + */ + public Observable> listByServiceAsync(final String resourceGroupName, final String serviceName, final String filter, final Integer top, final Integer skip) { + return listByServiceWithServiceResponseAsync(resourceGroupName, serviceName, filter, top, skip) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists a collection of resources associated with tags. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| aid | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| apiName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| apiRevision | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| path | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| serviceUrl | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| method | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| urlTemplate | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| terms | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| state | filter | eq | | </br>| isCurrent | filter | eq | | </br> + * @param top Number of records to return. + * @param skip Number of records to skip. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<TagResourceContractInner> object + */ + public Observable>> listByServiceWithServiceResponseAsync(final String resourceGroupName, final String serviceName, final String filter, final Integer top, final Integer skip) { + return listByServiceSinglePageAsync(resourceGroupName, serviceName, filter, top, skip) + .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(listByServiceNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists a collection of resources associated with tags. + * + ServiceResponse> * @param resourceGroupName The name of the resource group. + ServiceResponse> * @param serviceName The name of the API Management service. + ServiceResponse> * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| aid | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| apiName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| apiRevision | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| path | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| serviceUrl | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| method | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| urlTemplate | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| terms | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| state | filter | eq | | </br>| isCurrent | filter | eq | | </br> + ServiceResponse> * @param top Number of records to return. + ServiceResponse> * @param skip Number of records to skip. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<TagResourceContractInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByServiceSinglePageAsync(final String resourceGroupName, final String serviceName, final String filter, final Integer top, final Integer skip) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + 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.listByService(resourceGroupName, serviceName, this.client.subscriptionId(), filter, top, skip, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByServiceDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByServiceDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists a collection of resources associated with tags. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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<TagResourceContractInner> object if successful. + */ + public PagedList listByServiceNext(final String nextPageLink) { + ServiceResponse> response = listByServiceNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByServiceNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists a collection of resources associated with tags. + * + * @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> listByServiceNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByServiceNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByServiceNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists a collection of resources associated with tags. + * + * @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<TagResourceContractInner> object + */ + public Observable> listByServiceNextAsync(final String nextPageLink) { + return listByServiceNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists a collection of resources associated with tags. + * + * @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<TagResourceContractInner> object + */ + public Observable>> listByServiceNextWithServiceResponseAsync(final String nextPageLink) { + return listByServiceNextSinglePageAsync(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(listByServiceNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists a collection of resources associated with tags. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<TagResourceContractInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByServiceNextSinglePageAsync(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.listByServiceNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByServiceNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByServiceNextDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/TagsImpl.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/TagsImpl.java new file mode 100644 index 0000000000000..5ea6d43932a48 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/TagsImpl.java @@ -0,0 +1,255 @@ +/** + * 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.apimanagement.v2019_01_01.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.apimanagement.v2019_01_01.Tags; +import rx.Completable; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.apimanagement.v2019_01_01.TagContract; + +class TagsImpl extends WrapperImpl implements Tags { + private final ApiManagementManager manager; + + TagsImpl(ApiManagementManager manager) { + super(manager.inner().tags()); + this.manager = manager; + } + + public ApiManagementManager manager() { + return this.manager; + } + + @Override + public TagContractImpl define(String name) { + return wrapModel(name); + } + + private TagContractImpl wrapModel(TagContractInner inner) { + return new TagContractImpl(inner, manager()); + } + + private TagContractImpl wrapModel(String name) { + return new TagContractImpl(name, this.manager()); + } + + @Override + public Completable getEntityStateByOperationAsync(String resourceGroupName, String serviceName, String apiId, String operationId, String tagId) { + TagsInner client = this.inner(); + return client.getEntityStateByOperationAsync(resourceGroupName, serviceName, apiId, operationId, tagId).toCompletable(); + } + + @Override + public Observable listByApiAsync(final String resourceGroupName, final String serviceName, final String apiId) { + TagsInner client = this.inner(); + return client.listByApiAsync(resourceGroupName, serviceName, apiId) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public TagContract call(TagContractInner inner) { + return new TagContractImpl(inner, manager()); + } + }); + } + + @Override + public Completable getEntityStateByApiAsync(String resourceGroupName, String serviceName, String apiId, String tagId) { + TagsInner client = this.inner(); + return client.getEntityStateByApiAsync(resourceGroupName, serviceName, apiId, tagId).toCompletable(); + } + + @Override + public Observable getByApiAsync(String resourceGroupName, String serviceName, String apiId, String tagId) { + TagsInner client = this.inner(); + return client.getByApiAsync(resourceGroupName, serviceName, apiId, tagId) + .map(new Func1() { + @Override + public TagContract call(TagContractInner inner) { + return new TagContractImpl(inner, manager()); + } + }); + } + + @Override + public Observable assignToApiAsync(String resourceGroupName, String serviceName, String apiId, String tagId) { + TagsInner client = this.inner(); + return client.assignToApiAsync(resourceGroupName, serviceName, apiId, tagId) + .map(new Func1() { + @Override + public TagContract call(TagContractInner inner) { + return new TagContractImpl(inner, manager()); + } + }); + } + + @Override + public Completable detachFromApiAsync(String resourceGroupName, String serviceName, String apiId, String tagId) { + TagsInner client = this.inner(); + return client.detachFromApiAsync(resourceGroupName, serviceName, apiId, tagId).toCompletable(); + } + + @Override + public Observable listByProductAsync(final String resourceGroupName, final String serviceName, final String productId) { + TagsInner client = this.inner(); + return client.listByProductAsync(resourceGroupName, serviceName, productId) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public TagContract call(TagContractInner inner) { + return new TagContractImpl(inner, manager()); + } + }); + } + + @Override + public Completable getEntityStateByProductAsync(String resourceGroupName, String serviceName, String productId, String tagId) { + TagsInner client = this.inner(); + return client.getEntityStateByProductAsync(resourceGroupName, serviceName, productId, tagId).toCompletable(); + } + + @Override + public Observable getByProductAsync(String resourceGroupName, String serviceName, String productId, String tagId) { + TagsInner client = this.inner(); + return client.getByProductAsync(resourceGroupName, serviceName, productId, tagId) + .map(new Func1() { + @Override + public TagContract call(TagContractInner inner) { + return new TagContractImpl(inner, manager()); + } + }); + } + + @Override + public Observable assignToProductAsync(String resourceGroupName, String serviceName, String productId, String tagId) { + TagsInner client = this.inner(); + return client.assignToProductAsync(resourceGroupName, serviceName, productId, tagId) + .map(new Func1() { + @Override + public TagContract call(TagContractInner inner) { + return new TagContractImpl(inner, manager()); + } + }); + } + + @Override + public Completable detachFromProductAsync(String resourceGroupName, String serviceName, String productId, String tagId) { + TagsInner client = this.inner(); + return client.detachFromProductAsync(resourceGroupName, serviceName, productId, tagId).toCompletable(); + } + + @Override + public Observable listByServiceAsync(final String resourceGroupName, final String serviceName) { + TagsInner client = this.inner(); + return client.listByServiceAsync(resourceGroupName, serviceName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public TagContract call(TagContractInner inner) { + return new TagContractImpl(inner, manager()); + } + }); + } + + @Override + public Completable getEntityStateAsync(String resourceGroupName, String serviceName, String tagId) { + TagsInner client = this.inner(); + return client.getEntityStateAsync(resourceGroupName, serviceName, tagId).toCompletable(); + } + + @Override + public Observable getAsync(String resourceGroupName, String serviceName, String tagId) { + TagsInner client = this.inner(); + return client.getAsync(resourceGroupName, serviceName, tagId) + .map(new Func1() { + @Override + public TagContract call(TagContractInner inner) { + return new TagContractImpl(inner, manager()); + } + }); + } + + @Override + public Observable createOrUpdateAsync(String resourceGroupName, String serviceName, String tagId, String displayName) { + TagsInner client = this.inner(); + return client.createOrUpdateAsync(resourceGroupName, serviceName, tagId, displayName) + .map(new Func1() { + @Override + public TagContract call(TagContractInner inner) { + return new TagContractImpl(inner, manager()); + } + }); + } + + @Override + public Completable updateAsync(String resourceGroupName, String serviceName, String tagId, String ifMatch, String displayName) { + TagsInner client = this.inner(); + return client.updateAsync(resourceGroupName, serviceName, tagId, ifMatch, displayName).toCompletable(); + } + + @Override + public Completable deleteAsync(String resourceGroupName, String serviceName, String tagId, String ifMatch) { + TagsInner client = this.inner(); + return client.deleteAsync(resourceGroupName, serviceName, tagId, ifMatch).toCompletable(); + } + + @Override + public Observable listByOperationAsync(final String resourceGroupName, final String serviceName, final String apiId, final String operationId) { + TagsInner client = this.inner(); + return client.listByOperationAsync(resourceGroupName, serviceName, apiId, operationId) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public TagContract call(TagContractInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Observable getByOperationAsync(String resourceGroupName, String serviceName, String apiId, String operationId, String tagId) { + TagsInner client = this.inner(); + return client.getByOperationAsync(resourceGroupName, serviceName, apiId, operationId, tagId) + .map(new Func1() { + @Override + public TagContract call(TagContractInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Completable detachFromOperationAsync(String resourceGroupName, String serviceName, String apiId, String operationId, String tagId) { + TagsInner client = this.inner(); + return client.detachFromOperationAsync(resourceGroupName, serviceName, apiId, operationId, tagId).toCompletable(); + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/TagsInner.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/TagsInner.java new file mode 100644 index 0000000000000..9d323516ebace --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/TagsInner.java @@ -0,0 +1,3545 @@ +/** + * 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.apimanagement.v2019_01_01.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.apimanagement.v2019_01_01.ErrorResponseException; +import com.microsoft.azure.management.apimanagement.v2019_01_01.TagAssignToApiHeaders; +import com.microsoft.azure.management.apimanagement.v2019_01_01.TagCreateOrUpdateHeaders; +import com.microsoft.azure.management.apimanagement.v2019_01_01.TagCreateUpdateParameters; +import com.microsoft.azure.management.apimanagement.v2019_01_01.TagGetByApiHeaders; +import com.microsoft.azure.management.apimanagement.v2019_01_01.TagGetByOperationHeaders; +import com.microsoft.azure.management.apimanagement.v2019_01_01.TagGetByProductHeaders; +import com.microsoft.azure.management.apimanagement.v2019_01_01.TagGetEntityStateByApiHeaders; +import com.microsoft.azure.management.apimanagement.v2019_01_01.TagGetEntityStateByOperationHeaders; +import com.microsoft.azure.management.apimanagement.v2019_01_01.TagGetEntityStateByProductHeaders; +import com.microsoft.azure.management.apimanagement.v2019_01_01.TagGetEntityStateHeaders; +import com.microsoft.azure.management.apimanagement.v2019_01_01.TagGetHeaders; +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.ServiceResponseWithHeaders; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.Body; +import retrofit2.http.GET; +import retrofit2.http.HEAD; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.HTTP; +import retrofit2.http.PATCH; +import retrofit2.http.Path; +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 Tags. + */ +public class TagsInner { + /** The Retrofit service to perform REST calls. */ + private TagsService service; + /** The service client containing this operation class. */ + private ApiManagementClientImpl client; + + /** + * Initializes an instance of TagsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public TagsInner(Retrofit retrofit, ApiManagementClientImpl client) { + this.service = retrofit.create(TagsService.class); + this.client = client; + } + + /** + * The interface defining all the services for Tags to be + * used by Retrofit to perform actually REST calls. + */ + interface TagsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.apimanagement.v2019_01_01.Tags listByOperation" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/operations/{operationId}/tags") + Observable> listByOperation(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("apiId") String apiId, @Path("operationId") String operationId, @Path("subscriptionId") String subscriptionId, @Query("$filter") String filter, @Query("$top") Integer top, @Query("$skip") Integer skip, @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.apimanagement.v2019_01_01.Tags getEntityStateByOperation" }) + @HEAD("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/operations/{operationId}/tags/{tagId}") + Observable> getEntityStateByOperation(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("apiId") String apiId, @Path("operationId") String operationId, @Path("tagId") String tagId, @Path("subscriptionId") String subscriptionId, @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.apimanagement.v2019_01_01.Tags getByOperation" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/operations/{operationId}/tags/{tagId}") + Observable> getByOperation(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("apiId") String apiId, @Path("operationId") String operationId, @Path("tagId") String tagId, @Path("subscriptionId") String subscriptionId, @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.apimanagement.v2019_01_01.Tags assignToOperation" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/operations/{operationId}/tags/{tagId}") + Observable> assignToOperation(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("apiId") String apiId, @Path("operationId") String operationId, @Path("tagId") String tagId, @Path("subscriptionId") String subscriptionId, @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.apimanagement.v2019_01_01.Tags detachFromOperation" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/operations/{operationId}/tags/{tagId}", method = "DELETE", hasBody = true) + Observable> detachFromOperation(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("apiId") String apiId, @Path("operationId") String operationId, @Path("tagId") String tagId, @Path("subscriptionId") String subscriptionId, @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.apimanagement.v2019_01_01.Tags listByApi" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/tags") + Observable> listByApi(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("apiId") String apiId, @Path("subscriptionId") String subscriptionId, @Query("$filter") String filter, @Query("$top") Integer top, @Query("$skip") Integer skip, @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.apimanagement.v2019_01_01.Tags getEntityStateByApi" }) + @HEAD("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/tags/{tagId}") + Observable> getEntityStateByApi(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("apiId") String apiId, @Path("tagId") String tagId, @Path("subscriptionId") String subscriptionId, @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.apimanagement.v2019_01_01.Tags getByApi" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/tags/{tagId}") + Observable> getByApi(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("apiId") String apiId, @Path("tagId") String tagId, @Path("subscriptionId") String subscriptionId, @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.apimanagement.v2019_01_01.Tags assignToApi" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/tags/{tagId}") + Observable> assignToApi(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("apiId") String apiId, @Path("tagId") String tagId, @Path("subscriptionId") String subscriptionId, @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.apimanagement.v2019_01_01.Tags detachFromApi" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/tags/{tagId}", method = "DELETE", hasBody = true) + Observable> detachFromApi(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("apiId") String apiId, @Path("tagId") String tagId, @Path("subscriptionId") String subscriptionId, @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.apimanagement.v2019_01_01.Tags listByProduct" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/tags") + Observable> listByProduct(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("productId") String productId, @Path("subscriptionId") String subscriptionId, @Query("$filter") String filter, @Query("$top") Integer top, @Query("$skip") Integer skip, @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.apimanagement.v2019_01_01.Tags getEntityStateByProduct" }) + @HEAD("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/tags/{tagId}") + Observable> getEntityStateByProduct(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("productId") String productId, @Path("tagId") String tagId, @Path("subscriptionId") String subscriptionId, @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.apimanagement.v2019_01_01.Tags getByProduct" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/tags/{tagId}") + Observable> getByProduct(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("productId") String productId, @Path("tagId") String tagId, @Path("subscriptionId") String subscriptionId, @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.apimanagement.v2019_01_01.Tags assignToProduct" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/tags/{tagId}") + Observable> assignToProduct(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("productId") String productId, @Path("tagId") String tagId, @Path("subscriptionId") String subscriptionId, @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.apimanagement.v2019_01_01.Tags detachFromProduct" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/tags/{tagId}", method = "DELETE", hasBody = true) + Observable> detachFromProduct(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("productId") String productId, @Path("tagId") String tagId, @Path("subscriptionId") String subscriptionId, @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.apimanagement.v2019_01_01.Tags listByService" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tags") + Observable> listByService(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("subscriptionId") String subscriptionId, @Query("$filter") String filter, @Query("$top") Integer top, @Query("$skip") Integer skip, @Query("scope") String scope, @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.apimanagement.v2019_01_01.Tags getEntityState" }) + @HEAD("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tags/{tagId}") + Observable> getEntityState(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("tagId") String tagId, @Path("subscriptionId") String subscriptionId, @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.apimanagement.v2019_01_01.Tags get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tags/{tagId}") + Observable> get(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("tagId") String tagId, @Path("subscriptionId") String subscriptionId, @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.apimanagement.v2019_01_01.Tags createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tags/{tagId}") + Observable> createOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("tagId") String tagId, @Path("subscriptionId") String subscriptionId, @Header("If-Match") String ifMatch, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body TagCreateUpdateParameters parameters, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.apimanagement.v2019_01_01.Tags update" }) + @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tags/{tagId}") + Observable> update(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("tagId") String tagId, @Path("subscriptionId") String subscriptionId, @Header("If-Match") String ifMatch, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body TagCreateUpdateParameters parameters, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.apimanagement.v2019_01_01.Tags delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tags/{tagId}", method = "DELETE", hasBody = true) + Observable> delete(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("tagId") String tagId, @Path("subscriptionId") String subscriptionId, @Header("If-Match") String ifMatch, @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.apimanagement.v2019_01_01.Tags listByOperationNext" }) + @GET + Observable> listByOperationNext(@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.apimanagement.v2019_01_01.Tags listByApiNext" }) + @GET + Observable> listByApiNext(@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.apimanagement.v2019_01_01.Tags listByProductNext" }) + @GET + Observable> listByProductNext(@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.apimanagement.v2019_01_01.Tags listByServiceNext" }) + @GET + Observable> listByServiceNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Lists all Tags associated with the Operation. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @param operationId Operation identifier within an API. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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<TagContractInner> object if successful. + */ + public PagedList listByOperation(final String resourceGroupName, final String serviceName, final String apiId, final String operationId) { + ServiceResponse> response = listByOperationSinglePageAsync(resourceGroupName, serviceName, apiId, operationId).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByOperationNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists all Tags associated with the Operation. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @param operationId Operation identifier within an API. Must be unique in the current API Management service instance. + * @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> listByOperationAsync(final String resourceGroupName, final String serviceName, final String apiId, final String operationId, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByOperationSinglePageAsync(resourceGroupName, serviceName, apiId, operationId), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByOperationNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists all Tags associated with the Operation. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @param operationId Operation identifier within an API. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<TagContractInner> object + */ + public Observable> listByOperationAsync(final String resourceGroupName, final String serviceName, final String apiId, final String operationId) { + return listByOperationWithServiceResponseAsync(resourceGroupName, serviceName, apiId, operationId) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all Tags associated with the Operation. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @param operationId Operation identifier within an API. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<TagContractInner> object + */ + public Observable>> listByOperationWithServiceResponseAsync(final String resourceGroupName, final String serviceName, final String apiId, final String operationId) { + return listByOperationSinglePageAsync(resourceGroupName, serviceName, apiId, operationId) + .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(listByOperationNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists all Tags associated with the Operation. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @param operationId Operation identifier within an API. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<TagContractInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByOperationSinglePageAsync(final String resourceGroupName, final String serviceName, final String apiId, final String operationId) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (apiId == null) { + throw new IllegalArgumentException("Parameter apiId is required and cannot be null."); + } + if (operationId == null) { + throw new IllegalArgumentException("Parameter operationId is required and cannot be null."); + } + 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 filter = null; + final Integer top = null; + final Integer skip = null; + return service.listByOperation(resourceGroupName, serviceName, apiId, operationId, this.client.subscriptionId(), filter, top, skip, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByOperationDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Lists all Tags associated with the Operation. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @param operationId Operation identifier within an API. Must be unique in the current API Management service instance. + * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br> + * @param top Number of records to return. + * @param skip Number of records to skip. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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<TagContractInner> object if successful. + */ + public PagedList listByOperation(final String resourceGroupName, final String serviceName, final String apiId, final String operationId, final String filter, final Integer top, final Integer skip) { + ServiceResponse> response = listByOperationSinglePageAsync(resourceGroupName, serviceName, apiId, operationId, filter, top, skip).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByOperationNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists all Tags associated with the Operation. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @param operationId Operation identifier within an API. Must be unique in the current API Management service instance. + * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br> + * @param top Number of records to return. + * @param skip Number of records to skip. + * @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> listByOperationAsync(final String resourceGroupName, final String serviceName, final String apiId, final String operationId, final String filter, final Integer top, final Integer skip, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByOperationSinglePageAsync(resourceGroupName, serviceName, apiId, operationId, filter, top, skip), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByOperationNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists all Tags associated with the Operation. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @param operationId Operation identifier within an API. Must be unique in the current API Management service instance. + * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br> + * @param top Number of records to return. + * @param skip Number of records to skip. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<TagContractInner> object + */ + public Observable> listByOperationAsync(final String resourceGroupName, final String serviceName, final String apiId, final String operationId, final String filter, final Integer top, final Integer skip) { + return listByOperationWithServiceResponseAsync(resourceGroupName, serviceName, apiId, operationId, filter, top, skip) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all Tags associated with the Operation. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @param operationId Operation identifier within an API. Must be unique in the current API Management service instance. + * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br> + * @param top Number of records to return. + * @param skip Number of records to skip. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<TagContractInner> object + */ + public Observable>> listByOperationWithServiceResponseAsync(final String resourceGroupName, final String serviceName, final String apiId, final String operationId, final String filter, final Integer top, final Integer skip) { + return listByOperationSinglePageAsync(resourceGroupName, serviceName, apiId, operationId, filter, top, skip) + .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(listByOperationNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists all Tags associated with the Operation. + * + ServiceResponse> * @param resourceGroupName The name of the resource group. + ServiceResponse> * @param serviceName The name of the API Management service. + ServiceResponse> * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + ServiceResponse> * @param operationId Operation identifier within an API. Must be unique in the current API Management service instance. + ServiceResponse> * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br> + ServiceResponse> * @param top Number of records to return. + ServiceResponse> * @param skip Number of records to skip. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<TagContractInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByOperationSinglePageAsync(final String resourceGroupName, final String serviceName, final String apiId, final String operationId, final String filter, final Integer top, final Integer skip) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (apiId == null) { + throw new IllegalArgumentException("Parameter apiId is required and cannot be null."); + } + if (operationId == null) { + throw new IllegalArgumentException("Parameter operationId is required and cannot be null."); + } + 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.listByOperation(resourceGroupName, serviceName, apiId, operationId, this.client.subscriptionId(), filter, top, skip, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByOperationDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByOperationDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Gets the entity state version of the tag specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @param operationId Operation identifier within an API. Must be unique in the current API Management service instance. + * @param tagId Tag identifier. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void getEntityStateByOperation(String resourceGroupName, String serviceName, String apiId, String operationId, String tagId) { + getEntityStateByOperationWithServiceResponseAsync(resourceGroupName, serviceName, apiId, operationId, tagId).toBlocking().single().body(); + } + + /** + * Gets the entity state version of the tag specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @param operationId Operation identifier within an API. Must be unique in the current API Management service instance. + * @param tagId Tag identifier. Must be unique in the current API Management service instance. + * @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 getEntityStateByOperationAsync(String resourceGroupName, String serviceName, String apiId, String operationId, String tagId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(getEntityStateByOperationWithServiceResponseAsync(resourceGroupName, serviceName, apiId, operationId, tagId), serviceCallback); + } + + /** + * Gets the entity state version of the tag specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @param operationId Operation identifier within an API. Must be unique in the current API Management service instance. + * @param tagId Tag identifier. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public Observable getEntityStateByOperationAsync(String resourceGroupName, String serviceName, String apiId, String operationId, String tagId) { + return getEntityStateByOperationWithServiceResponseAsync(resourceGroupName, serviceName, apiId, operationId, tagId).map(new Func1, Void>() { + @Override + public Void call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Gets the entity state version of the tag specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @param operationId Operation identifier within an API. Must be unique in the current API Management service instance. + * @param tagId Tag identifier. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public Observable> getEntityStateByOperationWithServiceResponseAsync(String resourceGroupName, String serviceName, String apiId, String operationId, String tagId) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (apiId == null) { + throw new IllegalArgumentException("Parameter apiId is required and cannot be null."); + } + if (operationId == null) { + throw new IllegalArgumentException("Parameter operationId is required and cannot be null."); + } + if (tagId == null) { + throw new IllegalArgumentException("Parameter tagId is required and cannot be null."); + } + 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.getEntityStateByOperation(resourceGroupName, serviceName, apiId, operationId, tagId, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = getEntityStateByOperationDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponseWithHeaders getEntityStateByOperationDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .buildEmptyWithHeaders(response, TagGetEntityStateByOperationHeaders.class); + } + + /** + * Get tag associated with the Operation. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @param operationId Operation identifier within an API. Must be unique in the current API Management service instance. + * @param tagId Tag identifier. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the TagContractInner object if successful. + */ + public TagContractInner getByOperation(String resourceGroupName, String serviceName, String apiId, String operationId, String tagId) { + return getByOperationWithServiceResponseAsync(resourceGroupName, serviceName, apiId, operationId, tagId).toBlocking().single().body(); + } + + /** + * Get tag associated with the Operation. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @param operationId Operation identifier within an API. Must be unique in the current API Management service instance. + * @param tagId Tag identifier. Must be unique in the current API Management service instance. + * @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 getByOperationAsync(String resourceGroupName, String serviceName, String apiId, String operationId, String tagId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(getByOperationWithServiceResponseAsync(resourceGroupName, serviceName, apiId, operationId, tagId), serviceCallback); + } + + /** + * Get tag associated with the Operation. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @param operationId Operation identifier within an API. Must be unique in the current API Management service instance. + * @param tagId Tag identifier. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the TagContractInner object + */ + public Observable getByOperationAsync(String resourceGroupName, String serviceName, String apiId, String operationId, String tagId) { + return getByOperationWithServiceResponseAsync(resourceGroupName, serviceName, apiId, operationId, tagId).map(new Func1, TagContractInner>() { + @Override + public TagContractInner call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Get tag associated with the Operation. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @param operationId Operation identifier within an API. Must be unique in the current API Management service instance. + * @param tagId Tag identifier. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the TagContractInner object + */ + public Observable> getByOperationWithServiceResponseAsync(String resourceGroupName, String serviceName, String apiId, String operationId, String tagId) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (apiId == null) { + throw new IllegalArgumentException("Parameter apiId is required and cannot be null."); + } + if (operationId == null) { + throw new IllegalArgumentException("Parameter operationId is required and cannot be null."); + } + if (tagId == null) { + throw new IllegalArgumentException("Parameter tagId is required and cannot be null."); + } + 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.getByOperation(resourceGroupName, serviceName, apiId, operationId, tagId, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = getByOperationDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponseWithHeaders getByOperationDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .buildWithHeaders(response, TagGetByOperationHeaders.class); + } + + /** + * Assign tag to the Operation. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @param operationId Operation identifier within an API. Must be unique in the current API Management service instance. + * @param tagId Tag identifier. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the TagContractInner object if successful. + */ + public TagContractInner assignToOperation(String resourceGroupName, String serviceName, String apiId, String operationId, String tagId) { + return assignToOperationWithServiceResponseAsync(resourceGroupName, serviceName, apiId, operationId, tagId).toBlocking().single().body(); + } + + /** + * Assign tag to the Operation. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @param operationId Operation identifier within an API. Must be unique in the current API Management service instance. + * @param tagId Tag identifier. Must be unique in the current API Management service instance. + * @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 assignToOperationAsync(String resourceGroupName, String serviceName, String apiId, String operationId, String tagId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(assignToOperationWithServiceResponseAsync(resourceGroupName, serviceName, apiId, operationId, tagId), serviceCallback); + } + + /** + * Assign tag to the Operation. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @param operationId Operation identifier within an API. Must be unique in the current API Management service instance. + * @param tagId Tag identifier. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the TagContractInner object + */ + public Observable assignToOperationAsync(String resourceGroupName, String serviceName, String apiId, String operationId, String tagId) { + return assignToOperationWithServiceResponseAsync(resourceGroupName, serviceName, apiId, operationId, tagId).map(new Func1, TagContractInner>() { + @Override + public TagContractInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Assign tag to the Operation. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @param operationId Operation identifier within an API. Must be unique in the current API Management service instance. + * @param tagId Tag identifier. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the TagContractInner object + */ + public Observable> assignToOperationWithServiceResponseAsync(String resourceGroupName, String serviceName, String apiId, String operationId, String tagId) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (apiId == null) { + throw new IllegalArgumentException("Parameter apiId is required and cannot be null."); + } + if (operationId == null) { + throw new IllegalArgumentException("Parameter operationId is required and cannot be null."); + } + if (tagId == null) { + throw new IllegalArgumentException("Parameter tagId is required and cannot be null."); + } + 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.assignToOperation(resourceGroupName, serviceName, apiId, operationId, tagId, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = assignToOperationDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse assignToOperationDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(201, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Detach the tag from the Operation. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @param operationId Operation identifier within an API. Must be unique in the current API Management service instance. + * @param tagId Tag identifier. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void detachFromOperation(String resourceGroupName, String serviceName, String apiId, String operationId, String tagId) { + detachFromOperationWithServiceResponseAsync(resourceGroupName, serviceName, apiId, operationId, tagId).toBlocking().single().body(); + } + + /** + * Detach the tag from the Operation. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @param operationId Operation identifier within an API. Must be unique in the current API Management service instance. + * @param tagId Tag identifier. Must be unique in the current API Management service instance. + * @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 detachFromOperationAsync(String resourceGroupName, String serviceName, String apiId, String operationId, String tagId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(detachFromOperationWithServiceResponseAsync(resourceGroupName, serviceName, apiId, operationId, tagId), serviceCallback); + } + + /** + * Detach the tag from the Operation. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @param operationId Operation identifier within an API. Must be unique in the current API Management service instance. + * @param tagId Tag identifier. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable detachFromOperationAsync(String resourceGroupName, String serviceName, String apiId, String operationId, String tagId) { + return detachFromOperationWithServiceResponseAsync(resourceGroupName, serviceName, apiId, operationId, tagId).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Detach the tag from the Operation. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @param operationId Operation identifier within an API. Must be unique in the current API Management service instance. + * @param tagId Tag identifier. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> detachFromOperationWithServiceResponseAsync(String resourceGroupName, String serviceName, String apiId, String operationId, String tagId) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (apiId == null) { + throw new IllegalArgumentException("Parameter apiId is required and cannot be null."); + } + if (operationId == null) { + throw new IllegalArgumentException("Parameter operationId is required and cannot be null."); + } + if (tagId == null) { + throw new IllegalArgumentException("Parameter tagId is required and cannot be null."); + } + 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.detachFromOperation(resourceGroupName, serviceName, apiId, operationId, tagId, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = detachFromOperationDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse detachFromOperationDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(204, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists all Tags associated with the API. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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<TagContractInner> object if successful. + */ + public PagedList listByApi(final String resourceGroupName, final String serviceName, final String apiId) { + ServiceResponse> response = listByApiSinglePageAsync(resourceGroupName, serviceName, apiId).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByApiNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists all Tags associated with the API. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @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> listByApiAsync(final String resourceGroupName, final String serviceName, final String apiId, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByApiSinglePageAsync(resourceGroupName, serviceName, apiId), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByApiNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists all Tags associated with the API. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<TagContractInner> object + */ + public Observable> listByApiAsync(final String resourceGroupName, final String serviceName, final String apiId) { + return listByApiWithServiceResponseAsync(resourceGroupName, serviceName, apiId) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all Tags associated with the API. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<TagContractInner> object + */ + public Observable>> listByApiWithServiceResponseAsync(final String resourceGroupName, final String serviceName, final String apiId) { + return listByApiSinglePageAsync(resourceGroupName, serviceName, apiId) + .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(listByApiNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists all Tags associated with the API. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<TagContractInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByApiSinglePageAsync(final String resourceGroupName, final String serviceName, final String apiId) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (apiId == null) { + throw new IllegalArgumentException("Parameter apiId is required and cannot be null."); + } + 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 filter = null; + final Integer top = null; + final Integer skip = null; + return service.listByApi(resourceGroupName, serviceName, apiId, this.client.subscriptionId(), filter, top, skip, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByApiDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Lists all Tags associated with the API. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br> + * @param top Number of records to return. + * @param skip Number of records to skip. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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<TagContractInner> object if successful. + */ + public PagedList listByApi(final String resourceGroupName, final String serviceName, final String apiId, final String filter, final Integer top, final Integer skip) { + ServiceResponse> response = listByApiSinglePageAsync(resourceGroupName, serviceName, apiId, filter, top, skip).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByApiNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists all Tags associated with the API. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br> + * @param top Number of records to return. + * @param skip Number of records to skip. + * @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> listByApiAsync(final String resourceGroupName, final String serviceName, final String apiId, final String filter, final Integer top, final Integer skip, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByApiSinglePageAsync(resourceGroupName, serviceName, apiId, filter, top, skip), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByApiNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists all Tags associated with the API. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br> + * @param top Number of records to return. + * @param skip Number of records to skip. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<TagContractInner> object + */ + public Observable> listByApiAsync(final String resourceGroupName, final String serviceName, final String apiId, final String filter, final Integer top, final Integer skip) { + return listByApiWithServiceResponseAsync(resourceGroupName, serviceName, apiId, filter, top, skip) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all Tags associated with the API. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br> + * @param top Number of records to return. + * @param skip Number of records to skip. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<TagContractInner> object + */ + public Observable>> listByApiWithServiceResponseAsync(final String resourceGroupName, final String serviceName, final String apiId, final String filter, final Integer top, final Integer skip) { + return listByApiSinglePageAsync(resourceGroupName, serviceName, apiId, filter, top, skip) + .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(listByApiNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists all Tags associated with the API. + * + ServiceResponse> * @param resourceGroupName The name of the resource group. + ServiceResponse> * @param serviceName The name of the API Management service. + ServiceResponse> * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + ServiceResponse> * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br> + ServiceResponse> * @param top Number of records to return. + ServiceResponse> * @param skip Number of records to skip. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<TagContractInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByApiSinglePageAsync(final String resourceGroupName, final String serviceName, final String apiId, final String filter, final Integer top, final Integer skip) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (apiId == null) { + throw new IllegalArgumentException("Parameter apiId is required and cannot be null."); + } + 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.listByApi(resourceGroupName, serviceName, apiId, this.client.subscriptionId(), filter, top, skip, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByApiDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByApiDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Gets the entity state version of the tag specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @param tagId Tag identifier. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void getEntityStateByApi(String resourceGroupName, String serviceName, String apiId, String tagId) { + getEntityStateByApiWithServiceResponseAsync(resourceGroupName, serviceName, apiId, tagId).toBlocking().single().body(); + } + + /** + * Gets the entity state version of the tag specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @param tagId Tag identifier. Must be unique in the current API Management service instance. + * @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 getEntityStateByApiAsync(String resourceGroupName, String serviceName, String apiId, String tagId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(getEntityStateByApiWithServiceResponseAsync(resourceGroupName, serviceName, apiId, tagId), serviceCallback); + } + + /** + * Gets the entity state version of the tag specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @param tagId Tag identifier. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public Observable getEntityStateByApiAsync(String resourceGroupName, String serviceName, String apiId, String tagId) { + return getEntityStateByApiWithServiceResponseAsync(resourceGroupName, serviceName, apiId, tagId).map(new Func1, Void>() { + @Override + public Void call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Gets the entity state version of the tag specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @param tagId Tag identifier. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public Observable> getEntityStateByApiWithServiceResponseAsync(String resourceGroupName, String serviceName, String apiId, String tagId) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (apiId == null) { + throw new IllegalArgumentException("Parameter apiId is required and cannot be null."); + } + if (tagId == null) { + throw new IllegalArgumentException("Parameter tagId is required and cannot be null."); + } + 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.getEntityStateByApi(resourceGroupName, serviceName, apiId, tagId, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = getEntityStateByApiDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponseWithHeaders getEntityStateByApiDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .buildEmptyWithHeaders(response, TagGetEntityStateByApiHeaders.class); + } + + /** + * Get tag associated with the API. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @param tagId Tag identifier. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the TagContractInner object if successful. + */ + public TagContractInner getByApi(String resourceGroupName, String serviceName, String apiId, String tagId) { + return getByApiWithServiceResponseAsync(resourceGroupName, serviceName, apiId, tagId).toBlocking().single().body(); + } + + /** + * Get tag associated with the API. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @param tagId Tag identifier. Must be unique in the current API Management service instance. + * @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 getByApiAsync(String resourceGroupName, String serviceName, String apiId, String tagId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(getByApiWithServiceResponseAsync(resourceGroupName, serviceName, apiId, tagId), serviceCallback); + } + + /** + * Get tag associated with the API. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @param tagId Tag identifier. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the TagContractInner object + */ + public Observable getByApiAsync(String resourceGroupName, String serviceName, String apiId, String tagId) { + return getByApiWithServiceResponseAsync(resourceGroupName, serviceName, apiId, tagId).map(new Func1, TagContractInner>() { + @Override + public TagContractInner call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Get tag associated with the API. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @param tagId Tag identifier. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the TagContractInner object + */ + public Observable> getByApiWithServiceResponseAsync(String resourceGroupName, String serviceName, String apiId, String tagId) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (apiId == null) { + throw new IllegalArgumentException("Parameter apiId is required and cannot be null."); + } + if (tagId == null) { + throw new IllegalArgumentException("Parameter tagId is required and cannot be null."); + } + 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.getByApi(resourceGroupName, serviceName, apiId, tagId, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = getByApiDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponseWithHeaders getByApiDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .buildWithHeaders(response, TagGetByApiHeaders.class); + } + + /** + * Assign tag to the Api. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @param tagId Tag identifier. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the TagContractInner object if successful. + */ + public TagContractInner assignToApi(String resourceGroupName, String serviceName, String apiId, String tagId) { + return assignToApiWithServiceResponseAsync(resourceGroupName, serviceName, apiId, tagId).toBlocking().single().body(); + } + + /** + * Assign tag to the Api. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @param tagId Tag identifier. Must be unique in the current API Management service instance. + * @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 assignToApiAsync(String resourceGroupName, String serviceName, String apiId, String tagId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(assignToApiWithServiceResponseAsync(resourceGroupName, serviceName, apiId, tagId), serviceCallback); + } + + /** + * Assign tag to the Api. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @param tagId Tag identifier. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the TagContractInner object + */ + public Observable assignToApiAsync(String resourceGroupName, String serviceName, String apiId, String tagId) { + return assignToApiWithServiceResponseAsync(resourceGroupName, serviceName, apiId, tagId).map(new Func1, TagContractInner>() { + @Override + public TagContractInner call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Assign tag to the Api. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @param tagId Tag identifier. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the TagContractInner object + */ + public Observable> assignToApiWithServiceResponseAsync(String resourceGroupName, String serviceName, String apiId, String tagId) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (apiId == null) { + throw new IllegalArgumentException("Parameter apiId is required and cannot be null."); + } + if (tagId == null) { + throw new IllegalArgumentException("Parameter tagId is required and cannot be null."); + } + 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.assignToApi(resourceGroupName, serviceName, apiId, tagId, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = assignToApiDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponseWithHeaders assignToApiDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(201, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .buildWithHeaders(response, TagAssignToApiHeaders.class); + } + + /** + * Detach the tag from the Api. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @param tagId Tag identifier. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void detachFromApi(String resourceGroupName, String serviceName, String apiId, String tagId) { + detachFromApiWithServiceResponseAsync(resourceGroupName, serviceName, apiId, tagId).toBlocking().single().body(); + } + + /** + * Detach the tag from the Api. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @param tagId Tag identifier. Must be unique in the current API Management service instance. + * @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 detachFromApiAsync(String resourceGroupName, String serviceName, String apiId, String tagId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(detachFromApiWithServiceResponseAsync(resourceGroupName, serviceName, apiId, tagId), serviceCallback); + } + + /** + * Detach the tag from the Api. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @param tagId Tag identifier. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable detachFromApiAsync(String resourceGroupName, String serviceName, String apiId, String tagId) { + return detachFromApiWithServiceResponseAsync(resourceGroupName, serviceName, apiId, tagId).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Detach the tag from the Api. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. + * @param tagId Tag identifier. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> detachFromApiWithServiceResponseAsync(String resourceGroupName, String serviceName, String apiId, String tagId) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (apiId == null) { + throw new IllegalArgumentException("Parameter apiId is required and cannot be null."); + } + if (tagId == null) { + throw new IllegalArgumentException("Parameter tagId is required and cannot be null."); + } + 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.detachFromApi(resourceGroupName, serviceName, apiId, tagId, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = detachFromApiDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse detachFromApiDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(204, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists all Tags associated with the Product. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param productId Product identifier. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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<TagContractInner> object if successful. + */ + public PagedList listByProduct(final String resourceGroupName, final String serviceName, final String productId) { + ServiceResponse> response = listByProductSinglePageAsync(resourceGroupName, serviceName, productId).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByProductNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists all Tags associated with the Product. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param productId Product identifier. Must be unique in the current API Management service instance. + * @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> listByProductAsync(final String resourceGroupName, final String serviceName, final String productId, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByProductSinglePageAsync(resourceGroupName, serviceName, productId), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByProductNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists all Tags associated with the Product. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param productId Product identifier. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<TagContractInner> object + */ + public Observable> listByProductAsync(final String resourceGroupName, final String serviceName, final String productId) { + return listByProductWithServiceResponseAsync(resourceGroupName, serviceName, productId) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all Tags associated with the Product. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param productId Product identifier. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<TagContractInner> object + */ + public Observable>> listByProductWithServiceResponseAsync(final String resourceGroupName, final String serviceName, final String productId) { + return listByProductSinglePageAsync(resourceGroupName, serviceName, productId) + .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(listByProductNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists all Tags associated with the Product. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param productId Product identifier. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<TagContractInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByProductSinglePageAsync(final String resourceGroupName, final String serviceName, final String productId) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (productId == null) { + throw new IllegalArgumentException("Parameter productId is required and cannot be null."); + } + 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 filter = null; + final Integer top = null; + final Integer skip = null; + return service.listByProduct(resourceGroupName, serviceName, productId, this.client.subscriptionId(), filter, top, skip, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByProductDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Lists all Tags associated with the Product. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param productId Product identifier. Must be unique in the current API Management service instance. + * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br> + * @param top Number of records to return. + * @param skip Number of records to skip. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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<TagContractInner> object if successful. + */ + public PagedList listByProduct(final String resourceGroupName, final String serviceName, final String productId, final String filter, final Integer top, final Integer skip) { + ServiceResponse> response = listByProductSinglePageAsync(resourceGroupName, serviceName, productId, filter, top, skip).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByProductNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists all Tags associated with the Product. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param productId Product identifier. Must be unique in the current API Management service instance. + * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br> + * @param top Number of records to return. + * @param skip Number of records to skip. + * @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> listByProductAsync(final String resourceGroupName, final String serviceName, final String productId, final String filter, final Integer top, final Integer skip, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByProductSinglePageAsync(resourceGroupName, serviceName, productId, filter, top, skip), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByProductNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists all Tags associated with the Product. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param productId Product identifier. Must be unique in the current API Management service instance. + * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br> + * @param top Number of records to return. + * @param skip Number of records to skip. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<TagContractInner> object + */ + public Observable> listByProductAsync(final String resourceGroupName, final String serviceName, final String productId, final String filter, final Integer top, final Integer skip) { + return listByProductWithServiceResponseAsync(resourceGroupName, serviceName, productId, filter, top, skip) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all Tags associated with the Product. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param productId Product identifier. Must be unique in the current API Management service instance. + * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br> + * @param top Number of records to return. + * @param skip Number of records to skip. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<TagContractInner> object + */ + public Observable>> listByProductWithServiceResponseAsync(final String resourceGroupName, final String serviceName, final String productId, final String filter, final Integer top, final Integer skip) { + return listByProductSinglePageAsync(resourceGroupName, serviceName, productId, filter, top, skip) + .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(listByProductNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists all Tags associated with the Product. + * + ServiceResponse> * @param resourceGroupName The name of the resource group. + ServiceResponse> * @param serviceName The name of the API Management service. + ServiceResponse> * @param productId Product identifier. Must be unique in the current API Management service instance. + ServiceResponse> * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br> + ServiceResponse> * @param top Number of records to return. + ServiceResponse> * @param skip Number of records to skip. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<TagContractInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByProductSinglePageAsync(final String resourceGroupName, final String serviceName, final String productId, final String filter, final Integer top, final Integer skip) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (productId == null) { + throw new IllegalArgumentException("Parameter productId is required and cannot be null."); + } + 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.listByProduct(resourceGroupName, serviceName, productId, this.client.subscriptionId(), filter, top, skip, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByProductDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByProductDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Gets the entity state version of the tag specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param productId Product identifier. Must be unique in the current API Management service instance. + * @param tagId Tag identifier. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void getEntityStateByProduct(String resourceGroupName, String serviceName, String productId, String tagId) { + getEntityStateByProductWithServiceResponseAsync(resourceGroupName, serviceName, productId, tagId).toBlocking().single().body(); + } + + /** + * Gets the entity state version of the tag specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param productId Product identifier. Must be unique in the current API Management service instance. + * @param tagId Tag identifier. Must be unique in the current API Management service instance. + * @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 getEntityStateByProductAsync(String resourceGroupName, String serviceName, String productId, String tagId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(getEntityStateByProductWithServiceResponseAsync(resourceGroupName, serviceName, productId, tagId), serviceCallback); + } + + /** + * Gets the entity state version of the tag specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param productId Product identifier. Must be unique in the current API Management service instance. + * @param tagId Tag identifier. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public Observable getEntityStateByProductAsync(String resourceGroupName, String serviceName, String productId, String tagId) { + return getEntityStateByProductWithServiceResponseAsync(resourceGroupName, serviceName, productId, tagId).map(new Func1, Void>() { + @Override + public Void call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Gets the entity state version of the tag specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param productId Product identifier. Must be unique in the current API Management service instance. + * @param tagId Tag identifier. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public Observable> getEntityStateByProductWithServiceResponseAsync(String resourceGroupName, String serviceName, String productId, String tagId) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (productId == null) { + throw new IllegalArgumentException("Parameter productId is required and cannot be null."); + } + if (tagId == null) { + throw new IllegalArgumentException("Parameter tagId is required and cannot be null."); + } + 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.getEntityStateByProduct(resourceGroupName, serviceName, productId, tagId, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = getEntityStateByProductDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponseWithHeaders getEntityStateByProductDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .buildEmptyWithHeaders(response, TagGetEntityStateByProductHeaders.class); + } + + /** + * Get tag associated with the Product. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param productId Product identifier. Must be unique in the current API Management service instance. + * @param tagId Tag identifier. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the TagContractInner object if successful. + */ + public TagContractInner getByProduct(String resourceGroupName, String serviceName, String productId, String tagId) { + return getByProductWithServiceResponseAsync(resourceGroupName, serviceName, productId, tagId).toBlocking().single().body(); + } + + /** + * Get tag associated with the Product. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param productId Product identifier. Must be unique in the current API Management service instance. + * @param tagId Tag identifier. Must be unique in the current API Management service instance. + * @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 getByProductAsync(String resourceGroupName, String serviceName, String productId, String tagId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(getByProductWithServiceResponseAsync(resourceGroupName, serviceName, productId, tagId), serviceCallback); + } + + /** + * Get tag associated with the Product. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param productId Product identifier. Must be unique in the current API Management service instance. + * @param tagId Tag identifier. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the TagContractInner object + */ + public Observable getByProductAsync(String resourceGroupName, String serviceName, String productId, String tagId) { + return getByProductWithServiceResponseAsync(resourceGroupName, serviceName, productId, tagId).map(new Func1, TagContractInner>() { + @Override + public TagContractInner call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Get tag associated with the Product. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param productId Product identifier. Must be unique in the current API Management service instance. + * @param tagId Tag identifier. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the TagContractInner object + */ + public Observable> getByProductWithServiceResponseAsync(String resourceGroupName, String serviceName, String productId, String tagId) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (productId == null) { + throw new IllegalArgumentException("Parameter productId is required and cannot be null."); + } + if (tagId == null) { + throw new IllegalArgumentException("Parameter tagId is required and cannot be null."); + } + 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.getByProduct(resourceGroupName, serviceName, productId, tagId, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = getByProductDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponseWithHeaders getByProductDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .buildWithHeaders(response, TagGetByProductHeaders.class); + } + + /** + * Assign tag to the Product. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param productId Product identifier. Must be unique in the current API Management service instance. + * @param tagId Tag identifier. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the TagContractInner object if successful. + */ + public TagContractInner assignToProduct(String resourceGroupName, String serviceName, String productId, String tagId) { + return assignToProductWithServiceResponseAsync(resourceGroupName, serviceName, productId, tagId).toBlocking().single().body(); + } + + /** + * Assign tag to the Product. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param productId Product identifier. Must be unique in the current API Management service instance. + * @param tagId Tag identifier. Must be unique in the current API Management service instance. + * @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 assignToProductAsync(String resourceGroupName, String serviceName, String productId, String tagId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(assignToProductWithServiceResponseAsync(resourceGroupName, serviceName, productId, tagId), serviceCallback); + } + + /** + * Assign tag to the Product. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param productId Product identifier. Must be unique in the current API Management service instance. + * @param tagId Tag identifier. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the TagContractInner object + */ + public Observable assignToProductAsync(String resourceGroupName, String serviceName, String productId, String tagId) { + return assignToProductWithServiceResponseAsync(resourceGroupName, serviceName, productId, tagId).map(new Func1, TagContractInner>() { + @Override + public TagContractInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Assign tag to the Product. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param productId Product identifier. Must be unique in the current API Management service instance. + * @param tagId Tag identifier. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the TagContractInner object + */ + public Observable> assignToProductWithServiceResponseAsync(String resourceGroupName, String serviceName, String productId, String tagId) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (productId == null) { + throw new IllegalArgumentException("Parameter productId is required and cannot be null."); + } + if (tagId == null) { + throw new IllegalArgumentException("Parameter tagId is required and cannot be null."); + } + 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.assignToProduct(resourceGroupName, serviceName, productId, tagId, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = assignToProductDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse assignToProductDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(201, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Detach the tag from the Product. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param productId Product identifier. Must be unique in the current API Management service instance. + * @param tagId Tag identifier. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void detachFromProduct(String resourceGroupName, String serviceName, String productId, String tagId) { + detachFromProductWithServiceResponseAsync(resourceGroupName, serviceName, productId, tagId).toBlocking().single().body(); + } + + /** + * Detach the tag from the Product. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param productId Product identifier. Must be unique in the current API Management service instance. + * @param tagId Tag identifier. Must be unique in the current API Management service instance. + * @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 detachFromProductAsync(String resourceGroupName, String serviceName, String productId, String tagId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(detachFromProductWithServiceResponseAsync(resourceGroupName, serviceName, productId, tagId), serviceCallback); + } + + /** + * Detach the tag from the Product. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param productId Product identifier. Must be unique in the current API Management service instance. + * @param tagId Tag identifier. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable detachFromProductAsync(String resourceGroupName, String serviceName, String productId, String tagId) { + return detachFromProductWithServiceResponseAsync(resourceGroupName, serviceName, productId, tagId).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Detach the tag from the Product. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param productId Product identifier. Must be unique in the current API Management service instance. + * @param tagId Tag identifier. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> detachFromProductWithServiceResponseAsync(String resourceGroupName, String serviceName, String productId, String tagId) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (productId == null) { + throw new IllegalArgumentException("Parameter productId is required and cannot be null."); + } + if (tagId == null) { + throw new IllegalArgumentException("Parameter tagId is required and cannot be null."); + } + 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.detachFromProduct(resourceGroupName, serviceName, productId, tagId, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = detachFromProductDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse detachFromProductDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(204, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists a collection of tags defined within a service instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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<TagContractInner> object if successful. + */ + public PagedList listByService(final String resourceGroupName, final String serviceName) { + ServiceResponse> response = listByServiceSinglePageAsync(resourceGroupName, serviceName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByServiceNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists a collection of tags defined within a service instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @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> listByServiceAsync(final String resourceGroupName, final String serviceName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByServiceSinglePageAsync(resourceGroupName, serviceName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByServiceNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists a collection of tags defined within a service instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<TagContractInner> object + */ + public Observable> listByServiceAsync(final String resourceGroupName, final String serviceName) { + return listByServiceWithServiceResponseAsync(resourceGroupName, serviceName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists a collection of tags defined within a service instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<TagContractInner> object + */ + public Observable>> listByServiceWithServiceResponseAsync(final String resourceGroupName, final String serviceName) { + return listByServiceSinglePageAsync(resourceGroupName, serviceName) + .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(listByServiceNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists a collection of tags defined within a service instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<TagContractInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByServiceSinglePageAsync(final String resourceGroupName, final String serviceName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + 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 filter = null; + final Integer top = null; + final Integer skip = null; + final String scope = null; + return service.listByService(resourceGroupName, serviceName, this.client.subscriptionId(), filter, top, skip, scope, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByServiceDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Lists a collection of tags defined within a service instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br> + * @param top Number of records to return. + * @param skip Number of records to skip. + * @param scope Scope like 'apis', 'products' or 'apis/{apiId} + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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<TagContractInner> object if successful. + */ + public PagedList listByService(final String resourceGroupName, final String serviceName, final String filter, final Integer top, final Integer skip, final String scope) { + ServiceResponse> response = listByServiceSinglePageAsync(resourceGroupName, serviceName, filter, top, skip, scope).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByServiceNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists a collection of tags defined within a service instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br> + * @param top Number of records to return. + * @param skip Number of records to skip. + * @param scope Scope like 'apis', 'products' or 'apis/{apiId} + * @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> listByServiceAsync(final String resourceGroupName, final String serviceName, final String filter, final Integer top, final Integer skip, final String scope, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByServiceSinglePageAsync(resourceGroupName, serviceName, filter, top, skip, scope), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByServiceNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists a collection of tags defined within a service instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br> + * @param top Number of records to return. + * @param skip Number of records to skip. + * @param scope Scope like 'apis', 'products' or 'apis/{apiId} + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<TagContractInner> object + */ + public Observable> listByServiceAsync(final String resourceGroupName, final String serviceName, final String filter, final Integer top, final Integer skip, final String scope) { + return listByServiceWithServiceResponseAsync(resourceGroupName, serviceName, filter, top, skip, scope) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists a collection of tags defined within a service instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br> + * @param top Number of records to return. + * @param skip Number of records to skip. + * @param scope Scope like 'apis', 'products' or 'apis/{apiId} + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<TagContractInner> object + */ + public Observable>> listByServiceWithServiceResponseAsync(final String resourceGroupName, final String serviceName, final String filter, final Integer top, final Integer skip, final String scope) { + return listByServiceSinglePageAsync(resourceGroupName, serviceName, filter, top, skip, scope) + .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(listByServiceNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists a collection of tags defined within a service instance. + * + ServiceResponse> * @param resourceGroupName The name of the resource group. + ServiceResponse> * @param serviceName The name of the API Management service. + ServiceResponse> * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br> + ServiceResponse> * @param top Number of records to return. + ServiceResponse> * @param skip Number of records to skip. + ServiceResponse> * @param scope Scope like 'apis', 'products' or 'apis/{apiId} + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<TagContractInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByServiceSinglePageAsync(final String resourceGroupName, final String serviceName, final String filter, final Integer top, final Integer skip, final String scope) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + 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.listByService(resourceGroupName, serviceName, this.client.subscriptionId(), filter, top, skip, scope, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByServiceDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByServiceDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Gets the entity state version of the tag specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param tagId Tag identifier. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void getEntityState(String resourceGroupName, String serviceName, String tagId) { + getEntityStateWithServiceResponseAsync(resourceGroupName, serviceName, tagId).toBlocking().single().body(); + } + + /** + * Gets the entity state version of the tag specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param tagId Tag identifier. Must be unique in the current API Management service instance. + * @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 getEntityStateAsync(String resourceGroupName, String serviceName, String tagId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(getEntityStateWithServiceResponseAsync(resourceGroupName, serviceName, tagId), serviceCallback); + } + + /** + * Gets the entity state version of the tag specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param tagId Tag identifier. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public Observable getEntityStateAsync(String resourceGroupName, String serviceName, String tagId) { + return getEntityStateWithServiceResponseAsync(resourceGroupName, serviceName, tagId).map(new Func1, Void>() { + @Override + public Void call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Gets the entity state version of the tag specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param tagId Tag identifier. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public Observable> getEntityStateWithServiceResponseAsync(String resourceGroupName, String serviceName, String tagId) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (tagId == null) { + throw new IllegalArgumentException("Parameter tagId is required and cannot be null."); + } + 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.getEntityState(resourceGroupName, serviceName, tagId, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = getEntityStateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponseWithHeaders getEntityStateDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .buildEmptyWithHeaders(response, TagGetEntityStateHeaders.class); + } + + /** + * Gets the details of the tag specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param tagId Tag identifier. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the TagContractInner object if successful. + */ + public TagContractInner get(String resourceGroupName, String serviceName, String tagId) { + return getWithServiceResponseAsync(resourceGroupName, serviceName, tagId).toBlocking().single().body(); + } + + /** + * Gets the details of the tag specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param tagId Tag identifier. Must be unique in the current API Management service instance. + * @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 getAsync(String resourceGroupName, String serviceName, String tagId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(getWithServiceResponseAsync(resourceGroupName, serviceName, tagId), serviceCallback); + } + + /** + * Gets the details of the tag specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param tagId Tag identifier. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the TagContractInner object + */ + public Observable getAsync(String resourceGroupName, String serviceName, String tagId) { + return getWithServiceResponseAsync(resourceGroupName, serviceName, tagId).map(new Func1, TagContractInner>() { + @Override + public TagContractInner call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Gets the details of the tag specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param tagId Tag identifier. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the TagContractInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String serviceName, String tagId) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (tagId == null) { + throw new IllegalArgumentException("Parameter tagId is required and cannot be null."); + } + 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.get(resourceGroupName, serviceName, tagId, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = getDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponseWithHeaders getDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .buildWithHeaders(response, TagGetHeaders.class); + } + + /** + * Creates a tag. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param tagId Tag identifier. Must be unique in the current API Management service instance. + * @param displayName Tag name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the TagContractInner object if successful. + */ + public TagContractInner createOrUpdate(String resourceGroupName, String serviceName, String tagId, String displayName) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serviceName, tagId, displayName).toBlocking().single().body(); + } + + /** + * Creates a tag. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param tagId Tag identifier. Must be unique in the current API Management service instance. + * @param displayName Tag name. + * @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 createOrUpdateAsync(String resourceGroupName, String serviceName, String tagId, String displayName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, serviceName, tagId, displayName), serviceCallback); + } + + /** + * Creates a tag. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param tagId Tag identifier. Must be unique in the current API Management service instance. + * @param displayName Tag name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the TagContractInner object + */ + public Observable createOrUpdateAsync(String resourceGroupName, String serviceName, String tagId, String displayName) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serviceName, tagId, displayName).map(new Func1, TagContractInner>() { + @Override + public TagContractInner call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Creates a tag. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param tagId Tag identifier. Must be unique in the current API Management service instance. + * @param displayName Tag name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the TagContractInner object + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String serviceName, String tagId, String displayName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (tagId == null) { + throw new IllegalArgumentException("Parameter tagId is required and cannot be null."); + } + 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 (displayName == null) { + throw new IllegalArgumentException("Parameter displayName is required and cannot be null."); + } + final String ifMatch = null; + TagCreateUpdateParameters parameters = new TagCreateUpdateParameters(); + parameters.withDisplayName(displayName); + return service.createOrUpdate(resourceGroupName, serviceName, tagId, this.client.subscriptionId(), ifMatch, this.client.apiVersion(), this.client.acceptLanguage(), parameters, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = createOrUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Creates a tag. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param tagId Tag identifier. Must be unique in the current API Management service instance. + * @param displayName Tag name. + * @param ifMatch ETag of the Entity. Not required when creating an entity, but required when updating an entity. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the TagContractInner object if successful. + */ + public TagContractInner createOrUpdate(String resourceGroupName, String serviceName, String tagId, String displayName, String ifMatch) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serviceName, tagId, displayName, ifMatch).toBlocking().single().body(); + } + + /** + * Creates a tag. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param tagId Tag identifier. Must be unique in the current API Management service instance. + * @param displayName Tag name. + * @param ifMatch ETag of the Entity. Not required when creating an entity, but required when updating an entity. + * @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 createOrUpdateAsync(String resourceGroupName, String serviceName, String tagId, String displayName, String ifMatch, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, serviceName, tagId, displayName, ifMatch), serviceCallback); + } + + /** + * Creates a tag. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param tagId Tag identifier. Must be unique in the current API Management service instance. + * @param displayName Tag name. + * @param ifMatch ETag of the Entity. Not required when creating an entity, but required when updating an entity. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the TagContractInner object + */ + public Observable createOrUpdateAsync(String resourceGroupName, String serviceName, String tagId, String displayName, String ifMatch) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serviceName, tagId, displayName, ifMatch).map(new Func1, TagContractInner>() { + @Override + public TagContractInner call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Creates a tag. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param tagId Tag identifier. Must be unique in the current API Management service instance. + * @param displayName Tag name. + * @param ifMatch ETag of the Entity. Not required when creating an entity, but required when updating an entity. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the TagContractInner object + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String serviceName, String tagId, String displayName, String ifMatch) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (tagId == null) { + throw new IllegalArgumentException("Parameter tagId is required and cannot be null."); + } + 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 (displayName == null) { + throw new IllegalArgumentException("Parameter displayName is required and cannot be null."); + } + TagCreateUpdateParameters parameters = new TagCreateUpdateParameters(); + parameters.withDisplayName(displayName); + return service.createOrUpdate(resourceGroupName, serviceName, tagId, this.client.subscriptionId(), ifMatch, this.client.apiVersion(), this.client.acceptLanguage(), parameters, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = createOrUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponseWithHeaders createOrUpdateDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(201, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .buildWithHeaders(response, TagCreateOrUpdateHeaders.class); + } + + /** + * Updates the details of the tag specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param tagId Tag identifier. Must be unique in the current API Management service instance. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @param displayName Tag name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void update(String resourceGroupName, String serviceName, String tagId, String ifMatch, String displayName) { + updateWithServiceResponseAsync(resourceGroupName, serviceName, tagId, ifMatch, displayName).toBlocking().single().body(); + } + + /** + * Updates the details of the tag specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param tagId Tag identifier. Must be unique in the current API Management service instance. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @param displayName Tag name. + * @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 serviceName, String tagId, String ifMatch, String displayName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateWithServiceResponseAsync(resourceGroupName, serviceName, tagId, ifMatch, displayName), serviceCallback); + } + + /** + * Updates the details of the tag specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param tagId Tag identifier. Must be unique in the current API Management service instance. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @param displayName Tag name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable updateAsync(String resourceGroupName, String serviceName, String tagId, String ifMatch, String displayName) { + return updateWithServiceResponseAsync(resourceGroupName, serviceName, tagId, ifMatch, displayName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates the details of the tag specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param tagId Tag identifier. Must be unique in the current API Management service instance. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @param displayName Tag name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> updateWithServiceResponseAsync(String resourceGroupName, String serviceName, String tagId, String ifMatch, String displayName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (tagId == null) { + throw new IllegalArgumentException("Parameter tagId is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (ifMatch == null) { + throw new IllegalArgumentException("Parameter ifMatch 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 (displayName == null) { + throw new IllegalArgumentException("Parameter displayName is required and cannot be null."); + } + TagCreateUpdateParameters parameters = new TagCreateUpdateParameters(); + parameters.withDisplayName(displayName); + return service.update(resourceGroupName, serviceName, tagId, this.client.subscriptionId(), ifMatch, this.client.apiVersion(), this.client.acceptLanguage(), parameters, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = updateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse updateDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(204, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Deletes specific tag of the API Management service instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param tagId Tag identifier. Must be unique in the current API Management service instance. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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 serviceName, String tagId, String ifMatch) { + deleteWithServiceResponseAsync(resourceGroupName, serviceName, tagId, ifMatch).toBlocking().single().body(); + } + + /** + * Deletes specific tag of the API Management service instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param tagId Tag identifier. Must be unique in the current API Management service instance. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @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 serviceName, String tagId, String ifMatch, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, serviceName, tagId, ifMatch), serviceCallback); + } + + /** + * Deletes specific tag of the API Management service instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param tagId Tag identifier. Must be unique in the current API Management service instance. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable deleteAsync(String resourceGroupName, String serviceName, String tagId, String ifMatch) { + return deleteWithServiceResponseAsync(resourceGroupName, serviceName, tagId, ifMatch).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes specific tag of the API Management service instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param tagId Tag identifier. Must be unique in the current API Management service instance. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> deleteWithServiceResponseAsync(String resourceGroupName, String serviceName, String tagId, String ifMatch) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (tagId == null) { + throw new IllegalArgumentException("Parameter tagId is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (ifMatch == null) { + throw new IllegalArgumentException("Parameter ifMatch 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.delete(resourceGroupName, serviceName, tagId, this.client.subscriptionId(), ifMatch, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = deleteDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse deleteDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(204, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists all Tags associated with the Operation. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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<TagContractInner> object if successful. + */ + public PagedList listByOperationNext(final String nextPageLink) { + ServiceResponse> response = listByOperationNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByOperationNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists all Tags associated with the Operation. + * + * @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> listByOperationNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByOperationNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByOperationNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists all Tags associated with the Operation. + * + * @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<TagContractInner> object + */ + public Observable> listByOperationNextAsync(final String nextPageLink) { + return listByOperationNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all Tags associated with the Operation. + * + * @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<TagContractInner> object + */ + public Observable>> listByOperationNextWithServiceResponseAsync(final String nextPageLink) { + return listByOperationNextSinglePageAsync(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(listByOperationNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists all Tags associated with the Operation. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<TagContractInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByOperationNextSinglePageAsync(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.listByOperationNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByOperationNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByOperationNextDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists all Tags associated with the API. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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<TagContractInner> object if successful. + */ + public PagedList listByApiNext(final String nextPageLink) { + ServiceResponse> response = listByApiNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByApiNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists all Tags associated with the API. + * + * @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> listByApiNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByApiNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByApiNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists all Tags associated with the API. + * + * @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<TagContractInner> object + */ + public Observable> listByApiNextAsync(final String nextPageLink) { + return listByApiNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all Tags associated with the API. + * + * @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<TagContractInner> object + */ + public Observable>> listByApiNextWithServiceResponseAsync(final String nextPageLink) { + return listByApiNextSinglePageAsync(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(listByApiNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists all Tags associated with the API. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<TagContractInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByApiNextSinglePageAsync(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.listByApiNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByApiNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByApiNextDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists all Tags associated with the Product. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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<TagContractInner> object if successful. + */ + public PagedList listByProductNext(final String nextPageLink) { + ServiceResponse> response = listByProductNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByProductNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists all Tags associated with the Product. + * + * @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> listByProductNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByProductNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByProductNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists all Tags associated with the Product. + * + * @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<TagContractInner> object + */ + public Observable> listByProductNextAsync(final String nextPageLink) { + return listByProductNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all Tags associated with the Product. + * + * @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<TagContractInner> object + */ + public Observable>> listByProductNextWithServiceResponseAsync(final String nextPageLink) { + return listByProductNextSinglePageAsync(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(listByProductNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists all Tags associated with the Product. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<TagContractInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByProductNextSinglePageAsync(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.listByProductNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByProductNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByProductNextDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists a collection of tags defined within a service instance. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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<TagContractInner> object if successful. + */ + public PagedList listByServiceNext(final String nextPageLink) { + ServiceResponse> response = listByServiceNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByServiceNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists a collection of tags defined within a service instance. + * + * @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> listByServiceNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByServiceNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByServiceNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists a collection of tags defined within a service instance. + * + * @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<TagContractInner> object + */ + public Observable> listByServiceNextAsync(final String nextPageLink) { + return listByServiceNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists a collection of tags defined within a service instance. + * + * @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<TagContractInner> object + */ + public Observable>> listByServiceNextWithServiceResponseAsync(final String nextPageLink) { + return listByServiceNextSinglePageAsync(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(listByServiceNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists a collection of tags defined within a service instance. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<TagContractInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByServiceNextSinglePageAsync(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.listByServiceNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByServiceNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByServiceNextDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/TenantAccessGitsImpl.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/TenantAccessGitsImpl.java new file mode 100644 index 0000000000000..8502278bb7c94 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/TenantAccessGitsImpl.java @@ -0,0 +1,55 @@ +/** + * 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. + * abc + */ + +package com.microsoft.azure.management.apimanagement.v2019_01_01.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.apimanagement.v2019_01_01.TenantAccessGits; +import rx.Completable; +import rx.functions.Func1; +import rx.Observable; +import com.microsoft.azure.management.apimanagement.v2019_01_01.AccessInformationContract; + +class TenantAccessGitsImpl extends WrapperImpl implements TenantAccessGits { + private final ApiManagementManager manager; + + TenantAccessGitsImpl(ApiManagementManager manager) { + super(manager.inner().tenantAccessGits()); + this.manager = manager; + } + + public ApiManagementManager manager() { + return this.manager; + } + + @Override + public Observable getAsync(String resourceGroupName, String serviceName) { + TenantAccessGitsInner client = this.inner(); + return client.getAsync(resourceGroupName, serviceName) + .map(new Func1() { + @Override + public AccessInformationContract call(AccessInformationContractInner inner) { + return new AccessInformationContractImpl(inner, manager()); + } + }); + } + + @Override + public Completable regeneratePrimaryKeyAsync(String resourceGroupName, String serviceName) { + TenantAccessGitsInner client = this.inner(); + return client.regeneratePrimaryKeyAsync(resourceGroupName, serviceName).toCompletable(); + } + + @Override + public Completable regenerateSecondaryKeyAsync(String resourceGroupName, String serviceName) { + TenantAccessGitsInner client = this.inner(); + return client.regenerateSecondaryKeyAsync(resourceGroupName, serviceName).toCompletable(); + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/TenantAccessGitsInner.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/TenantAccessGitsInner.java new file mode 100644 index 0000000000000..78d80f9f65f6f --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/TenantAccessGitsInner.java @@ -0,0 +1,330 @@ +/** + * 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.apimanagement.v2019_01_01.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.management.apimanagement.v2019_01_01.ErrorResponseException; +import com.microsoft.azure.management.apimanagement.v2019_01_01.TenantAccessGitGetHeaders; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import com.microsoft.rest.ServiceResponseWithHeaders; +import java.io.IOException; +import okhttp3.ResponseBody; +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.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in TenantAccessGits. + */ +public class TenantAccessGitsInner { + /** The Retrofit service to perform REST calls. */ + private TenantAccessGitsService service; + /** The service client containing this operation class. */ + private ApiManagementClientImpl client; + + /** + * Initializes an instance of TenantAccessGitsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public TenantAccessGitsInner(Retrofit retrofit, ApiManagementClientImpl client) { + this.service = retrofit.create(TenantAccessGitsService.class); + this.client = client; + } + + /** + * The interface defining all the services for TenantAccessGits to be + * used by Retrofit to perform actually REST calls. + */ + interface TenantAccessGitsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.apimanagement.v2019_01_01.TenantAccessGits get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tenant/{accessName}/git") + Observable> get(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("subscriptionId") String subscriptionId, @Path("accessName") String accessName, @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.apimanagement.v2019_01_01.TenantAccessGits regeneratePrimaryKey" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tenant/{accessName}/git/regeneratePrimaryKey") + Observable> regeneratePrimaryKey(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("subscriptionId") String subscriptionId, @Path("accessName") String accessName, @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.apimanagement.v2019_01_01.TenantAccessGits regenerateSecondaryKey" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tenant/{accessName}/git/regenerateSecondaryKey") + Observable> regenerateSecondaryKey(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("subscriptionId") String subscriptionId, @Path("accessName") String accessName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Gets the Git access configuration for the tenant. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the AccessInformationContractInner object if successful. + */ + public AccessInformationContractInner get(String resourceGroupName, String serviceName) { + return getWithServiceResponseAsync(resourceGroupName, serviceName).toBlocking().single().body(); + } + + /** + * Gets the Git access configuration for the tenant. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @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 getAsync(String resourceGroupName, String serviceName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(getWithServiceResponseAsync(resourceGroupName, serviceName), serviceCallback); + } + + /** + * Gets the Git access configuration for the tenant. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the AccessInformationContractInner object + */ + public Observable getAsync(String resourceGroupName, String serviceName) { + return getWithServiceResponseAsync(resourceGroupName, serviceName).map(new Func1, AccessInformationContractInner>() { + @Override + public AccessInformationContractInner call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Gets the Git access configuration for the tenant. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the AccessInformationContractInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String serviceName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + 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 accessName = "access"; + return service.get(resourceGroupName, serviceName, this.client.subscriptionId(), accessName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = getDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponseWithHeaders getDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .buildWithHeaders(response, TenantAccessGitGetHeaders.class); + } + + /** + * Regenerate primary access key for GIT. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void regeneratePrimaryKey(String resourceGroupName, String serviceName) { + regeneratePrimaryKeyWithServiceResponseAsync(resourceGroupName, serviceName).toBlocking().single().body(); + } + + /** + * Regenerate primary access key for GIT. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @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 regeneratePrimaryKeyAsync(String resourceGroupName, String serviceName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(regeneratePrimaryKeyWithServiceResponseAsync(resourceGroupName, serviceName), serviceCallback); + } + + /** + * Regenerate primary access key for GIT. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable regeneratePrimaryKeyAsync(String resourceGroupName, String serviceName) { + return regeneratePrimaryKeyWithServiceResponseAsync(resourceGroupName, serviceName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Regenerate primary access key for GIT. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> regeneratePrimaryKeyWithServiceResponseAsync(String resourceGroupName, String serviceName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + 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 accessName = "access"; + return service.regeneratePrimaryKey(resourceGroupName, serviceName, this.client.subscriptionId(), accessName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = regeneratePrimaryKeyDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse regeneratePrimaryKeyDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(204, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Regenerate secondary access key for GIT. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void regenerateSecondaryKey(String resourceGroupName, String serviceName) { + regenerateSecondaryKeyWithServiceResponseAsync(resourceGroupName, serviceName).toBlocking().single().body(); + } + + /** + * Regenerate secondary access key for GIT. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @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 regenerateSecondaryKeyAsync(String resourceGroupName, String serviceName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(regenerateSecondaryKeyWithServiceResponseAsync(resourceGroupName, serviceName), serviceCallback); + } + + /** + * Regenerate secondary access key for GIT. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable regenerateSecondaryKeyAsync(String resourceGroupName, String serviceName) { + return regenerateSecondaryKeyWithServiceResponseAsync(resourceGroupName, serviceName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Regenerate secondary access key for GIT. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> regenerateSecondaryKeyWithServiceResponseAsync(String resourceGroupName, String serviceName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + 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 accessName = "access"; + return service.regenerateSecondaryKey(resourceGroupName, serviceName, this.client.subscriptionId(), accessName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = regenerateSecondaryKeyDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse regenerateSecondaryKeyDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(204, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/TenantAccessImpl.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/TenantAccessImpl.java new file mode 100644 index 0000000000000..19d4489a737b6 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/TenantAccessImpl.java @@ -0,0 +1,67 @@ +/** + * 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. + * abc + */ + +package com.microsoft.azure.management.apimanagement.v2019_01_01.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.apimanagement.v2019_01_01.TenantAccess; +import rx.Completable; +import rx.functions.Func1; +import rx.Observable; +import com.microsoft.azure.management.apimanagement.v2019_01_01.AccessInformationContract; + +class TenantAccessImpl extends WrapperImpl implements TenantAccess { + private final ApiManagementManager manager; + + TenantAccessImpl(ApiManagementManager manager) { + super(manager.inner().tenantAccess()); + this.manager = manager; + } + + public ApiManagementManager manager() { + return this.manager; + } + + @Override + public Completable getEntityTagAsync(String resourceGroupName, String serviceName) { + TenantAccessInner client = this.inner(); + return client.getEntityTagAsync(resourceGroupName, serviceName).toCompletable(); + } + + @Override + public Observable getAsync(String resourceGroupName, String serviceName) { + TenantAccessInner client = this.inner(); + return client.getAsync(resourceGroupName, serviceName) + .map(new Func1() { + @Override + public AccessInformationContract call(AccessInformationContractInner inner) { + return new AccessInformationContractImpl(inner, manager()); + } + }); + } + + @Override + public Completable updateAsync(String resourceGroupName, String serviceName, String ifMatch) { + TenantAccessInner client = this.inner(); + return client.updateAsync(resourceGroupName, serviceName, ifMatch).toCompletable(); + } + + @Override + public Completable regeneratePrimaryKeyAsync(String resourceGroupName, String serviceName) { + TenantAccessInner client = this.inner(); + return client.regeneratePrimaryKeyAsync(resourceGroupName, serviceName).toCompletable(); + } + + @Override + public Completable regenerateSecondaryKeyAsync(String resourceGroupName, String serviceName) { + TenantAccessInner client = this.inner(); + return client.regenerateSecondaryKeyAsync(resourceGroupName, serviceName).toCompletable(); + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/TenantAccessInner.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/TenantAccessInner.java new file mode 100644 index 0000000000000..8872f6adc87a6 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/TenantAccessInner.java @@ -0,0 +1,617 @@ +/** + * 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.apimanagement.v2019_01_01.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.management.apimanagement.v2019_01_01.AccessInformationUpdateParameters; +import com.microsoft.azure.management.apimanagement.v2019_01_01.ErrorResponseException; +import com.microsoft.azure.management.apimanagement.v2019_01_01.TenantAccessGetEntityTagHeaders; +import com.microsoft.azure.management.apimanagement.v2019_01_01.TenantAccessGetHeaders; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import com.microsoft.rest.ServiceResponseWithHeaders; +import java.io.IOException; +import okhttp3.ResponseBody; +import retrofit2.http.Body; +import retrofit2.http.GET; +import retrofit2.http.HEAD; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.PATCH; +import retrofit2.http.Path; +import retrofit2.http.POST; +import retrofit2.http.Query; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in TenantAccess. + */ +public class TenantAccessInner { + /** The Retrofit service to perform REST calls. */ + private TenantAccessService service; + /** The service client containing this operation class. */ + private ApiManagementClientImpl client; + + /** + * Initializes an instance of TenantAccessInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public TenantAccessInner(Retrofit retrofit, ApiManagementClientImpl client) { + this.service = retrofit.create(TenantAccessService.class); + this.client = client; + } + + /** + * The interface defining all the services for TenantAccess to be + * used by Retrofit to perform actually REST calls. + */ + interface TenantAccessService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.apimanagement.v2019_01_01.TenantAccess getEntityTag" }) + @HEAD("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tenant/{accessName}") + Observable> getEntityTag(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("subscriptionId") String subscriptionId, @Path("accessName") String accessName, @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.apimanagement.v2019_01_01.TenantAccess get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tenant/{accessName}") + Observable> get(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("subscriptionId") String subscriptionId, @Path("accessName") String accessName, @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.apimanagement.v2019_01_01.TenantAccess update" }) + @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tenant/{accessName}") + Observable> update(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("accessName") String accessName, @Path("subscriptionId") String subscriptionId, @Header("If-Match") String ifMatch, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body AccessInformationUpdateParameters parameters, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.apimanagement.v2019_01_01.TenantAccess regeneratePrimaryKey" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tenant/{accessName}/regeneratePrimaryKey") + Observable> regeneratePrimaryKey(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("subscriptionId") String subscriptionId, @Path("accessName") String accessName, @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.apimanagement.v2019_01_01.TenantAccess regenerateSecondaryKey" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tenant/{accessName}/regenerateSecondaryKey") + Observable> regenerateSecondaryKey(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("subscriptionId") String subscriptionId, @Path("accessName") String accessName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Tenant access metadata. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void getEntityTag(String resourceGroupName, String serviceName) { + getEntityTagWithServiceResponseAsync(resourceGroupName, serviceName).toBlocking().single().body(); + } + + /** + * Tenant access metadata. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @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 getEntityTagAsync(String resourceGroupName, String serviceName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(getEntityTagWithServiceResponseAsync(resourceGroupName, serviceName), serviceCallback); + } + + /** + * Tenant access metadata. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public Observable getEntityTagAsync(String resourceGroupName, String serviceName) { + return getEntityTagWithServiceResponseAsync(resourceGroupName, serviceName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Tenant access metadata. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public Observable> getEntityTagWithServiceResponseAsync(String resourceGroupName, String serviceName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + 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 accessName = "access"; + return service.getEntityTag(resourceGroupName, serviceName, this.client.subscriptionId(), accessName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = getEntityTagDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponseWithHeaders getEntityTagDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .buildEmptyWithHeaders(response, TenantAccessGetEntityTagHeaders.class); + } + + /** + * Get tenant access information details. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the AccessInformationContractInner object if successful. + */ + public AccessInformationContractInner get(String resourceGroupName, String serviceName) { + return getWithServiceResponseAsync(resourceGroupName, serviceName).toBlocking().single().body(); + } + + /** + * Get tenant access information details. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @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 getAsync(String resourceGroupName, String serviceName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(getWithServiceResponseAsync(resourceGroupName, serviceName), serviceCallback); + } + + /** + * Get tenant access information details. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the AccessInformationContractInner object + */ + public Observable getAsync(String resourceGroupName, String serviceName) { + return getWithServiceResponseAsync(resourceGroupName, serviceName).map(new Func1, AccessInformationContractInner>() { + @Override + public AccessInformationContractInner call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Get tenant access information details. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the AccessInformationContractInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String serviceName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + 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 accessName = "access"; + return service.get(resourceGroupName, serviceName, this.client.subscriptionId(), accessName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = getDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponseWithHeaders getDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .buildWithHeaders(response, TenantAccessGetHeaders.class); + } + + /** + * Update tenant access information details. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void update(String resourceGroupName, String serviceName, String ifMatch) { + updateWithServiceResponseAsync(resourceGroupName, serviceName, ifMatch).toBlocking().single().body(); + } + + /** + * Update tenant access information details. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @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 serviceName, String ifMatch, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateWithServiceResponseAsync(resourceGroupName, serviceName, ifMatch), serviceCallback); + } + + /** + * Update tenant access information details. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable updateAsync(String resourceGroupName, String serviceName, String ifMatch) { + return updateWithServiceResponseAsync(resourceGroupName, serviceName, ifMatch).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Update tenant access information details. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> updateWithServiceResponseAsync(String resourceGroupName, String serviceName, String ifMatch) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (ifMatch == null) { + throw new IllegalArgumentException("Parameter ifMatch 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 accessName = "access"; + final Boolean enabled = null; + AccessInformationUpdateParameters parameters = new AccessInformationUpdateParameters(); + parameters.withEnabled(null); + return service.update(resourceGroupName, serviceName, accessName, this.client.subscriptionId(), ifMatch, this.client.apiVersion(), this.client.acceptLanguage(), parameters, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = updateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Update tenant access information details. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @param enabled Determines whether direct access is enabled. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void update(String resourceGroupName, String serviceName, String ifMatch, Boolean enabled) { + updateWithServiceResponseAsync(resourceGroupName, serviceName, ifMatch, enabled).toBlocking().single().body(); + } + + /** + * Update tenant access information details. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @param enabled Determines whether direct access is enabled. + * @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 serviceName, String ifMatch, Boolean enabled, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateWithServiceResponseAsync(resourceGroupName, serviceName, ifMatch, enabled), serviceCallback); + } + + /** + * Update tenant access information details. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @param enabled Determines whether direct access is enabled. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable updateAsync(String resourceGroupName, String serviceName, String ifMatch, Boolean enabled) { + return updateWithServiceResponseAsync(resourceGroupName, serviceName, ifMatch, enabled).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Update tenant access information details. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @param enabled Determines whether direct access is enabled. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> updateWithServiceResponseAsync(String resourceGroupName, String serviceName, String ifMatch, Boolean enabled) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (ifMatch == null) { + throw new IllegalArgumentException("Parameter ifMatch 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 accessName = "access"; + AccessInformationUpdateParameters parameters = new AccessInformationUpdateParameters(); + parameters.withEnabled(enabled); + return service.update(resourceGroupName, serviceName, accessName, this.client.subscriptionId(), ifMatch, this.client.apiVersion(), this.client.acceptLanguage(), parameters, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = updateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse updateDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(204, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Regenerate primary access key. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void regeneratePrimaryKey(String resourceGroupName, String serviceName) { + regeneratePrimaryKeyWithServiceResponseAsync(resourceGroupName, serviceName).toBlocking().single().body(); + } + + /** + * Regenerate primary access key. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @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 regeneratePrimaryKeyAsync(String resourceGroupName, String serviceName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(regeneratePrimaryKeyWithServiceResponseAsync(resourceGroupName, serviceName), serviceCallback); + } + + /** + * Regenerate primary access key. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable regeneratePrimaryKeyAsync(String resourceGroupName, String serviceName) { + return regeneratePrimaryKeyWithServiceResponseAsync(resourceGroupName, serviceName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Regenerate primary access key. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> regeneratePrimaryKeyWithServiceResponseAsync(String resourceGroupName, String serviceName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + 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 accessName = "access"; + return service.regeneratePrimaryKey(resourceGroupName, serviceName, this.client.subscriptionId(), accessName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = regeneratePrimaryKeyDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse regeneratePrimaryKeyDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(204, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Regenerate secondary access key. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void regenerateSecondaryKey(String resourceGroupName, String serviceName) { + regenerateSecondaryKeyWithServiceResponseAsync(resourceGroupName, serviceName).toBlocking().single().body(); + } + + /** + * Regenerate secondary access key. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @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 regenerateSecondaryKeyAsync(String resourceGroupName, String serviceName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(regenerateSecondaryKeyWithServiceResponseAsync(resourceGroupName, serviceName), serviceCallback); + } + + /** + * Regenerate secondary access key. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable regenerateSecondaryKeyAsync(String resourceGroupName, String serviceName) { + return regenerateSecondaryKeyWithServiceResponseAsync(resourceGroupName, serviceName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Regenerate secondary access key. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> regenerateSecondaryKeyWithServiceResponseAsync(String resourceGroupName, String serviceName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + 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 accessName = "access"; + return service.regenerateSecondaryKey(resourceGroupName, serviceName, this.client.subscriptionId(), accessName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = regenerateSecondaryKeyDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse regenerateSecondaryKeyDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(204, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/TenantConfigurationSyncStateContractImpl.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/TenantConfigurationSyncStateContractImpl.java new file mode 100644 index 0000000000000..a48a5bceba76a --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/TenantConfigurationSyncStateContractImpl.java @@ -0,0 +1,62 @@ +/** + * 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.apimanagement.v2019_01_01.implementation; + +import com.microsoft.azure.management.apimanagement.v2019_01_01.TenantConfigurationSyncStateContract; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import org.joda.time.DateTime; + +class TenantConfigurationSyncStateContractImpl extends WrapperImpl implements TenantConfigurationSyncStateContract { + private final ApiManagementManager manager; + TenantConfigurationSyncStateContractImpl(TenantConfigurationSyncStateContractInner inner, ApiManagementManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public ApiManagementManager manager() { + return this.manager; + } + + @Override + public String branch() { + return this.inner().branch(); + } + + @Override + public String commitId() { + return this.inner().commitId(); + } + + @Override + public DateTime configurationChangeDate() { + return this.inner().configurationChangeDate(); + } + + @Override + public Boolean isExport() { + return this.inner().isExport(); + } + + @Override + public Boolean isGitEnabled() { + return this.inner().isGitEnabled(); + } + + @Override + public Boolean isSynced() { + return this.inner().isSynced(); + } + + @Override + public DateTime syncDate() { + return this.inner().syncDate(); + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/TenantConfigurationSyncStateContractInner.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/TenantConfigurationSyncStateContractInner.java new file mode 100644 index 0000000000000..980b383f9fd72 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/TenantConfigurationSyncStateContractInner.java @@ -0,0 +1,206 @@ +/** + * 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.apimanagement.v2019_01_01.implementation; + +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Tenant Configuration Synchronization State. + */ +public class TenantConfigurationSyncStateContractInner { + /** + * The name of Git branch. + */ + @JsonProperty(value = "branch") + private String branch; + + /** + * The latest commit Id. + */ + @JsonProperty(value = "commitId") + private String commitId; + + /** + * value indicating if last sync was save (true) or deploy (false) + * operation. + */ + @JsonProperty(value = "isExport") + private Boolean isExport; + + /** + * value indicating if last synchronization was later than the + * configuration change. + */ + @JsonProperty(value = "isSynced") + private Boolean isSynced; + + /** + * value indicating whether Git configuration access is enabled. + */ + @JsonProperty(value = "isGitEnabled") + private Boolean isGitEnabled; + + /** + * The date of the latest synchronization. The date conforms to the + * following format: `yyyy-MM-ddTHH:mm:ssZ` as specified by the ISO 8601 + * standard. + */ + @JsonProperty(value = "syncDate") + private DateTime syncDate; + + /** + * The date of the latest configuration change. The date conforms to the + * following format: `yyyy-MM-ddTHH:mm:ssZ` as specified by the ISO 8601 + * standard. + */ + @JsonProperty(value = "configurationChangeDate") + private DateTime configurationChangeDate; + + /** + * Get the name of Git branch. + * + * @return the branch value + */ + public String branch() { + return this.branch; + } + + /** + * Set the name of Git branch. + * + * @param branch the branch value to set + * @return the TenantConfigurationSyncStateContractInner object itself. + */ + public TenantConfigurationSyncStateContractInner withBranch(String branch) { + this.branch = branch; + return this; + } + + /** + * Get the latest commit Id. + * + * @return the commitId value + */ + public String commitId() { + return this.commitId; + } + + /** + * Set the latest commit Id. + * + * @param commitId the commitId value to set + * @return the TenantConfigurationSyncStateContractInner object itself. + */ + public TenantConfigurationSyncStateContractInner withCommitId(String commitId) { + this.commitId = commitId; + return this; + } + + /** + * Get value indicating if last sync was save (true) or deploy (false) operation. + * + * @return the isExport value + */ + public Boolean isExport() { + return this.isExport; + } + + /** + * Set value indicating if last sync was save (true) or deploy (false) operation. + * + * @param isExport the isExport value to set + * @return the TenantConfigurationSyncStateContractInner object itself. + */ + public TenantConfigurationSyncStateContractInner withIsExport(Boolean isExport) { + this.isExport = isExport; + return this; + } + + /** + * Get value indicating if last synchronization was later than the configuration change. + * + * @return the isSynced value + */ + public Boolean isSynced() { + return this.isSynced; + } + + /** + * Set value indicating if last synchronization was later than the configuration change. + * + * @param isSynced the isSynced value to set + * @return the TenantConfigurationSyncStateContractInner object itself. + */ + public TenantConfigurationSyncStateContractInner withIsSynced(Boolean isSynced) { + this.isSynced = isSynced; + return this; + } + + /** + * Get value indicating whether Git configuration access is enabled. + * + * @return the isGitEnabled value + */ + public Boolean isGitEnabled() { + return this.isGitEnabled; + } + + /** + * Set value indicating whether Git configuration access is enabled. + * + * @param isGitEnabled the isGitEnabled value to set + * @return the TenantConfigurationSyncStateContractInner object itself. + */ + public TenantConfigurationSyncStateContractInner withIsGitEnabled(Boolean isGitEnabled) { + this.isGitEnabled = isGitEnabled; + return this; + } + + /** + * Get the date of the latest synchronization. The date conforms to the following format: `yyyy-MM-ddTHH:mm:ssZ` as specified by the ISO 8601 standard. + * + * @return the syncDate value + */ + public DateTime syncDate() { + return this.syncDate; + } + + /** + * Set the date of the latest synchronization. The date conforms to the following format: `yyyy-MM-ddTHH:mm:ssZ` as specified by the ISO 8601 standard. + * + * @param syncDate the syncDate value to set + * @return the TenantConfigurationSyncStateContractInner object itself. + */ + public TenantConfigurationSyncStateContractInner withSyncDate(DateTime syncDate) { + this.syncDate = syncDate; + return this; + } + + /** + * Get the date of the latest configuration change. The date conforms to the following format: `yyyy-MM-ddTHH:mm:ssZ` as specified by the ISO 8601 standard. + * + * @return the configurationChangeDate value + */ + public DateTime configurationChangeDate() { + return this.configurationChangeDate; + } + + /** + * Set the date of the latest configuration change. The date conforms to the following format: `yyyy-MM-ddTHH:mm:ssZ` as specified by the ISO 8601 standard. + * + * @param configurationChangeDate the configurationChangeDate value to set + * @return the TenantConfigurationSyncStateContractInner object itself. + */ + public TenantConfigurationSyncStateContractInner withConfigurationChangeDate(DateTime configurationChangeDate) { + this.configurationChangeDate = configurationChangeDate; + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/TenantConfigurationsImpl.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/TenantConfigurationsImpl.java new file mode 100644 index 0000000000000..7954758dd0c30 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/TenantConfigurationsImpl.java @@ -0,0 +1,81 @@ +/** + * 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. + * abc + */ + +package com.microsoft.azure.management.apimanagement.v2019_01_01.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.apimanagement.v2019_01_01.TenantConfigurations; +import rx.functions.Func1; +import rx.Observable; +import com.microsoft.azure.management.apimanagement.v2019_01_01.OperationResultContract; +import com.microsoft.azure.management.apimanagement.v2019_01_01.TenantConfigurationSyncStateContract; +import com.microsoft.azure.management.apimanagement.v2019_01_01.DeployConfigurationParameters; +import com.microsoft.azure.management.apimanagement.v2019_01_01.SaveConfigurationParameter; + +class TenantConfigurationsImpl extends WrapperImpl implements TenantConfigurations { + private final ApiManagementManager manager; + + TenantConfigurationsImpl(ApiManagementManager manager) { + super(manager.inner().tenantConfigurations()); + this.manager = manager; + } + + public ApiManagementManager manager() { + return this.manager; + } + + @Override + public Observable deployAsync(String resourceGroupName, String serviceName, DeployConfigurationParameters parameters) { + TenantConfigurationsInner client = this.inner(); + return client.deployAsync(resourceGroupName, serviceName, parameters) + .map(new Func1() { + @Override + public OperationResultContract call(OperationResultContractInner inner) { + return new OperationResultContractImpl(inner, manager()); + } + }); + } + + @Override + public Observable saveAsync(String resourceGroupName, String serviceName, SaveConfigurationParameter parameters) { + TenantConfigurationsInner client = this.inner(); + return client.saveAsync(resourceGroupName, serviceName, parameters) + .map(new Func1() { + @Override + public OperationResultContract call(OperationResultContractInner inner) { + return new OperationResultContractImpl(inner, manager()); + } + }); + } + + @Override + public Observable validateAsync(String resourceGroupName, String serviceName, DeployConfigurationParameters parameters) { + TenantConfigurationsInner client = this.inner(); + return client.validateAsync(resourceGroupName, serviceName, parameters) + .map(new Func1() { + @Override + public OperationResultContract call(OperationResultContractInner inner) { + return new OperationResultContractImpl(inner, manager()); + } + }); + } + + @Override + public Observable getSyncStateAsync(String resourceGroupName, String serviceName) { + TenantConfigurationsInner client = this.inner(); + return client.getSyncStateAsync(resourceGroupName, serviceName) + .map(new Func1() { + @Override + public TenantConfigurationSyncStateContract call(TenantConfigurationSyncStateContractInner inner) { + return new TenantConfigurationSyncStateContractImpl(inner, manager()); + } + }); + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/TenantConfigurationsInner.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/TenantConfigurationsInner.java new file mode 100644 index 0000000000000..6237c9b3c567e --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/TenantConfigurationsInner.java @@ -0,0 +1,703 @@ +/** + * 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.apimanagement.v2019_01_01.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.CloudException; +import com.microsoft.azure.management.apimanagement.v2019_01_01.DeployConfigurationParameters; +import com.microsoft.azure.management.apimanagement.v2019_01_01.ErrorResponseException; +import com.microsoft.azure.management.apimanagement.v2019_01_01.SaveConfigurationParameter; +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 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.Response; +import rx.functions.Func1; +import rx.Observable; +import com.microsoft.azure.LongRunningFinalState; +import com.microsoft.azure.LongRunningOperationOptions; +import com.microsoft.azure.LongRunningFinalState; +import com.microsoft.azure.LongRunningOperationOptions; + +/** + * An instance of this class provides access to all the operations defined + * in TenantConfigurations. + */ +public class TenantConfigurationsInner { + /** The Retrofit service to perform REST calls. */ + private TenantConfigurationsService service; + /** The service client containing this operation class. */ + private ApiManagementClientImpl client; + + /** + * Initializes an instance of TenantConfigurationsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public TenantConfigurationsInner(Retrofit retrofit, ApiManagementClientImpl client) { + this.service = retrofit.create(TenantConfigurationsService.class); + this.client = client; + } + + /** + * The interface defining all the services for TenantConfigurations to be + * used by Retrofit to perform actually REST calls. + */ + interface TenantConfigurationsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.apimanagement.v2019_01_01.TenantConfigurations deploy" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tenant/{configurationName}/deploy") + Observable> deploy(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("subscriptionId") String subscriptionId, @Path("configurationName") String configurationName, @Body DeployConfigurationParameters parameters, @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.apimanagement.v2019_01_01.TenantConfigurations beginDeploy" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tenant/{configurationName}/deploy") + Observable> beginDeploy(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("subscriptionId") String subscriptionId, @Path("configurationName") String configurationName, @Body DeployConfigurationParameters parameters, @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.apimanagement.v2019_01_01.TenantConfigurations save" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tenant/{configurationName}/save") + Observable> save(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("subscriptionId") String subscriptionId, @Path("configurationName") String configurationName, @Body SaveConfigurationParameter parameters, @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.apimanagement.v2019_01_01.TenantConfigurations beginSave" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tenant/{configurationName}/save") + Observable> beginSave(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("subscriptionId") String subscriptionId, @Path("configurationName") String configurationName, @Body SaveConfigurationParameter parameters, @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.apimanagement.v2019_01_01.TenantConfigurations validate" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tenant/{configurationName}/validate") + Observable> validate(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("subscriptionId") String subscriptionId, @Path("configurationName") String configurationName, @Body DeployConfigurationParameters parameters, @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.apimanagement.v2019_01_01.TenantConfigurations beginValidate" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tenant/{configurationName}/validate") + Observable> beginValidate(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("subscriptionId") String subscriptionId, @Path("configurationName") String configurationName, @Body DeployConfigurationParameters parameters, @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.apimanagement.v2019_01_01.TenantConfigurations getSyncState" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tenant/{configurationName}/syncState") + Observable> getSyncState(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("subscriptionId") String subscriptionId, @Path("configurationName") String configurationName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * This operation applies changes from the specified Git branch to the configuration database. This is a long running operation and could take several minutes to complete. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param parameters Deploy Configuration parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the OperationResultContractInner object if successful. + */ + public OperationResultContractInner deploy(String resourceGroupName, String serviceName, DeployConfigurationParameters parameters) { + return deployWithServiceResponseAsync(resourceGroupName, serviceName, parameters).toBlocking().last().body(); + } + + /** + * This operation applies changes from the specified Git branch to the configuration database. This is a long running operation and could take several minutes to complete. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param parameters Deploy Configuration parameters. + * @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 deployAsync(String resourceGroupName, String serviceName, DeployConfigurationParameters parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deployWithServiceResponseAsync(resourceGroupName, serviceName, parameters), serviceCallback); + } + + /** + * This operation applies changes from the specified Git branch to the configuration database. This is a long running operation and could take several minutes to complete. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param parameters Deploy Configuration parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable deployAsync(String resourceGroupName, String serviceName, DeployConfigurationParameters parameters) { + return deployWithServiceResponseAsync(resourceGroupName, serviceName, parameters).map(new Func1, OperationResultContractInner>() { + @Override + public OperationResultContractInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * This operation applies changes from the specified Git branch to the configuration database. This is a long running operation and could take several minutes to complete. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param parameters Deploy Configuration parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> deployWithServiceResponseAsync(String resourceGroupName, String serviceName, DeployConfigurationParameters parameters) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(parameters); + final String configurationName = "configuration"; + Observable> observable = service.deploy(resourceGroupName, serviceName, this.client.subscriptionId(), configurationName, parameters, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new LongRunningOperationOptions().withFinalStateVia(LongRunningFinalState.LOCATION), new TypeToken() { }.getType()); + } + + /** + * This operation applies changes from the specified Git branch to the configuration database. This is a long running operation and could take several minutes to complete. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param parameters Deploy Configuration parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the OperationResultContractInner object if successful. + */ + public OperationResultContractInner beginDeploy(String resourceGroupName, String serviceName, DeployConfigurationParameters parameters) { + return beginDeployWithServiceResponseAsync(resourceGroupName, serviceName, parameters).toBlocking().single().body(); + } + + /** + * This operation applies changes from the specified Git branch to the configuration database. This is a long running operation and could take several minutes to complete. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param parameters Deploy Configuration parameters. + * @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 beginDeployAsync(String resourceGroupName, String serviceName, DeployConfigurationParameters parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginDeployWithServiceResponseAsync(resourceGroupName, serviceName, parameters), serviceCallback); + } + + /** + * This operation applies changes from the specified Git branch to the configuration database. This is a long running operation and could take several minutes to complete. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param parameters Deploy Configuration parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the OperationResultContractInner object + */ + public Observable beginDeployAsync(String resourceGroupName, String serviceName, DeployConfigurationParameters parameters) { + return beginDeployWithServiceResponseAsync(resourceGroupName, serviceName, parameters).map(new Func1, OperationResultContractInner>() { + @Override + public OperationResultContractInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * This operation applies changes from the specified Git branch to the configuration database. This is a long running operation and could take several minutes to complete. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param parameters Deploy Configuration parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the OperationResultContractInner object + */ + public Observable> beginDeployWithServiceResponseAsync(String resourceGroupName, String serviceName, DeployConfigurationParameters parameters) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(parameters); + final String configurationName = "configuration"; + return service.beginDeploy(resourceGroupName, serviceName, this.client.subscriptionId(), configurationName, parameters, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginDeployDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginDeployDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(202, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * This operation creates a commit with the current configuration snapshot to the specified branch in the repository. This is a long running operation and could take several minutes to complete. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param parameters Save Configuration parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the OperationResultContractInner object if successful. + */ + public OperationResultContractInner save(String resourceGroupName, String serviceName, SaveConfigurationParameter parameters) { + return saveWithServiceResponseAsync(resourceGroupName, serviceName, parameters).toBlocking().last().body(); + } + + /** + * This operation creates a commit with the current configuration snapshot to the specified branch in the repository. This is a long running operation and could take several minutes to complete. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param parameters Save Configuration parameters. + * @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 saveAsync(String resourceGroupName, String serviceName, SaveConfigurationParameter parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(saveWithServiceResponseAsync(resourceGroupName, serviceName, parameters), serviceCallback); + } + + /** + * This operation creates a commit with the current configuration snapshot to the specified branch in the repository. This is a long running operation and could take several minutes to complete. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param parameters Save Configuration parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable saveAsync(String resourceGroupName, String serviceName, SaveConfigurationParameter parameters) { + return saveWithServiceResponseAsync(resourceGroupName, serviceName, parameters).map(new Func1, OperationResultContractInner>() { + @Override + public OperationResultContractInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * This operation creates a commit with the current configuration snapshot to the specified branch in the repository. This is a long running operation and could take several minutes to complete. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param parameters Save Configuration parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> saveWithServiceResponseAsync(String resourceGroupName, String serviceName, SaveConfigurationParameter parameters) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(parameters); + final String configurationName = "configuration"; + Observable> observable = service.save(resourceGroupName, serviceName, this.client.subscriptionId(), configurationName, parameters, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new LongRunningOperationOptions().withFinalStateVia(LongRunningFinalState.LOCATION), new TypeToken() { }.getType()); + } + + /** + * This operation creates a commit with the current configuration snapshot to the specified branch in the repository. This is a long running operation and could take several minutes to complete. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param parameters Save Configuration parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the OperationResultContractInner object if successful. + */ + public OperationResultContractInner beginSave(String resourceGroupName, String serviceName, SaveConfigurationParameter parameters) { + return beginSaveWithServiceResponseAsync(resourceGroupName, serviceName, parameters).toBlocking().single().body(); + } + + /** + * This operation creates a commit with the current configuration snapshot to the specified branch in the repository. This is a long running operation and could take several minutes to complete. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param parameters Save Configuration parameters. + * @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 beginSaveAsync(String resourceGroupName, String serviceName, SaveConfigurationParameter parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginSaveWithServiceResponseAsync(resourceGroupName, serviceName, parameters), serviceCallback); + } + + /** + * This operation creates a commit with the current configuration snapshot to the specified branch in the repository. This is a long running operation and could take several minutes to complete. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param parameters Save Configuration parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the OperationResultContractInner object + */ + public Observable beginSaveAsync(String resourceGroupName, String serviceName, SaveConfigurationParameter parameters) { + return beginSaveWithServiceResponseAsync(resourceGroupName, serviceName, parameters).map(new Func1, OperationResultContractInner>() { + @Override + public OperationResultContractInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * This operation creates a commit with the current configuration snapshot to the specified branch in the repository. This is a long running operation and could take several minutes to complete. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param parameters Save Configuration parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the OperationResultContractInner object + */ + public Observable> beginSaveWithServiceResponseAsync(String resourceGroupName, String serviceName, SaveConfigurationParameter parameters) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(parameters); + final String configurationName = "configuration"; + return service.beginSave(resourceGroupName, serviceName, this.client.subscriptionId(), configurationName, parameters, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginSaveDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginSaveDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(202, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * This operation validates the changes in the specified Git branch. This is a long running operation and could take several minutes to complete. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param parameters Validate Configuration parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the OperationResultContractInner object if successful. + */ + public OperationResultContractInner validate(String resourceGroupName, String serviceName, DeployConfigurationParameters parameters) { + return validateWithServiceResponseAsync(resourceGroupName, serviceName, parameters).toBlocking().last().body(); + } + + /** + * This operation validates the changes in the specified Git branch. This is a long running operation and could take several minutes to complete. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param parameters Validate Configuration parameters. + * @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 validateAsync(String resourceGroupName, String serviceName, DeployConfigurationParameters parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(validateWithServiceResponseAsync(resourceGroupName, serviceName, parameters), serviceCallback); + } + + /** + * This operation validates the changes in the specified Git branch. This is a long running operation and could take several minutes to complete. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param parameters Validate Configuration parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable validateAsync(String resourceGroupName, String serviceName, DeployConfigurationParameters parameters) { + return validateWithServiceResponseAsync(resourceGroupName, serviceName, parameters).map(new Func1, OperationResultContractInner>() { + @Override + public OperationResultContractInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * This operation validates the changes in the specified Git branch. This is a long running operation and could take several minutes to complete. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param parameters Validate Configuration parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> validateWithServiceResponseAsync(String resourceGroupName, String serviceName, DeployConfigurationParameters parameters) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(parameters); + final String configurationName = "configuration"; + Observable> observable = service.validate(resourceGroupName, serviceName, this.client.subscriptionId(), configurationName, parameters, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new LongRunningOperationOptions().withFinalStateVia(LongRunningFinalState.LOCATION), new TypeToken() { }.getType()); + } + + /** + * This operation validates the changes in the specified Git branch. This is a long running operation and could take several minutes to complete. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param parameters Validate Configuration parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the OperationResultContractInner object if successful. + */ + public OperationResultContractInner beginValidate(String resourceGroupName, String serviceName, DeployConfigurationParameters parameters) { + return beginValidateWithServiceResponseAsync(resourceGroupName, serviceName, parameters).toBlocking().single().body(); + } + + /** + * This operation validates the changes in the specified Git branch. This is a long running operation and could take several minutes to complete. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param parameters Validate Configuration parameters. + * @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 beginValidateAsync(String resourceGroupName, String serviceName, DeployConfigurationParameters parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginValidateWithServiceResponseAsync(resourceGroupName, serviceName, parameters), serviceCallback); + } + + /** + * This operation validates the changes in the specified Git branch. This is a long running operation and could take several minutes to complete. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param parameters Validate Configuration parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the OperationResultContractInner object + */ + public Observable beginValidateAsync(String resourceGroupName, String serviceName, DeployConfigurationParameters parameters) { + return beginValidateWithServiceResponseAsync(resourceGroupName, serviceName, parameters).map(new Func1, OperationResultContractInner>() { + @Override + public OperationResultContractInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * This operation validates the changes in the specified Git branch. This is a long running operation and could take several minutes to complete. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param parameters Validate Configuration parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the OperationResultContractInner object + */ + public Observable> beginValidateWithServiceResponseAsync(String resourceGroupName, String serviceName, DeployConfigurationParameters parameters) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(parameters); + final String configurationName = "configuration"; + return service.beginValidate(resourceGroupName, serviceName, this.client.subscriptionId(), configurationName, parameters, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginValidateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginValidateDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(202, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Gets the status of the most recent synchronization between the configuration database and the Git repository. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the TenantConfigurationSyncStateContractInner object if successful. + */ + public TenantConfigurationSyncStateContractInner getSyncState(String resourceGroupName, String serviceName) { + return getSyncStateWithServiceResponseAsync(resourceGroupName, serviceName).toBlocking().single().body(); + } + + /** + * Gets the status of the most recent synchronization between the configuration database and the Git repository. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @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 getSyncStateAsync(String resourceGroupName, String serviceName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getSyncStateWithServiceResponseAsync(resourceGroupName, serviceName), serviceCallback); + } + + /** + * Gets the status of the most recent synchronization between the configuration database and the Git repository. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the TenantConfigurationSyncStateContractInner object + */ + public Observable getSyncStateAsync(String resourceGroupName, String serviceName) { + return getSyncStateWithServiceResponseAsync(resourceGroupName, serviceName).map(new Func1, TenantConfigurationSyncStateContractInner>() { + @Override + public TenantConfigurationSyncStateContractInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets the status of the most recent synchronization between the configuration database and the Git repository. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the TenantConfigurationSyncStateContractInner object + */ + public Observable> getSyncStateWithServiceResponseAsync(String resourceGroupName, String serviceName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + 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 configurationName = "configuration"; + return service.getSyncState(resourceGroupName, serviceName, this.client.subscriptionId(), configurationName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getSyncStateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getSyncStateDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/UserConfirmationPasswordsImpl.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/UserConfirmationPasswordsImpl.java new file mode 100644 index 0000000000000..daf3d940e2872 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/UserConfirmationPasswordsImpl.java @@ -0,0 +1,34 @@ +/** + * 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. + * abc + */ + +package com.microsoft.azure.management.apimanagement.v2019_01_01.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.apimanagement.v2019_01_01.UserConfirmationPasswords; +import rx.Completable; + +class UserConfirmationPasswordsImpl extends WrapperImpl implements UserConfirmationPasswords { + private final ApiManagementManager manager; + + UserConfirmationPasswordsImpl(ApiManagementManager manager) { + super(manager.inner().userConfirmationPasswords()); + this.manager = manager; + } + + public ApiManagementManager manager() { + return this.manager; + } + + @Override + public Completable sendAsync(String resourceGroupName, String serviceName, String userId) { + UserConfirmationPasswordsInner client = this.inner(); + return client.sendAsync(resourceGroupName, serviceName, userId).toCompletable(); + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/UserConfirmationPasswordsInner.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/UserConfirmationPasswordsInner.java new file mode 100644 index 0000000000000..c43c8c1499a1c --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/UserConfirmationPasswordsInner.java @@ -0,0 +1,152 @@ +/** + * 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.apimanagement.v2019_01_01.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.management.apimanagement.v2019_01_01.ErrorResponseException; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import java.io.IOException; +import okhttp3.ResponseBody; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Path; +import retrofit2.http.POST; +import retrofit2.http.Query; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in UserConfirmationPasswords. + */ +public class UserConfirmationPasswordsInner { + /** The Retrofit service to perform REST calls. */ + private UserConfirmationPasswordsService service; + /** The service client containing this operation class. */ + private ApiManagementClientImpl client; + + /** + * Initializes an instance of UserConfirmationPasswordsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public UserConfirmationPasswordsInner(Retrofit retrofit, ApiManagementClientImpl client) { + this.service = retrofit.create(UserConfirmationPasswordsService.class); + this.client = client; + } + + /** + * The interface defining all the services for UserConfirmationPasswords to be + * used by Retrofit to perform actually REST calls. + */ + interface UserConfirmationPasswordsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.apimanagement.v2019_01_01.UserConfirmationPasswords send" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/users/{userId}/confirmations/password/send") + Observable> send(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("userId") String userId, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Sends confirmation. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param userId User identifier. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void send(String resourceGroupName, String serviceName, String userId) { + sendWithServiceResponseAsync(resourceGroupName, serviceName, userId).toBlocking().single().body(); + } + + /** + * Sends confirmation. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param userId User identifier. Must be unique in the current API Management service instance. + * @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 sendAsync(String resourceGroupName, String serviceName, String userId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(sendWithServiceResponseAsync(resourceGroupName, serviceName, userId), serviceCallback); + } + + /** + * Sends confirmation. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param userId User identifier. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable sendAsync(String resourceGroupName, String serviceName, String userId) { + return sendWithServiceResponseAsync(resourceGroupName, serviceName, userId).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Sends confirmation. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param userId User identifier. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> sendWithServiceResponseAsync(String resourceGroupName, String serviceName, String userId) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (userId == null) { + throw new IllegalArgumentException("Parameter userId is required and cannot be null."); + } + 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.send(resourceGroupName, serviceName, userId, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = sendDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse sendDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(204, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/UserContractImpl.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/UserContractImpl.java new file mode 100644 index 0000000000000..1db45ee88e2ba --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/UserContractImpl.java @@ -0,0 +1,235 @@ +/** + * 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.apimanagement.v2019_01_01.implementation; + +import com.microsoft.azure.management.apimanagement.v2019_01_01.UserContract; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import com.microsoft.azure.management.apimanagement.v2019_01_01.UserCreateParameters; +import java.util.List; +import com.microsoft.azure.management.apimanagement.v2019_01_01.GroupContractProperties; +import java.util.ArrayList; +import com.microsoft.azure.management.apimanagement.v2019_01_01.UserIdentityContract; +import org.joda.time.DateTime; +import com.microsoft.azure.management.apimanagement.v2019_01_01.UserState; +import com.microsoft.azure.management.apimanagement.v2019_01_01.Confirmation; +import rx.functions.Func1; + +class UserContractImpl extends CreatableUpdatableImpl implements UserContract, UserContract.Definition, UserContract.Update { + private String resourceGroupName; + private String serviceName; + private String userId; + private String cifMatch; + private String uifMatch; + private UserCreateParameters createOrUpdateParameter; + private final ApiManagementManager manager; + + UserContractImpl(String name, ApiManagementManager manager) { + super(name, new UserContractInner()); + this.manager = manager; + // Set resource name + this.userId = name; + // + this.createOrUpdateParameter = new UserCreateParameters(); + } + + UserContractImpl(UserContractInner inner, ApiManagementManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.userId = inner.name(); + // set resource ancestor and positional variables + this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourceGroups"); + this.serviceName = IdParsingUtils.getValueFromIdByName(inner.id(), "service"); + this.userId = IdParsingUtils.getValueFromIdByName(inner.id(), "users"); + // set other parameters for create and update + this.createOrUpdateParameter = new UserCreateParameters(); + } + + @Override + public ApiManagementManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + UsersInner client = this.manager().inner().users(); + return client.createOrUpdateAsync(this.resourceGroupName, this.serviceName, this.userId, this.createOrUpdateParameter, this.cifMatch) + .map(new Func1() { + @Override + public UserContractInner call(UserContractInner resource) { + resetCreateUpdateParameters(); + return resource; + } + }) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + UsersInner client = this.manager().inner().users(); + return client.createOrUpdateAsync(this.resourceGroupName, this.serviceName, this.userId, this.createOrUpdateParameter, this.uifMatch) + .map(new Func1() { + @Override + public UserContractInner call(UserContractInner resource) { + resetCreateUpdateParameters(); + return resource; + } + }) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + UsersInner client = this.manager().inner().users(); + return null; // NOP getInnerAsync implementation as get is not supported + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + private void resetCreateUpdateParameters() { + this.createOrUpdateParameter = new UserCreateParameters(); + } + + @Override + public String email() { + return this.inner().email(); + } + + @Override + public String firstName() { + return this.inner().firstName(); + } + + @Override + public List groups() { + return this.inner().groups(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public List identities() { + List lst = new ArrayList(); + if (this.inner().identities() != null) { + for (UserIdentityContractInner inner : this.inner().identities()) { + lst.add( new UserIdentityContractImpl(inner, manager())); + } + } + return lst; + } + + @Override + public String lastName() { + return this.inner().lastName(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public String note() { + return this.inner().note(); + } + + @Override + public DateTime registrationDate() { + return this.inner().registrationDate(); + } + + @Override + public UserState state() { + return this.inner().state(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public UserContractImpl withResourceGroupName(String resourceGroupName) { + this.resourceGroupName = resourceGroupName; + return this; + } + + @Override + public UserContractImpl withServiceName(String serviceName) { + this.serviceName = serviceName; + return this; + } + + @Override + public UserContractImpl withEmail(String email) { + this.createOrUpdateParameter.withEmail(email); + return this; + } + + @Override + public UserContractImpl withFirstName(String firstName) { + this.createOrUpdateParameter.withFirstName(firstName); + return this; + } + + @Override + public UserContractImpl withLastName(String lastName) { + this.createOrUpdateParameter.withLastName(lastName); + return this; + } + + @Override + public UserContractImpl withIfMatch(String ifMatch) { + if (isInCreateMode()) { + this.cifMatch = ifMatch; + } else { + this.uifMatch = ifMatch; + } + return this; + } + + @Override + public UserContractImpl withConfirmation(Confirmation confirmation) { + this.createOrUpdateParameter.withConfirmation(confirmation); + return this; + } + + @Override + public UserContractImpl withIdentities(List identities) { + this.createOrUpdateParameter.withIdentities(identities); + return this; + } + + @Override + public UserContractImpl withNote(String note) { + this.createOrUpdateParameter.withNote(note); + return this; + } + + @Override + public UserContractImpl withPassword(String password) { + this.createOrUpdateParameter.withPassword(password); + return this; + } + + @Override + public UserContractImpl withState(UserState state) { + this.createOrUpdateParameter.withState(state); + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/UserContractInner.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/UserContractInner.java new file mode 100644 index 0000000000000..ab0b2e6e50349 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/UserContractInner.java @@ -0,0 +1,225 @@ +/** + * 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.apimanagement.v2019_01_01.implementation; + +import com.microsoft.azure.management.apimanagement.v2019_01_01.UserState; +import java.util.List; +import org.joda.time.DateTime; +import com.microsoft.azure.management.apimanagement.v2019_01_01.GroupContractProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * User details. + */ +@JsonFlatten +public class UserContractInner extends ProxyResource { + /** + * Account state. Specifies whether the user is active or not. Blocked + * users are unable to sign into the developer portal or call any APIs of + * subscribed products. Default state is Active. Possible values include: + * 'active', 'blocked', 'pending', 'deleted'. + */ + @JsonProperty(value = "properties.state") + private UserState state; + + /** + * Optional note about a user set by the administrator. + */ + @JsonProperty(value = "properties.note") + private String note; + + /** + * Collection of user identities. + */ + @JsonProperty(value = "properties.identities") + private List identities; + + /** + * First name. + */ + @JsonProperty(value = "properties.firstName") + private String firstName; + + /** + * Last name. + */ + @JsonProperty(value = "properties.lastName") + private String lastName; + + /** + * Email address. + */ + @JsonProperty(value = "properties.email") + private String email; + + /** + * Date of user registration. The date conforms to the following format: + * `yyyy-MM-ddTHH:mm:ssZ` as specified by the ISO 8601 standard. + */ + @JsonProperty(value = "properties.registrationDate") + private DateTime registrationDate; + + /** + * Collection of groups user is part of. + */ + @JsonProperty(value = "properties.groups", access = JsonProperty.Access.WRITE_ONLY) + private List groups; + + /** + * Get account state. Specifies whether the user is active or not. Blocked users are unable to sign into the developer portal or call any APIs of subscribed products. Default state is Active. Possible values include: 'active', 'blocked', 'pending', 'deleted'. + * + * @return the state value + */ + public UserState state() { + return this.state; + } + + /** + * Set account state. Specifies whether the user is active or not. Blocked users are unable to sign into the developer portal or call any APIs of subscribed products. Default state is Active. Possible values include: 'active', 'blocked', 'pending', 'deleted'. + * + * @param state the state value to set + * @return the UserContractInner object itself. + */ + public UserContractInner withState(UserState state) { + this.state = state; + return this; + } + + /** + * Get optional note about a user set by the administrator. + * + * @return the note value + */ + public String note() { + return this.note; + } + + /** + * Set optional note about a user set by the administrator. + * + * @param note the note value to set + * @return the UserContractInner object itself. + */ + public UserContractInner withNote(String note) { + this.note = note; + return this; + } + + /** + * Get collection of user identities. + * + * @return the identities value + */ + public List identities() { + return this.identities; + } + + /** + * Set collection of user identities. + * + * @param identities the identities value to set + * @return the UserContractInner object itself. + */ + public UserContractInner withIdentities(List identities) { + this.identities = identities; + return this; + } + + /** + * Get first name. + * + * @return the firstName value + */ + public String firstName() { + return this.firstName; + } + + /** + * Set first name. + * + * @param firstName the firstName value to set + * @return the UserContractInner object itself. + */ + public UserContractInner withFirstName(String firstName) { + this.firstName = firstName; + return this; + } + + /** + * Get last name. + * + * @return the lastName value + */ + public String lastName() { + return this.lastName; + } + + /** + * Set last name. + * + * @param lastName the lastName value to set + * @return the UserContractInner object itself. + */ + public UserContractInner withLastName(String lastName) { + this.lastName = lastName; + return this; + } + + /** + * Get email address. + * + * @return the email value + */ + public String email() { + return this.email; + } + + /** + * Set email address. + * + * @param email the email value to set + * @return the UserContractInner object itself. + */ + public UserContractInner withEmail(String email) { + this.email = email; + return this; + } + + /** + * Get date of user registration. The date conforms to the following format: `yyyy-MM-ddTHH:mm:ssZ` as specified by the ISO 8601 standard. + * + * @return the registrationDate value + */ + public DateTime registrationDate() { + return this.registrationDate; + } + + /** + * Set date of user registration. The date conforms to the following format: `yyyy-MM-ddTHH:mm:ssZ` as specified by the ISO 8601 standard. + * + * @param registrationDate the registrationDate value to set + * @return the UserContractInner object itself. + */ + public UserContractInner withRegistrationDate(DateTime registrationDate) { + this.registrationDate = registrationDate; + return this; + } + + /** + * Get collection of groups user is part of. + * + * @return the groups value + */ + public List groups() { + return this.groups; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/UserGroupContractImpl.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/UserGroupContractImpl.java new file mode 100644 index 0000000000000..d90d7b41c447d --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/UserGroupContractImpl.java @@ -0,0 +1,71 @@ +/** + * 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.apimanagement.v2019_01_01.implementation; + +import com.microsoft.azure.management.apimanagement.v2019_01_01.UserGroupContract; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import rx.Observable; +import com.microsoft.azure.management.apimanagement.v2019_01_01.GroupType; + +class UserGroupContractImpl extends WrapperImpl implements UserGroupContract { + private final ApiManagementManager manager; + + UserGroupContractImpl(GroupContractInner inner, ApiManagementManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public ApiManagementManager manager() { + return this.manager; + } + + + + @Override + public Boolean builtIn() { + return this.inner().builtIn(); + } + + @Override + public String description() { + return this.inner().description(); + } + + @Override + public String displayName() { + return this.inner().displayName(); + } + + @Override + public String externalId() { + return this.inner().externalId(); + } + + @Override + public GroupType groupContractType() { + return this.inner().groupContractType(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public String type() { + return this.inner().type(); + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/UserGroupsImpl.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/UserGroupsImpl.java new file mode 100644 index 0000000000000..f030639ca574f --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/UserGroupsImpl.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.apimanagement.v2019_01_01.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.apimanagement.v2019_01_01.UserGroups; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.apimanagement.v2019_01_01.UserGroupContract; + +class UserGroupsImpl extends WrapperImpl implements UserGroups { + private final ApiManagementManager manager; + + UserGroupsImpl(ApiManagementManager manager) { + super(manager.inner().userGroups()); + this.manager = manager; + } + + public ApiManagementManager manager() { + return this.manager; + } + + private UserGroupContractImpl wrapModel(GroupContractInner inner) { + return new UserGroupContractImpl(inner, manager()); + } + + @Override + public Observable listAsync(final String resourceGroupName, final String serviceName, final String userId) { + UserGroupsInner client = this.inner(); + return client.listAsync(resourceGroupName, serviceName, userId) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public UserGroupContract call(GroupContractInner inner) { + return wrapModel(inner); + } + }); + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/UserGroupsInner.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/UserGroupsInner.java new file mode 100644 index 0000000000000..77f8e41dba622 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/UserGroupsInner.java @@ -0,0 +1,453 @@ +/** + * 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.apimanagement.v2019_01_01.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.apimanagement.v2019_01_01.ErrorResponseException; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Path; +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 UserGroups. + */ +public class UserGroupsInner { + /** The Retrofit service to perform REST calls. */ + private UserGroupsService service; + /** The service client containing this operation class. */ + private ApiManagementClientImpl client; + + /** + * Initializes an instance of UserGroupsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public UserGroupsInner(Retrofit retrofit, ApiManagementClientImpl client) { + this.service = retrofit.create(UserGroupsService.class); + this.client = client; + } + + /** + * The interface defining all the services for UserGroups to be + * used by Retrofit to perform actually REST calls. + */ + interface UserGroupsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.apimanagement.v2019_01_01.UserGroups list" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/users/{userId}/groups") + Observable> list(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("userId") String userId, @Path("subscriptionId") String subscriptionId, @Query("$filter") String filter, @Query("$top") Integer top, @Query("$skip") Integer skip, @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.apimanagement.v2019_01_01.UserGroups listNext" }) + @GET + Observable> listNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Lists all user groups. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param userId User identifier. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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<GroupContractInner> object if successful. + */ + public PagedList list(final String resourceGroupName, final String serviceName, final String userId) { + ServiceResponse> response = listSinglePageAsync(resourceGroupName, serviceName, userId).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists all user groups. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param userId User identifier. Must be unique in the current API Management service instance. + * @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 resourceGroupName, final String serviceName, final String userId, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(resourceGroupName, serviceName, userId), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists all user groups. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param userId User identifier. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<GroupContractInner> object + */ + public Observable> listAsync(final String resourceGroupName, final String serviceName, final String userId) { + return listWithServiceResponseAsync(resourceGroupName, serviceName, userId) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all user groups. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param userId User identifier. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<GroupContractInner> object + */ + public Observable>> listWithServiceResponseAsync(final String resourceGroupName, final String serviceName, final String userId) { + return listSinglePageAsync(resourceGroupName, serviceName, userId) + .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 all user groups. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param userId User identifier. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<GroupContractInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync(final String resourceGroupName, final String serviceName, final String userId) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (userId == null) { + throw new IllegalArgumentException("Parameter userId is required and cannot be null."); + } + 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 filter = null; + final Integer top = null; + final Integer skip = null; + return service.list(resourceGroupName, serviceName, userId, this.client.subscriptionId(), filter, top, skip, this.client.apiVersion(), 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 all user groups. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param userId User identifier. Must be unique in the current API Management service instance. + * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br> + * @param top Number of records to return. + * @param skip Number of records to skip. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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<GroupContractInner> object if successful. + */ + public PagedList list(final String resourceGroupName, final String serviceName, final String userId, final String filter, final Integer top, final Integer skip) { + ServiceResponse> response = listSinglePageAsync(resourceGroupName, serviceName, userId, filter, top, skip).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists all user groups. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param userId User identifier. Must be unique in the current API Management service instance. + * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br> + * @param top Number of records to return. + * @param skip Number of records to skip. + * @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 resourceGroupName, final String serviceName, final String userId, final String filter, final Integer top, final Integer skip, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(resourceGroupName, serviceName, userId, filter, top, skip), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists all user groups. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param userId User identifier. Must be unique in the current API Management service instance. + * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br> + * @param top Number of records to return. + * @param skip Number of records to skip. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<GroupContractInner> object + */ + public Observable> listAsync(final String resourceGroupName, final String serviceName, final String userId, final String filter, final Integer top, final Integer skip) { + return listWithServiceResponseAsync(resourceGroupName, serviceName, userId, filter, top, skip) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all user groups. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param userId User identifier. Must be unique in the current API Management service instance. + * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br> + * @param top Number of records to return. + * @param skip Number of records to skip. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<GroupContractInner> object + */ + public Observable>> listWithServiceResponseAsync(final String resourceGroupName, final String serviceName, final String userId, final String filter, final Integer top, final Integer skip) { + return listSinglePageAsync(resourceGroupName, serviceName, userId, filter, top, skip) + .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 all user groups. + * + ServiceResponse> * @param resourceGroupName The name of the resource group. + ServiceResponse> * @param serviceName The name of the API Management service. + ServiceResponse> * @param userId User identifier. Must be unique in the current API Management service instance. + ServiceResponse> * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br> + ServiceResponse> * @param top Number of records to return. + ServiceResponse> * @param skip Number of records to skip. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<GroupContractInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync(final String resourceGroupName, final String serviceName, final String userId, final String filter, final Integer top, final Integer skip) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (userId == null) { + throw new IllegalArgumentException("Parameter userId is required and cannot be null."); + } + 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(resourceGroupName, serviceName, userId, this.client.subscriptionId(), filter, top, skip, this.client.apiVersion(), 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 ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists all user groups. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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<GroupContractInner> 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 all user groups. + * + * @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 all user groups. + * + * @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<GroupContractInner> object + */ + public Observable> listNextAsync(final String nextPageLink) { + return listNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all user groups. + * + * @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<GroupContractInner> 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 all user groups. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<GroupContractInner> 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 ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/UserIdentitiesImpl.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/UserIdentitiesImpl.java new file mode 100644 index 0000000000000..240b0b2921d34 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/UserIdentitiesImpl.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.apimanagement.v2019_01_01.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.apimanagement.v2019_01_01.UserIdentities; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.apimanagement.v2019_01_01.UserIdentityContract; + +class UserIdentitiesImpl extends WrapperImpl implements UserIdentities { + private final ApiManagementManager manager; + + UserIdentitiesImpl(ApiManagementManager manager) { + super(manager.inner().userIdentities()); + this.manager = manager; + } + + public ApiManagementManager manager() { + return this.manager; + } + + private UserIdentityContractImpl wrapModel(UserIdentityContractInner inner) { + return new UserIdentityContractImpl(inner, manager()); + } + + @Override + public Observable listAsync(final String resourceGroupName, final String serviceName, final String userId) { + UserIdentitiesInner client = this.inner(); + return client.listAsync(resourceGroupName, serviceName, userId) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public UserIdentityContract call(UserIdentityContractInner inner) { + return wrapModel(inner); + } + }); + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/UserIdentitiesInner.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/UserIdentitiesInner.java new file mode 100644 index 0000000000000..e3c429987b5bd --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/UserIdentitiesInner.java @@ -0,0 +1,311 @@ +/** + * 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.apimanagement.v2019_01_01.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.apimanagement.v2019_01_01.ErrorResponseException; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Path; +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 UserIdentities. + */ +public class UserIdentitiesInner { + /** The Retrofit service to perform REST calls. */ + private UserIdentitiesService service; + /** The service client containing this operation class. */ + private ApiManagementClientImpl client; + + /** + * Initializes an instance of UserIdentitiesInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public UserIdentitiesInner(Retrofit retrofit, ApiManagementClientImpl client) { + this.service = retrofit.create(UserIdentitiesService.class); + this.client = client; + } + + /** + * The interface defining all the services for UserIdentities to be + * used by Retrofit to perform actually REST calls. + */ + interface UserIdentitiesService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.apimanagement.v2019_01_01.UserIdentities list" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/users/{userId}/identities") + Observable> list(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("userId") String userId, @Path("subscriptionId") String subscriptionId, @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.apimanagement.v2019_01_01.UserIdentities listNext" }) + @GET + Observable> listNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * List of all user identities. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param userId User identifier. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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<UserIdentityContractInner> object if successful. + */ + public PagedList list(final String resourceGroupName, final String serviceName, final String userId) { + ServiceResponse> response = listSinglePageAsync(resourceGroupName, serviceName, userId).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * List of all user identities. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param userId User identifier. Must be unique in the current API Management service instance. + * @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 resourceGroupName, final String serviceName, final String userId, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(resourceGroupName, serviceName, userId), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * List of all user identities. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param userId User identifier. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<UserIdentityContractInner> object + */ + public Observable> listAsync(final String resourceGroupName, final String serviceName, final String userId) { + return listWithServiceResponseAsync(resourceGroupName, serviceName, userId) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * List of all user identities. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param userId User identifier. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<UserIdentityContractInner> object + */ + public Observable>> listWithServiceResponseAsync(final String resourceGroupName, final String serviceName, final String userId) { + return listSinglePageAsync(resourceGroupName, serviceName, userId) + .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)); + } + }); + } + + /** + * List of all user identities. + * + ServiceResponse> * @param resourceGroupName The name of the resource group. + ServiceResponse> * @param serviceName The name of the API Management service. + ServiceResponse> * @param userId User identifier. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<UserIdentityContractInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync(final String resourceGroupName, final String serviceName, final String userId) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (userId == null) { + throw new IllegalArgumentException("Parameter userId is required and cannot be null."); + } + 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(resourceGroupName, serviceName, userId, this.client.subscriptionId(), this.client.apiVersion(), 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 ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * List of all user identities. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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<UserIdentityContractInner> 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(); + } + }; + } + + /** + * List of all user identities. + * + * @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); + } + + /** + * List of all user identities. + * + * @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<UserIdentityContractInner> object + */ + public Observable> listNextAsync(final String nextPageLink) { + return listNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * List of all user identities. + * + * @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<UserIdentityContractInner> 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)); + } + }); + } + + /** + * List of all user identities. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<UserIdentityContractInner> 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 ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/UserIdentityContractImpl.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/UserIdentityContractImpl.java new file mode 100644 index 0000000000000..68685de557773 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/UserIdentityContractImpl.java @@ -0,0 +1,40 @@ +/** + * 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.apimanagement.v2019_01_01.implementation; + +import com.microsoft.azure.management.apimanagement.v2019_01_01.UserIdentityContract; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import rx.Observable; + +class UserIdentityContractImpl extends WrapperImpl implements UserIdentityContract { + private final ApiManagementManager manager; + + UserIdentityContractImpl(UserIdentityContractInner inner, ApiManagementManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public ApiManagementManager manager() { + return this.manager; + } + + + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String provider() { + return this.inner().provider(); + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/UserIdentityContractInner.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/UserIdentityContractInner.java new file mode 100644 index 0000000000000..d3c070c073209 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/UserIdentityContractInner.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.apimanagement.v2019_01_01.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * User identity details. + */ +public class UserIdentityContractInner { + /** + * Identity provider name. + */ + @JsonProperty(value = "provider") + private String provider; + + /** + * Identifier value within provider. + */ + @JsonProperty(value = "id") + private String id; + + /** + * Get identity provider name. + * + * @return the provider value + */ + public String provider() { + return this.provider; + } + + /** + * Set identity provider name. + * + * @param provider the provider value to set + * @return the UserIdentityContractInner object itself. + */ + public UserIdentityContractInner withProvider(String provider) { + this.provider = provider; + return this; + } + + /** + * Get identifier value within provider. + * + * @return the id value + */ + public String id() { + return this.id; + } + + /** + * Set identifier value within provider. + * + * @param id the id value to set + * @return the UserIdentityContractInner object itself. + */ + public UserIdentityContractInner withId(String id) { + this.id = id; + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/UserSubscriptionContractImpl.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/UserSubscriptionContractImpl.java new file mode 100644 index 0000000000000..e8a6c45faf75b --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/UserSubscriptionContractImpl.java @@ -0,0 +1,112 @@ +/** + * 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.apimanagement.v2019_01_01.implementation; + +import com.microsoft.azure.management.apimanagement.v2019_01_01.UserSubscriptionContract; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import rx.Observable; +import org.joda.time.DateTime; +import com.microsoft.azure.management.apimanagement.v2019_01_01.SubscriptionState; + +class UserSubscriptionContractImpl extends WrapperImpl implements UserSubscriptionContract { + private final ApiManagementManager manager; + + UserSubscriptionContractImpl(SubscriptionContractInner inner, ApiManagementManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public ApiManagementManager manager() { + return this.manager; + } + + + + @Override + public Boolean allowTracing() { + return this.inner().allowTracing(); + } + + @Override + public DateTime createdDate() { + return this.inner().createdDate(); + } + + @Override + public String displayName() { + return this.inner().displayName(); + } + + @Override + public DateTime endDate() { + return this.inner().endDate(); + } + + @Override + public DateTime expirationDate() { + return this.inner().expirationDate(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public DateTime notificationDate() { + return this.inner().notificationDate(); + } + + @Override + public String ownerId() { + return this.inner().ownerId(); + } + + @Override + public String primaryKey() { + return this.inner().primaryKey(); + } + + @Override + public String scope() { + return this.inner().scope(); + } + + @Override + public String secondaryKey() { + return this.inner().secondaryKey(); + } + + @Override + public DateTime startDate() { + return this.inner().startDate(); + } + + @Override + public SubscriptionState state() { + return this.inner().state(); + } + + @Override + public String stateComment() { + return this.inner().stateComment(); + } + + @Override + public String type() { + return this.inner().type(); + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/UserSubscriptionsImpl.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/UserSubscriptionsImpl.java new file mode 100644 index 0000000000000..74afe14fcc425 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/UserSubscriptionsImpl.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.apimanagement.v2019_01_01.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.apimanagement.v2019_01_01.UserSubscriptions; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.apimanagement.v2019_01_01.UserSubscriptionContract; + +class UserSubscriptionsImpl extends WrapperImpl implements UserSubscriptions { + private final ApiManagementManager manager; + + UserSubscriptionsImpl(ApiManagementManager manager) { + super(manager.inner().userSubscriptions()); + this.manager = manager; + } + + public ApiManagementManager manager() { + return this.manager; + } + + private UserSubscriptionContractImpl wrapModel(SubscriptionContractInner inner) { + return new UserSubscriptionContractImpl(inner, manager()); + } + + @Override + public Observable listAsync(final String resourceGroupName, final String serviceName, final String userId) { + UserSubscriptionsInner client = this.inner(); + return client.listAsync(resourceGroupName, serviceName, userId) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public UserSubscriptionContract call(SubscriptionContractInner inner) { + return wrapModel(inner); + } + }); + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/UserSubscriptionsInner.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/UserSubscriptionsInner.java new file mode 100644 index 0000000000000..f37d7e947aef8 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/UserSubscriptionsInner.java @@ -0,0 +1,453 @@ +/** + * 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.apimanagement.v2019_01_01.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.apimanagement.v2019_01_01.ErrorResponseException; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Path; +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 UserSubscriptions. + */ +public class UserSubscriptionsInner { + /** The Retrofit service to perform REST calls. */ + private UserSubscriptionsService service; + /** The service client containing this operation class. */ + private ApiManagementClientImpl client; + + /** + * Initializes an instance of UserSubscriptionsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public UserSubscriptionsInner(Retrofit retrofit, ApiManagementClientImpl client) { + this.service = retrofit.create(UserSubscriptionsService.class); + this.client = client; + } + + /** + * The interface defining all the services for UserSubscriptions to be + * used by Retrofit to perform actually REST calls. + */ + interface UserSubscriptionsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.apimanagement.v2019_01_01.UserSubscriptions list" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/users/{userId}/subscriptions") + Observable> list(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("userId") String userId, @Path("subscriptionId") String subscriptionId, @Query("$filter") String filter, @Query("$top") Integer top, @Query("$skip") Integer skip, @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.apimanagement.v2019_01_01.UserSubscriptions listNext" }) + @GET + Observable> listNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Lists the collection of subscriptions of the specified user. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param userId User identifier. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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<SubscriptionContractInner> object if successful. + */ + public PagedList list(final String resourceGroupName, final String serviceName, final String userId) { + ServiceResponse> response = listSinglePageAsync(resourceGroupName, serviceName, userId).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the collection of subscriptions of the specified user. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param userId User identifier. Must be unique in the current API Management service instance. + * @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 resourceGroupName, final String serviceName, final String userId, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(resourceGroupName, serviceName, userId), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the collection of subscriptions of the specified user. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param userId User identifier. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<SubscriptionContractInner> object + */ + public Observable> listAsync(final String resourceGroupName, final String serviceName, final String userId) { + return listWithServiceResponseAsync(resourceGroupName, serviceName, userId) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the collection of subscriptions of the specified user. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param userId User identifier. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<SubscriptionContractInner> object + */ + public Observable>> listWithServiceResponseAsync(final String resourceGroupName, final String serviceName, final String userId) { + return listSinglePageAsync(resourceGroupName, serviceName, userId) + .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 collection of subscriptions of the specified user. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param userId User identifier. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<SubscriptionContractInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync(final String resourceGroupName, final String serviceName, final String userId) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (userId == null) { + throw new IllegalArgumentException("Parameter userId is required and cannot be null."); + } + 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 filter = null; + final Integer top = null; + final Integer skip = null; + return service.list(resourceGroupName, serviceName, userId, this.client.subscriptionId(), filter, top, skip, this.client.apiVersion(), 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 collection of subscriptions of the specified user. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param userId User identifier. Must be unique in the current API Management service instance. + * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| stateComment | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| ownerId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| scope | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| userId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| productId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br> + * @param top Number of records to return. + * @param skip Number of records to skip. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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<SubscriptionContractInner> object if successful. + */ + public PagedList list(final String resourceGroupName, final String serviceName, final String userId, final String filter, final Integer top, final Integer skip) { + ServiceResponse> response = listSinglePageAsync(resourceGroupName, serviceName, userId, filter, top, skip).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the collection of subscriptions of the specified user. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param userId User identifier. Must be unique in the current API Management service instance. + * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| stateComment | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| ownerId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| scope | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| userId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| productId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br> + * @param top Number of records to return. + * @param skip Number of records to skip. + * @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 resourceGroupName, final String serviceName, final String userId, final String filter, final Integer top, final Integer skip, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(resourceGroupName, serviceName, userId, filter, top, skip), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the collection of subscriptions of the specified user. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param userId User identifier. Must be unique in the current API Management service instance. + * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| stateComment | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| ownerId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| scope | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| userId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| productId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br> + * @param top Number of records to return. + * @param skip Number of records to skip. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<SubscriptionContractInner> object + */ + public Observable> listAsync(final String resourceGroupName, final String serviceName, final String userId, final String filter, final Integer top, final Integer skip) { + return listWithServiceResponseAsync(resourceGroupName, serviceName, userId, filter, top, skip) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the collection of subscriptions of the specified user. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param userId User identifier. Must be unique in the current API Management service instance. + * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| stateComment | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| ownerId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| scope | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| userId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| productId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br> + * @param top Number of records to return. + * @param skip Number of records to skip. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<SubscriptionContractInner> object + */ + public Observable>> listWithServiceResponseAsync(final String resourceGroupName, final String serviceName, final String userId, final String filter, final Integer top, final Integer skip) { + return listSinglePageAsync(resourceGroupName, serviceName, userId, filter, top, skip) + .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 collection of subscriptions of the specified user. + * + ServiceResponse> * @param resourceGroupName The name of the resource group. + ServiceResponse> * @param serviceName The name of the API Management service. + ServiceResponse> * @param userId User identifier. Must be unique in the current API Management service instance. + ServiceResponse> * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| stateComment | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| ownerId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| scope | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| userId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| productId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br> + ServiceResponse> * @param top Number of records to return. + ServiceResponse> * @param skip Number of records to skip. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<SubscriptionContractInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync(final String resourceGroupName, final String serviceName, final String userId, final String filter, final Integer top, final Integer skip) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (userId == null) { + throw new IllegalArgumentException("Parameter userId is required and cannot be null."); + } + 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(resourceGroupName, serviceName, userId, this.client.subscriptionId(), filter, top, skip, this.client.apiVersion(), 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 ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists the collection of subscriptions of the specified user. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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<SubscriptionContractInner> 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 collection of subscriptions of the specified user. + * + * @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 collection of subscriptions of the specified user. + * + * @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<SubscriptionContractInner> 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 collection of subscriptions of the specified user. + * + * @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<SubscriptionContractInner> 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 collection of subscriptions of the specified user. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<SubscriptionContractInner> 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 ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/UserTokenResultImpl.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/UserTokenResultImpl.java new file mode 100644 index 0000000000000..124045dd0ffbc --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/UserTokenResultImpl.java @@ -0,0 +1,31 @@ +/** + * 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.apimanagement.v2019_01_01.implementation; + +import com.microsoft.azure.management.apimanagement.v2019_01_01.UserTokenResult; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; + +class UserTokenResultImpl extends WrapperImpl implements UserTokenResult { + private final ApiManagementManager manager; + UserTokenResultImpl(UserTokenResultInner inner, ApiManagementManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public ApiManagementManager manager() { + return this.manager; + } + + @Override + public String value() { + return this.inner().value(); + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/UserTokenResultInner.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/UserTokenResultInner.java new file mode 100644 index 0000000000000..3a0a5328e43c0 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/UserTokenResultInner.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.apimanagement.v2019_01_01.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Get User Token response details. + */ +public class UserTokenResultInner { + /** + * Shared Access Authorization token for the User. + */ + @JsonProperty(value = "value") + private String value; + + /** + * Get shared Access Authorization token for the User. + * + * @return the value value + */ + public String value() { + return this.value; + } + + /** + * Set shared Access Authorization token for the User. + * + * @param value the value value to set + * @return the UserTokenResultInner object itself. + */ + public UserTokenResultInner withValue(String value) { + this.value = value; + return this; + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/UsersImpl.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/UsersImpl.java new file mode 100644 index 0000000000000..422c4c2ca7c15 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/UsersImpl.java @@ -0,0 +1,114 @@ +/** + * 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. + * jkl + */ + +package com.microsoft.azure.management.apimanagement.v2019_01_01.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.apimanagement.v2019_01_01.Users; +import rx.Completable; +import rx.functions.Func1; +import rx.Observable; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.apimanagement.v2019_01_01.GroupUserContract; +import com.microsoft.azure.management.apimanagement.v2019_01_01.GenerateSsoUrlResult; +import com.microsoft.azure.management.apimanagement.v2019_01_01.UserTokenResult; +import com.microsoft.azure.management.apimanagement.v2019_01_01.UserTokenParameters; + +class UsersImpl extends WrapperImpl implements Users { + private final ApiManagementManager manager; + + UsersImpl(ApiManagementManager manager) { + super(manager.inner().users()); + this.manager = manager; + } + + public ApiManagementManager manager() { + return this.manager; + } + + @Override + public UserContractImpl define(String name) { + return wrapModel(name); + } + + private UserContractImpl wrapModel(UserContractInner inner) { + return new UserContractImpl(inner, manager()); + } + + private UserContractImpl wrapModel(String name) { + return new UserContractImpl(name, this.manager()); + } + + @Override + public Observable listByServiceAsync(final String resourceGroupName, final String serviceName) { + UsersInner client = this.inner(); + return client.listByServiceAsync(resourceGroupName, serviceName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public GroupUserContract call(UserContractInner inner) { + return new GroupUserContractImpl(inner, manager()); + } + }); + } + + @Override + public Completable getEntityTagAsync(String resourceGroupName, String serviceName, String userId) { + UsersInner client = this.inner(); + return client.getEntityTagAsync(resourceGroupName, serviceName, userId).toCompletable(); + } + + @Override + public Observable getAsync(String resourceGroupName, String serviceName, String userId) { + UsersInner client = this.inner(); + return client.getAsync(resourceGroupName, serviceName, userId) + .map(new Func1() { + @Override + public GroupUserContract call(UserContractInner inner) { + return new GroupUserContractImpl(inner, manager()); + } + }); + } + + @Override + public Completable deleteAsync(String resourceGroupName, String serviceName, String userId, String ifMatch) { + UsersInner client = this.inner(); + return client.deleteAsync(resourceGroupName, serviceName, userId, ifMatch).toCompletable(); + } + + @Override + public Observable generateSsoUrlAsync(String resourceGroupName, String serviceName, String userId) { + UsersInner client = this.inner(); + return client.generateSsoUrlAsync(resourceGroupName, serviceName, userId) + .map(new Func1() { + @Override + public GenerateSsoUrlResult call(GenerateSsoUrlResultInner inner) { + return new GenerateSsoUrlResultImpl(inner, manager()); + } + }); + } + + @Override + public Observable getSharedAccessTokenAsync(String resourceGroupName, String serviceName, String userId, UserTokenParameters parameters) { + UsersInner client = this.inner(); + return client.getSharedAccessTokenAsync(resourceGroupName, serviceName, userId, parameters) + .map(new Func1() { + @Override + public UserTokenResult call(UserTokenResultInner inner) { + return new UserTokenResultImpl(inner, manager()); + } + }); + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/UsersInner.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/UsersInner.java new file mode 100644 index 0000000000000..9cfc4f2654091 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/UsersInner.java @@ -0,0 +1,1375 @@ +/** + * 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.apimanagement.v2019_01_01.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.apimanagement.v2019_01_01.ErrorResponseException; +import com.microsoft.azure.management.apimanagement.v2019_01_01.UserCreateOrUpdateHeaders; +import com.microsoft.azure.management.apimanagement.v2019_01_01.UserCreateParameters; +import com.microsoft.azure.management.apimanagement.v2019_01_01.UserGetEntityTagHeaders; +import com.microsoft.azure.management.apimanagement.v2019_01_01.UserGetHeaders; +import com.microsoft.azure.management.apimanagement.v2019_01_01.UserTokenParameters; +import com.microsoft.azure.management.apimanagement.v2019_01_01.UserUpdateParameters; +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.ServiceResponseWithHeaders; +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.HEAD; +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 Users. + */ +public class UsersInner { + /** The Retrofit service to perform REST calls. */ + private UsersService service; + /** The service client containing this operation class. */ + private ApiManagementClientImpl client; + + /** + * Initializes an instance of UsersInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public UsersInner(Retrofit retrofit, ApiManagementClientImpl client) { + this.service = retrofit.create(UsersService.class); + this.client = client; + } + + /** + * The interface defining all the services for Users to be + * used by Retrofit to perform actually REST calls. + */ + interface UsersService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.apimanagement.v2019_01_01.Users listByService" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/users") + Observable> listByService(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("subscriptionId") String subscriptionId, @Query("$filter") String filter, @Query("$top") Integer top, @Query("$skip") Integer skip, @Query("expandGroups") Boolean expandGroups, @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.apimanagement.v2019_01_01.Users getEntityTag" }) + @HEAD("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/users/{userId}") + Observable> getEntityTag(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("userId") String userId, @Path("subscriptionId") String subscriptionId, @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.apimanagement.v2019_01_01.Users get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/users/{userId}") + Observable> get(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("userId") String userId, @Path("subscriptionId") String subscriptionId, @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.apimanagement.v2019_01_01.Users createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/users/{userId}") + Observable> createOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("userId") String userId, @Path("subscriptionId") String subscriptionId, @Body UserCreateParameters parameters, @Header("If-Match") String ifMatch, @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.apimanagement.v2019_01_01.Users update" }) + @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/users/{userId}") + Observable> update(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("userId") String userId, @Path("subscriptionId") String subscriptionId, @Body UserUpdateParameters parameters, @Header("If-Match") String ifMatch, @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.apimanagement.v2019_01_01.Users delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/users/{userId}", method = "DELETE", hasBody = true) + Observable> delete(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("userId") String userId, @Path("subscriptionId") String subscriptionId, @Query("deleteSubscriptions") Boolean deleteSubscriptions, @Query("notify") Boolean notify, @Header("If-Match") String ifMatch, @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.apimanagement.v2019_01_01.Users generateSsoUrl" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/users/{userId}/generateSsoUrl") + Observable> generateSsoUrl(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("userId") String userId, @Path("subscriptionId") String subscriptionId, @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.apimanagement.v2019_01_01.Users getSharedAccessToken" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/users/{userId}/token") + Observable> getSharedAccessToken(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("userId") String userId, @Path("subscriptionId") String subscriptionId, @Body UserTokenParameters parameters, @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.apimanagement.v2019_01_01.Users listByServiceNext" }) + @GET + Observable> listByServiceNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Lists a collection of registered users in the specified service instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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<UserContractInner> object if successful. + */ + public PagedList listByService(final String resourceGroupName, final String serviceName) { + ServiceResponse> response = listByServiceSinglePageAsync(resourceGroupName, serviceName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByServiceNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists a collection of registered users in the specified service instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @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> listByServiceAsync(final String resourceGroupName, final String serviceName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByServiceSinglePageAsync(resourceGroupName, serviceName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByServiceNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists a collection of registered users in the specified service instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<UserContractInner> object + */ + public Observable> listByServiceAsync(final String resourceGroupName, final String serviceName) { + return listByServiceWithServiceResponseAsync(resourceGroupName, serviceName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists a collection of registered users in the specified service instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<UserContractInner> object + */ + public Observable>> listByServiceWithServiceResponseAsync(final String resourceGroupName, final String serviceName) { + return listByServiceSinglePageAsync(resourceGroupName, serviceName) + .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(listByServiceNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists a collection of registered users in the specified service instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<UserContractInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByServiceSinglePageAsync(final String resourceGroupName, final String serviceName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + 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 filter = null; + final Integer top = null; + final Integer skip = null; + final Boolean expandGroups = null; + return service.listByService(resourceGroupName, serviceName, this.client.subscriptionId(), filter, top, skip, expandGroups, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByServiceDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Lists a collection of registered users in the specified service instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| firstName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| lastName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| email | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| state | filter | eq | | </br>| registrationDate | filter | ge, le, eq, ne, gt, lt | | </br>| note | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| groups | expand | | | </br> + * @param top Number of records to return. + * @param skip Number of records to skip. + * @param expandGroups Detailed Group in response. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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<UserContractInner> object if successful. + */ + public PagedList listByService(final String resourceGroupName, final String serviceName, final String filter, final Integer top, final Integer skip, final Boolean expandGroups) { + ServiceResponse> response = listByServiceSinglePageAsync(resourceGroupName, serviceName, filter, top, skip, expandGroups).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByServiceNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists a collection of registered users in the specified service instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| firstName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| lastName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| email | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| state | filter | eq | | </br>| registrationDate | filter | ge, le, eq, ne, gt, lt | | </br>| note | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| groups | expand | | | </br> + * @param top Number of records to return. + * @param skip Number of records to skip. + * @param expandGroups Detailed Group in response. + * @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> listByServiceAsync(final String resourceGroupName, final String serviceName, final String filter, final Integer top, final Integer skip, final Boolean expandGroups, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByServiceSinglePageAsync(resourceGroupName, serviceName, filter, top, skip, expandGroups), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByServiceNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists a collection of registered users in the specified service instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| firstName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| lastName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| email | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| state | filter | eq | | </br>| registrationDate | filter | ge, le, eq, ne, gt, lt | | </br>| note | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| groups | expand | | | </br> + * @param top Number of records to return. + * @param skip Number of records to skip. + * @param expandGroups Detailed Group in response. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<UserContractInner> object + */ + public Observable> listByServiceAsync(final String resourceGroupName, final String serviceName, final String filter, final Integer top, final Integer skip, final Boolean expandGroups) { + return listByServiceWithServiceResponseAsync(resourceGroupName, serviceName, filter, top, skip, expandGroups) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists a collection of registered users in the specified service instance. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| firstName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| lastName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| email | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| state | filter | eq | | </br>| registrationDate | filter | ge, le, eq, ne, gt, lt | | </br>| note | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| groups | expand | | | </br> + * @param top Number of records to return. + * @param skip Number of records to skip. + * @param expandGroups Detailed Group in response. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<UserContractInner> object + */ + public Observable>> listByServiceWithServiceResponseAsync(final String resourceGroupName, final String serviceName, final String filter, final Integer top, final Integer skip, final Boolean expandGroups) { + return listByServiceSinglePageAsync(resourceGroupName, serviceName, filter, top, skip, expandGroups) + .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(listByServiceNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists a collection of registered users in the specified service instance. + * + ServiceResponse> * @param resourceGroupName The name of the resource group. + ServiceResponse> * @param serviceName The name of the API Management service. + ServiceResponse> * @param filter | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| firstName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| lastName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| email | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| state | filter | eq | | </br>| registrationDate | filter | ge, le, eq, ne, gt, lt | | </br>| note | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| groups | expand | | | </br> + ServiceResponse> * @param top Number of records to return. + ServiceResponse> * @param skip Number of records to skip. + ServiceResponse> * @param expandGroups Detailed Group in response. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<UserContractInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByServiceSinglePageAsync(final String resourceGroupName, final String serviceName, final String filter, final Integer top, final Integer skip, final Boolean expandGroups) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + 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.listByService(resourceGroupName, serviceName, this.client.subscriptionId(), filter, top, skip, expandGroups, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByServiceDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByServiceDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Gets the entity state (Etag) version of the user specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param userId User identifier. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void getEntityTag(String resourceGroupName, String serviceName, String userId) { + getEntityTagWithServiceResponseAsync(resourceGroupName, serviceName, userId).toBlocking().single().body(); + } + + /** + * Gets the entity state (Etag) version of the user specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param userId User identifier. Must be unique in the current API Management service instance. + * @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 getEntityTagAsync(String resourceGroupName, String serviceName, String userId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(getEntityTagWithServiceResponseAsync(resourceGroupName, serviceName, userId), serviceCallback); + } + + /** + * Gets the entity state (Etag) version of the user specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param userId User identifier. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public Observable getEntityTagAsync(String resourceGroupName, String serviceName, String userId) { + return getEntityTagWithServiceResponseAsync(resourceGroupName, serviceName, userId).map(new Func1, Void>() { + @Override + public Void call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Gets the entity state (Etag) version of the user specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param userId User identifier. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public Observable> getEntityTagWithServiceResponseAsync(String resourceGroupName, String serviceName, String userId) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (userId == null) { + throw new IllegalArgumentException("Parameter userId is required and cannot be null."); + } + 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.getEntityTag(resourceGroupName, serviceName, userId, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = getEntityTagDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponseWithHeaders getEntityTagDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .buildEmptyWithHeaders(response, UserGetEntityTagHeaders.class); + } + + /** + * Gets the details of the user specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param userId User identifier. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the UserContractInner object if successful. + */ + public UserContractInner get(String resourceGroupName, String serviceName, String userId) { + return getWithServiceResponseAsync(resourceGroupName, serviceName, userId).toBlocking().single().body(); + } + + /** + * Gets the details of the user specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param userId User identifier. Must be unique in the current API Management service instance. + * @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 getAsync(String resourceGroupName, String serviceName, String userId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(getWithServiceResponseAsync(resourceGroupName, serviceName, userId), serviceCallback); + } + + /** + * Gets the details of the user specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param userId User identifier. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the UserContractInner object + */ + public Observable getAsync(String resourceGroupName, String serviceName, String userId) { + return getWithServiceResponseAsync(resourceGroupName, serviceName, userId).map(new Func1, UserContractInner>() { + @Override + public UserContractInner call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Gets the details of the user specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param userId User identifier. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the UserContractInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String serviceName, String userId) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (userId == null) { + throw new IllegalArgumentException("Parameter userId is required and cannot be null."); + } + 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.get(resourceGroupName, serviceName, userId, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = getDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponseWithHeaders getDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .buildWithHeaders(response, UserGetHeaders.class); + } + + /** + * Creates or Updates a user. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param userId User identifier. Must be unique in the current API Management service instance. + * @param parameters Create or update parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the UserContractInner object if successful. + */ + public UserContractInner createOrUpdate(String resourceGroupName, String serviceName, String userId, UserCreateParameters parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serviceName, userId, parameters).toBlocking().single().body(); + } + + /** + * Creates or Updates a user. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param userId User identifier. Must be unique in the current API Management service instance. + * @param parameters Create or update parameters. + * @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 createOrUpdateAsync(String resourceGroupName, String serviceName, String userId, UserCreateParameters parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, serviceName, userId, parameters), serviceCallback); + } + + /** + * Creates or Updates a user. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param userId User identifier. Must be unique in the current API Management service instance. + * @param parameters Create or update parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the UserContractInner object + */ + public Observable createOrUpdateAsync(String resourceGroupName, String serviceName, String userId, UserCreateParameters parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serviceName, userId, parameters).map(new Func1, UserContractInner>() { + @Override + public UserContractInner call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Creates or Updates a user. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param userId User identifier. Must be unique in the current API Management service instance. + * @param parameters Create or update parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the UserContractInner object + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String serviceName, String userId, UserCreateParameters parameters) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (userId == null) { + throw new IllegalArgumentException("Parameter userId is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(parameters); + final String ifMatch = null; + return service.createOrUpdate(resourceGroupName, serviceName, userId, this.client.subscriptionId(), parameters, ifMatch, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = createOrUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Creates or Updates a user. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param userId User identifier. Must be unique in the current API Management service instance. + * @param parameters Create or update parameters. + * @param ifMatch ETag of the Entity. Not required when creating an entity, but required when updating an entity. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the UserContractInner object if successful. + */ + public UserContractInner createOrUpdate(String resourceGroupName, String serviceName, String userId, UserCreateParameters parameters, String ifMatch) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serviceName, userId, parameters, ifMatch).toBlocking().single().body(); + } + + /** + * Creates or Updates a user. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param userId User identifier. Must be unique in the current API Management service instance. + * @param parameters Create or update parameters. + * @param ifMatch ETag of the Entity. Not required when creating an entity, but required when updating an entity. + * @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 createOrUpdateAsync(String resourceGroupName, String serviceName, String userId, UserCreateParameters parameters, String ifMatch, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, serviceName, userId, parameters, ifMatch), serviceCallback); + } + + /** + * Creates or Updates a user. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param userId User identifier. Must be unique in the current API Management service instance. + * @param parameters Create or update parameters. + * @param ifMatch ETag of the Entity. Not required when creating an entity, but required when updating an entity. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the UserContractInner object + */ + public Observable createOrUpdateAsync(String resourceGroupName, String serviceName, String userId, UserCreateParameters parameters, String ifMatch) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serviceName, userId, parameters, ifMatch).map(new Func1, UserContractInner>() { + @Override + public UserContractInner call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Creates or Updates a user. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param userId User identifier. Must be unique in the current API Management service instance. + * @param parameters Create or update parameters. + * @param ifMatch ETag of the Entity. Not required when creating an entity, but required when updating an entity. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the UserContractInner object + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String serviceName, String userId, UserCreateParameters parameters, String ifMatch) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (userId == null) { + throw new IllegalArgumentException("Parameter userId is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(parameters); + return service.createOrUpdate(resourceGroupName, serviceName, userId, this.client.subscriptionId(), parameters, ifMatch, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = createOrUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponseWithHeaders createOrUpdateDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(201, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .buildWithHeaders(response, UserCreateOrUpdateHeaders.class); + } + + /** + * Updates the details of the user specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param userId User identifier. Must be unique in the current API Management service instance. + * @param parameters Update parameters. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void update(String resourceGroupName, String serviceName, String userId, UserUpdateParameters parameters, String ifMatch) { + updateWithServiceResponseAsync(resourceGroupName, serviceName, userId, parameters, ifMatch).toBlocking().single().body(); + } + + /** + * Updates the details of the user specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param userId User identifier. Must be unique in the current API Management service instance. + * @param parameters Update parameters. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @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 serviceName, String userId, UserUpdateParameters parameters, String ifMatch, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateWithServiceResponseAsync(resourceGroupName, serviceName, userId, parameters, ifMatch), serviceCallback); + } + + /** + * Updates the details of the user specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param userId User identifier. Must be unique in the current API Management service instance. + * @param parameters Update parameters. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable updateAsync(String resourceGroupName, String serviceName, String userId, UserUpdateParameters parameters, String ifMatch) { + return updateWithServiceResponseAsync(resourceGroupName, serviceName, userId, parameters, ifMatch).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates the details of the user specified by its identifier. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param userId User identifier. Must be unique in the current API Management service instance. + * @param parameters Update parameters. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> updateWithServiceResponseAsync(String resourceGroupName, String serviceName, String userId, UserUpdateParameters parameters, String ifMatch) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (userId == null) { + throw new IllegalArgumentException("Parameter userId is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + if (ifMatch == null) { + throw new IllegalArgumentException("Parameter ifMatch is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(parameters); + return service.update(resourceGroupName, serviceName, userId, this.client.subscriptionId(), parameters, ifMatch, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = updateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse updateDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(204, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Deletes specific user. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param userId User identifier. Must be unique in the current API Management service instance. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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 serviceName, String userId, String ifMatch) { + deleteWithServiceResponseAsync(resourceGroupName, serviceName, userId, ifMatch).toBlocking().single().body(); + } + + /** + * Deletes specific user. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param userId User identifier. Must be unique in the current API Management service instance. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @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 serviceName, String userId, String ifMatch, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, serviceName, userId, ifMatch), serviceCallback); + } + + /** + * Deletes specific user. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param userId User identifier. Must be unique in the current API Management service instance. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable deleteAsync(String resourceGroupName, String serviceName, String userId, String ifMatch) { + return deleteWithServiceResponseAsync(resourceGroupName, serviceName, userId, ifMatch).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes specific user. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param userId User identifier. Must be unique in the current API Management service instance. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> deleteWithServiceResponseAsync(String resourceGroupName, String serviceName, String userId, String ifMatch) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (userId == null) { + throw new IllegalArgumentException("Parameter userId is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (ifMatch == null) { + throw new IllegalArgumentException("Parameter ifMatch 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 Boolean deleteSubscriptions = null; + final Boolean notify = null; + return service.delete(resourceGroupName, serviceName, userId, this.client.subscriptionId(), deleteSubscriptions, notify, ifMatch, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = deleteDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Deletes specific user. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param userId User identifier. Must be unique in the current API Management service instance. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @param deleteSubscriptions Whether to delete user's subscription or not. + * @param notify Send an Account Closed Email notification to the User. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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 serviceName, String userId, String ifMatch, Boolean deleteSubscriptions, Boolean notify) { + deleteWithServiceResponseAsync(resourceGroupName, serviceName, userId, ifMatch, deleteSubscriptions, notify).toBlocking().single().body(); + } + + /** + * Deletes specific user. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param userId User identifier. Must be unique in the current API Management service instance. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @param deleteSubscriptions Whether to delete user's subscription or not. + * @param notify Send an Account Closed Email notification to the User. + * @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 serviceName, String userId, String ifMatch, Boolean deleteSubscriptions, Boolean notify, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, serviceName, userId, ifMatch, deleteSubscriptions, notify), serviceCallback); + } + + /** + * Deletes specific user. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param userId User identifier. Must be unique in the current API Management service instance. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @param deleteSubscriptions Whether to delete user's subscription or not. + * @param notify Send an Account Closed Email notification to the User. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable deleteAsync(String resourceGroupName, String serviceName, String userId, String ifMatch, Boolean deleteSubscriptions, Boolean notify) { + return deleteWithServiceResponseAsync(resourceGroupName, serviceName, userId, ifMatch, deleteSubscriptions, notify).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes specific user. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param userId User identifier. Must be unique in the current API Management service instance. + * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. + * @param deleteSubscriptions Whether to delete user's subscription or not. + * @param notify Send an Account Closed Email notification to the User. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> deleteWithServiceResponseAsync(String resourceGroupName, String serviceName, String userId, String ifMatch, Boolean deleteSubscriptions, Boolean notify) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (userId == null) { + throw new IllegalArgumentException("Parameter userId is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (ifMatch == null) { + throw new IllegalArgumentException("Parameter ifMatch 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.delete(resourceGroupName, serviceName, userId, this.client.subscriptionId(), deleteSubscriptions, notify, ifMatch, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = deleteDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse deleteDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(204, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Retrieves a redirection URL containing an authentication token for signing a given user into the developer portal. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param userId User identifier. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the GenerateSsoUrlResultInner object if successful. + */ + public GenerateSsoUrlResultInner generateSsoUrl(String resourceGroupName, String serviceName, String userId) { + return generateSsoUrlWithServiceResponseAsync(resourceGroupName, serviceName, userId).toBlocking().single().body(); + } + + /** + * Retrieves a redirection URL containing an authentication token for signing a given user into the developer portal. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param userId User identifier. Must be unique in the current API Management service instance. + * @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 generateSsoUrlAsync(String resourceGroupName, String serviceName, String userId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(generateSsoUrlWithServiceResponseAsync(resourceGroupName, serviceName, userId), serviceCallback); + } + + /** + * Retrieves a redirection URL containing an authentication token for signing a given user into the developer portal. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param userId User identifier. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the GenerateSsoUrlResultInner object + */ + public Observable generateSsoUrlAsync(String resourceGroupName, String serviceName, String userId) { + return generateSsoUrlWithServiceResponseAsync(resourceGroupName, serviceName, userId).map(new Func1, GenerateSsoUrlResultInner>() { + @Override + public GenerateSsoUrlResultInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Retrieves a redirection URL containing an authentication token for signing a given user into the developer portal. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param userId User identifier. Must be unique in the current API Management service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the GenerateSsoUrlResultInner object + */ + public Observable> generateSsoUrlWithServiceResponseAsync(String resourceGroupName, String serviceName, String userId) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (userId == null) { + throw new IllegalArgumentException("Parameter userId is required and cannot be null."); + } + 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.generateSsoUrl(resourceGroupName, serviceName, userId, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = generateSsoUrlDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse generateSsoUrlDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Gets the Shared Access Authorization Token for the User. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param userId User identifier. Must be unique in the current API Management service instance. + * @param parameters Create Authorization Token parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the UserTokenResultInner object if successful. + */ + public UserTokenResultInner getSharedAccessToken(String resourceGroupName, String serviceName, String userId, UserTokenParameters parameters) { + return getSharedAccessTokenWithServiceResponseAsync(resourceGroupName, serviceName, userId, parameters).toBlocking().single().body(); + } + + /** + * Gets the Shared Access Authorization Token for the User. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param userId User identifier. Must be unique in the current API Management service instance. + * @param parameters Create Authorization Token parameters. + * @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 getSharedAccessTokenAsync(String resourceGroupName, String serviceName, String userId, UserTokenParameters parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getSharedAccessTokenWithServiceResponseAsync(resourceGroupName, serviceName, userId, parameters), serviceCallback); + } + + /** + * Gets the Shared Access Authorization Token for the User. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param userId User identifier. Must be unique in the current API Management service instance. + * @param parameters Create Authorization Token parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the UserTokenResultInner object + */ + public Observable getSharedAccessTokenAsync(String resourceGroupName, String serviceName, String userId, UserTokenParameters parameters) { + return getSharedAccessTokenWithServiceResponseAsync(resourceGroupName, serviceName, userId, parameters).map(new Func1, UserTokenResultInner>() { + @Override + public UserTokenResultInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets the Shared Access Authorization Token for the User. + * + * @param resourceGroupName The name of the resource group. + * @param serviceName The name of the API Management service. + * @param userId User identifier. Must be unique in the current API Management service instance. + * @param parameters Create Authorization Token parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the UserTokenResultInner object + */ + public Observable> getSharedAccessTokenWithServiceResponseAsync(String resourceGroupName, String serviceName, String userId, UserTokenParameters parameters) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (userId == null) { + throw new IllegalArgumentException("Parameter userId is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(parameters); + return service.getSharedAccessToken(resourceGroupName, serviceName, userId, this.client.subscriptionId(), parameters, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getSharedAccessTokenDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getSharedAccessTokenDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists a collection of registered users in the specified service instance. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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<UserContractInner> object if successful. + */ + public PagedList listByServiceNext(final String nextPageLink) { + ServiceResponse> response = listByServiceNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByServiceNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists a collection of registered users in the specified service instance. + * + * @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> listByServiceNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByServiceNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByServiceNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists a collection of registered users in the specified service instance. + * + * @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<UserContractInner> object + */ + public Observable> listByServiceNextAsync(final String nextPageLink) { + return listByServiceNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists a collection of registered users in the specified service instance. + * + * @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<UserContractInner> object + */ + public Observable>> listByServiceNextWithServiceResponseAsync(final String nextPageLink) { + return listByServiceNextSinglePageAsync(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(listByServiceNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists a collection of registered users in the specified service instance. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<UserContractInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByServiceNextSinglePageAsync(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.listByServiceNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByServiceNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByServiceNextDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + +} diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/package-info.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/package-info.java new file mode 100644 index 0000000000000..cac0631a5dd91 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/package-info.java @@ -0,0 +1,11 @@ +// 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 ApiManagementClient. + * ApiManagement Client. + */ +package com.microsoft.azure.management.apimanagement.v2019_01_01.implementation; diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/package-info.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/package-info.java new file mode 100644 index 0000000000000..78d2680359650 --- /dev/null +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/package-info.java @@ -0,0 +1,11 @@ +// 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 ApiManagementClient. + * ApiManagement Client. + */ +package com.microsoft.azure.management.apimanagement.v2019_01_01;