diff --git a/hybridkubernetes/resource-manager/v2020_01_01_preview/pom.xml b/hybridkubernetes/resource-manager/v2020_01_01_preview/pom.xml new file mode 100644 index 0000000000000..1331a7f911bb5 --- /dev/null +++ b/hybridkubernetes/resource-manager/v2020_01_01_preview/pom.xml @@ -0,0 +1,135 @@ + + + 4.0.0 + com.microsoft.azure.hybridkubernetes.v2020_01_01_preview + + com.microsoft.azure + azure-arm-parent + 1.1.0 + ../../../pom.management.xml + + azure-mgmt-kubernetes + 1.0.0-beta + jar + Microsoft Azure SDK for Kubernetes Management + This package contains Microsoft Kubernetes 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 + + 1.6.5 + + + + + + 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/hybridkubernetes/resource-manager/v2020_01_01_preview/src/main/java/com/microsoft/azure/management/hybridkubernetes/v2020_01_01_preview/AuthenticationCertificateDetails.java b/hybridkubernetes/resource-manager/v2020_01_01_preview/src/main/java/com/microsoft/azure/management/hybridkubernetes/v2020_01_01_preview/AuthenticationCertificateDetails.java new file mode 100644 index 0000000000000..ea9ce7040c9f9 --- /dev/null +++ b/hybridkubernetes/resource-manager/v2020_01_01_preview/src/main/java/com/microsoft/azure/management/hybridkubernetes/v2020_01_01_preview/AuthenticationCertificateDetails.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.hybridkubernetes.v2020_01_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The AuthenticationCertificateDetails model. + */ +public class AuthenticationCertificateDetails { + /** + * Base64 encoded client certificate data. + */ + @JsonProperty(value = "certificateData", required = true) + private String certificateData; + + /** + * Base64 encoded key data. + */ + @JsonProperty(value = "keyData", required = true) + private String keyData; + + /** + * Get base64 encoded client certificate data. + * + * @return the certificateData value + */ + public String certificateData() { + return this.certificateData; + } + + /** + * Set base64 encoded client certificate data. + * + * @param certificateData the certificateData value to set + * @return the AuthenticationCertificateDetails object itself. + */ + public AuthenticationCertificateDetails withCertificateData(String certificateData) { + this.certificateData = certificateData; + return this; + } + + /** + * Get base64 encoded key data. + * + * @return the keyData value + */ + public String keyData() { + return this.keyData; + } + + /** + * Set base64 encoded key data. + * + * @param keyData the keyData value to set + * @return the AuthenticationCertificateDetails object itself. + */ + public AuthenticationCertificateDetails withKeyData(String keyData) { + this.keyData = keyData; + return this; + } + +} diff --git a/hybridkubernetes/resource-manager/v2020_01_01_preview/src/main/java/com/microsoft/azure/management/hybridkubernetes/v2020_01_01_preview/AuthenticationDetails.java b/hybridkubernetes/resource-manager/v2020_01_01_preview/src/main/java/com/microsoft/azure/management/hybridkubernetes/v2020_01_01_preview/AuthenticationDetails.java new file mode 100644 index 0000000000000..43aebbe913146 --- /dev/null +++ b/hybridkubernetes/resource-manager/v2020_01_01_preview/src/main/java/com/microsoft/azure/management/hybridkubernetes/v2020_01_01_preview/AuthenticationDetails.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.hybridkubernetes.v2020_01_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The AuthenticationDetails model. + */ +public class AuthenticationDetails { + /** + * The mode of client authentication. Possible values include: 'Token', + * 'ClientCertificate'. + */ + @JsonProperty(value = "authenticationMethod", required = true) + private AuthenticationMethod authenticationMethod; + + /** + * The value property. + */ + @JsonProperty(value = "value", required = true) + private AuthenticationDetailsValue value; + + /** + * Get the mode of client authentication. Possible values include: 'Token', 'ClientCertificate'. + * + * @return the authenticationMethod value + */ + public AuthenticationMethod authenticationMethod() { + return this.authenticationMethod; + } + + /** + * Set the mode of client authentication. Possible values include: 'Token', 'ClientCertificate'. + * + * @param authenticationMethod the authenticationMethod value to set + * @return the AuthenticationDetails object itself. + */ + public AuthenticationDetails withAuthenticationMethod(AuthenticationMethod authenticationMethod) { + this.authenticationMethod = authenticationMethod; + return this; + } + + /** + * Get the value value. + * + * @return the value value + */ + public AuthenticationDetailsValue value() { + return this.value; + } + + /** + * Set the value value. + * + * @param value the value value to set + * @return the AuthenticationDetails object itself. + */ + public AuthenticationDetails withValue(AuthenticationDetailsValue value) { + this.value = value; + return this; + } + +} diff --git a/hybridkubernetes/resource-manager/v2020_01_01_preview/src/main/java/com/microsoft/azure/management/hybridkubernetes/v2020_01_01_preview/AuthenticationDetailsValue.java b/hybridkubernetes/resource-manager/v2020_01_01_preview/src/main/java/com/microsoft/azure/management/hybridkubernetes/v2020_01_01_preview/AuthenticationDetailsValue.java new file mode 100644 index 0000000000000..fe4fa420a7426 --- /dev/null +++ b/hybridkubernetes/resource-manager/v2020_01_01_preview/src/main/java/com/microsoft/azure/management/hybridkubernetes/v2020_01_01_preview/AuthenticationDetailsValue.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.hybridkubernetes.v2020_01_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The AuthenticationDetailsValue model. + */ +public class AuthenticationDetailsValue { + /** + * Authentication token. + */ + @JsonProperty(value = "token") + private String token; + + /** + * The clientCertificate property. + */ + @JsonProperty(value = "clientCertificate") + private AuthenticationCertificateDetails clientCertificate; + + /** + * Get authentication token. + * + * @return the token value + */ + public String token() { + return this.token; + } + + /** + * Set authentication token. + * + * @param token the token value to set + * @return the AuthenticationDetailsValue object itself. + */ + public AuthenticationDetailsValue withToken(String token) { + this.token = token; + return this; + } + + /** + * Get the clientCertificate value. + * + * @return the clientCertificate value + */ + public AuthenticationCertificateDetails clientCertificate() { + return this.clientCertificate; + } + + /** + * Set the clientCertificate value. + * + * @param clientCertificate the clientCertificate value to set + * @return the AuthenticationDetailsValue object itself. + */ + public AuthenticationDetailsValue withClientCertificate(AuthenticationCertificateDetails clientCertificate) { + this.clientCertificate = clientCertificate; + return this; + } + +} diff --git a/hybridkubernetes/resource-manager/v2020_01_01_preview/src/main/java/com/microsoft/azure/management/hybridkubernetes/v2020_01_01_preview/AuthenticationMethod.java b/hybridkubernetes/resource-manager/v2020_01_01_preview/src/main/java/com/microsoft/azure/management/hybridkubernetes/v2020_01_01_preview/AuthenticationMethod.java new file mode 100644 index 0000000000000..b8bd9de76c56e --- /dev/null +++ b/hybridkubernetes/resource-manager/v2020_01_01_preview/src/main/java/com/microsoft/azure/management/hybridkubernetes/v2020_01_01_preview/AuthenticationMethod.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.hybridkubernetes.v2020_01_01_preview; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for AuthenticationMethod. + */ +public final class AuthenticationMethod extends ExpandableStringEnum { + /** Static value Token for AuthenticationMethod. */ + public static final AuthenticationMethod TOKEN = fromString("Token"); + + /** Static value ClientCertificate for AuthenticationMethod. */ + public static final AuthenticationMethod CLIENT_CERTIFICATE = fromString("ClientCertificate"); + + /** + * Creates or finds a AuthenticationMethod from its string representation. + * @param name a name to look for + * @return the corresponding AuthenticationMethod + */ + @JsonCreator + public static AuthenticationMethod fromString(String name) { + return fromString(name, AuthenticationMethod.class); + } + + /** + * @return known AuthenticationMethod values + */ + public static Collection values() { + return values(AuthenticationMethod.class); + } +} diff --git a/hybridkubernetes/resource-manager/v2020_01_01_preview/src/main/java/com/microsoft/azure/management/hybridkubernetes/v2020_01_01_preview/AzureEntityResource.java b/hybridkubernetes/resource-manager/v2020_01_01_preview/src/main/java/com/microsoft/azure/management/hybridkubernetes/v2020_01_01_preview/AzureEntityResource.java new file mode 100644 index 0000000000000..656cff1fa9a0a --- /dev/null +++ b/hybridkubernetes/resource-manager/v2020_01_01_preview/src/main/java/com/microsoft/azure/management/hybridkubernetes/v2020_01_01_preview/AzureEntityResource.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. + */ + +package com.microsoft.azure.management.hybridkubernetes.v2020_01_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.azure.ProxyResource; + +/** + * The resource model definition for a Azure Resource Manager resource with an + * etag. + */ +public class AzureEntityResource extends ProxyResource { + /** + * Resource Etag. + */ + @JsonProperty(value = "etag", access = JsonProperty.Access.WRITE_ONLY) + private String etag; + + /** + * Get resource Etag. + * + * @return the etag value + */ + public String etag() { + return this.etag; + } + +} diff --git a/hybridkubernetes/resource-manager/v2020_01_01_preview/src/main/java/com/microsoft/azure/management/hybridkubernetes/v2020_01_01_preview/ConnectedCluster.java b/hybridkubernetes/resource-manager/v2020_01_01_preview/src/main/java/com/microsoft/azure/management/hybridkubernetes/v2020_01_01_preview/ConnectedCluster.java new file mode 100644 index 0000000000000..1e82ebf3d4938 --- /dev/null +++ b/hybridkubernetes/resource-manager/v2020_01_01_preview/src/main/java/com/microsoft/azure/management/hybridkubernetes/v2020_01_01_preview/ConnectedCluster.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.hybridkubernetes.v2020_01_01_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.Resource; +import com.microsoft.azure.arm.resources.models.GroupableResourceCore; +import com.microsoft.azure.arm.resources.models.HasResourceGroup; +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.hybridkubernetes.v2020_01_01_preview.implementation.KubernetesManager; +import com.microsoft.azure.management.hybridkubernetes.v2020_01_01_preview.implementation.ConnectedClusterInner; + +/** + * Type representing ConnectedCluster. + */ +public interface ConnectedCluster extends HasInner, Resource, GroupableResourceCore, HasResourceGroup, Refreshable, Updatable, HasManager { + /** + * @return the aadProfile value. + */ + ConnectedClusterAADProfile aadProfile(); + + /** + * @return the agentPublicKeyCertificate value. + */ + String agentPublicKeyCertificate(); + + /** + * @return the agentVersion value. + */ + String agentVersion(); + + /** + * @return the identity value. + */ + ConnectedClusterIdentity identity(); + + /** + * @return the kubernetesVersion value. + */ + String kubernetesVersion(); + + /** + * @return the provisioningState value. + */ + ProvisioningState provisioningState(); + + /** + * @return the totalNodeCount value. + */ + Integer totalNodeCount(); + + /** + * The entirety of the ConnectedCluster definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithGroup, DefinitionStages.WithAadProfile, DefinitionStages.WithAgentPublicKeyCertificate, DefinitionStages.WithIdentity, DefinitionStages.WithCreate { + } + + /** + * Grouping of ConnectedCluster definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a ConnectedCluster definition. + */ + interface Blank extends GroupableResourceCore.DefinitionWithRegion { + } + + /** + * The stage of the ConnectedCluster definition allowing to specify the resource group. + */ + interface WithGroup extends GroupableResourceCore.DefinitionStages.WithGroup { + } + + /** + * The stage of the connectedcluster definition allowing to specify AadProfile. + */ + interface WithAadProfile { + /** + * Specifies aadProfile. + * @param aadProfile the aadProfile parameter value + * @return the next definition stage +*/ + WithAgentPublicKeyCertificate withAadProfile(ConnectedClusterAADProfile aadProfile); + } + + /** + * The stage of the connectedcluster definition allowing to specify AgentPublicKeyCertificate. + */ + interface WithAgentPublicKeyCertificate { + /** + * Specifies agentPublicKeyCertificate. + * @param agentPublicKeyCertificate Base64 encoded public certificate used by the agent to do the initial handshake to the backend services in Azure + * @return the next definition stage +*/ + WithIdentity withAgentPublicKeyCertificate(String agentPublicKeyCertificate); + } + + /** + * The stage of the connectedcluster definition allowing to specify Identity. + */ + interface WithIdentity { + /** + * Specifies identity. + * @param identity The identity of the connected cluster + * @return the next definition stage +*/ + WithCreate withIdentity(ConnectedClusterIdentity identity); + } + + /** + * The stage of the connectedcluster definition allowing to specify ProvisioningState. + */ + interface WithProvisioningState { + /** + * Specifies provisioningState. + * @param provisioningState Possible values include: 'Succeeded', 'Failed', 'Canceled', 'Provisioning', 'Updating', 'Deleting', 'Accepted' + * @return the next definition stage + */ + WithCreate withProvisioningState(ProvisioningState provisioningState); + } + + /** + * 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, Resource.DefinitionWithTags, DefinitionStages.WithProvisioningState { + } + } + /** + * The template for a ConnectedCluster update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, Resource.UpdateWithTags, UpdateStages.WithAgentPublicKeyCertificate { + } + + /** + * Grouping of ConnectedCluster update stages. + */ + interface UpdateStages { + /** + * The stage of the connectedcluster update allowing to specify AgentPublicKeyCertificate. + */ + interface WithAgentPublicKeyCertificate { + /** + * Specifies agentPublicKeyCertificate. + * @param agentPublicKeyCertificate Base64 encoded public certificate used by the agent to do the initial handshake to the backend services in Azure + * @return the next update stage + */ + Update withAgentPublicKeyCertificate(String agentPublicKeyCertificate); + } + + } +} diff --git a/hybridkubernetes/resource-manager/v2020_01_01_preview/src/main/java/com/microsoft/azure/management/hybridkubernetes/v2020_01_01_preview/ConnectedClusterAADProfile.java b/hybridkubernetes/resource-manager/v2020_01_01_preview/src/main/java/com/microsoft/azure/management/hybridkubernetes/v2020_01_01_preview/ConnectedClusterAADProfile.java new file mode 100644 index 0000000000000..2c6de99bb8e22 --- /dev/null +++ b/hybridkubernetes/resource-manager/v2020_01_01_preview/src/main/java/com/microsoft/azure/management/hybridkubernetes/v2020_01_01_preview/ConnectedClusterAADProfile.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.hybridkubernetes.v2020_01_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The ConnectedClusterAADProfile model. + */ +public class ConnectedClusterAADProfile { + /** + * The aad tenant id which is configured on target K8s cluster. + */ + @JsonProperty(value = "tenantId", required = true) + private String tenantId; + + /** + * The client app id configured on target K8 cluster. + */ + @JsonProperty(value = "clientAppId", required = true) + private String clientAppId; + + /** + * The server app id to access AD server. + */ + @JsonProperty(value = "serverAppId", required = true) + private String serverAppId; + + /** + * Get the aad tenant id which is configured on target K8s cluster. + * + * @return the tenantId value + */ + public String tenantId() { + return this.tenantId; + } + + /** + * Set the aad tenant id which is configured on target K8s cluster. + * + * @param tenantId the tenantId value to set + * @return the ConnectedClusterAADProfile object itself. + */ + public ConnectedClusterAADProfile withTenantId(String tenantId) { + this.tenantId = tenantId; + return this; + } + + /** + * Get the client app id configured on target K8 cluster. + * + * @return the clientAppId value + */ + public String clientAppId() { + return this.clientAppId; + } + + /** + * Set the client app id configured on target K8 cluster. + * + * @param clientAppId the clientAppId value to set + * @return the ConnectedClusterAADProfile object itself. + */ + public ConnectedClusterAADProfile withClientAppId(String clientAppId) { + this.clientAppId = clientAppId; + return this; + } + + /** + * Get the server app id to access AD server. + * + * @return the serverAppId value + */ + public String serverAppId() { + return this.serverAppId; + } + + /** + * Set the server app id to access AD server. + * + * @param serverAppId the serverAppId value to set + * @return the ConnectedClusterAADProfile object itself. + */ + public ConnectedClusterAADProfile withServerAppId(String serverAppId) { + this.serverAppId = serverAppId; + return this; + } + +} diff --git a/hybridkubernetes/resource-manager/v2020_01_01_preview/src/main/java/com/microsoft/azure/management/hybridkubernetes/v2020_01_01_preview/ConnectedClusterIdentity.java b/hybridkubernetes/resource-manager/v2020_01_01_preview/src/main/java/com/microsoft/azure/management/hybridkubernetes/v2020_01_01_preview/ConnectedClusterIdentity.java new file mode 100644 index 0000000000000..a8b49da88a240 --- /dev/null +++ b/hybridkubernetes/resource-manager/v2020_01_01_preview/src/main/java/com/microsoft/azure/management/hybridkubernetes/v2020_01_01_preview/ConnectedClusterIdentity.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.hybridkubernetes.v2020_01_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Identity for the connected cluster. + */ +public class ConnectedClusterIdentity { + /** + * The principal id of connected cluster identity. This property will only + * be provided for a system assigned identity. + */ + @JsonProperty(value = "principalId", access = JsonProperty.Access.WRITE_ONLY) + private String principalId; + + /** + * The tenant id associated with the connected cluster. This property will + * only be provided for a system assigned identity. + */ + @JsonProperty(value = "tenantId", access = JsonProperty.Access.WRITE_ONLY) + private String tenantId; + + /** + * The type of identity used for the connected cluster. The type + * 'SystemAssigned, includes a system created identity. The type 'None' + * means no identity is assigned to the connected cluster. Possible values + * include: 'None', 'SystemAssigned'. + */ + @JsonProperty(value = "type", required = true) + private ResourceIdentityType type; + + /** + * Get the principal id of connected cluster identity. This property will only be provided for a system assigned identity. + * + * @return the principalId value + */ + public String principalId() { + return this.principalId; + } + + /** + * Get the tenant id associated with the connected cluster. This property will only be provided for a system assigned identity. + * + * @return the tenantId value + */ + public String tenantId() { + return this.tenantId; + } + + /** + * Get the type of identity used for the connected cluster. The type 'SystemAssigned, includes a system created identity. The type 'None' means no identity is assigned to the connected cluster. Possible values include: 'None', 'SystemAssigned'. + * + * @return the type value + */ + public ResourceIdentityType type() { + return this.type; + } + + /** + * Set the type of identity used for the connected cluster. The type 'SystemAssigned, includes a system created identity. The type 'None' means no identity is assigned to the connected cluster. Possible values include: 'None', 'SystemAssigned'. + * + * @param type the type value to set + * @return the ConnectedClusterIdentity object itself. + */ + public ConnectedClusterIdentity withType(ResourceIdentityType type) { + this.type = type; + return this; + } + +} diff --git a/hybridkubernetes/resource-manager/v2020_01_01_preview/src/main/java/com/microsoft/azure/management/hybridkubernetes/v2020_01_01_preview/ConnectedClusterPatch.java b/hybridkubernetes/resource-manager/v2020_01_01_preview/src/main/java/com/microsoft/azure/management/hybridkubernetes/v2020_01_01_preview/ConnectedClusterPatch.java new file mode 100644 index 0000000000000..d1e4745591e29 --- /dev/null +++ b/hybridkubernetes/resource-manager/v2020_01_01_preview/src/main/java/com/microsoft/azure/management/hybridkubernetes/v2020_01_01_preview/ConnectedClusterPatch.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.hybridkubernetes.v2020_01_01_preview; + +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; + +/** + * Object containing updates for patch operations. + */ +@JsonFlatten +public class ConnectedClusterPatch { + /** + * Resource tags. + */ + @JsonProperty(value = "tags") + private Map tags; + + /** + * Base64 encoded public certificate used by the agent to do the initial + * handshake to the backend services in Azure. + */ + @JsonProperty(value = "properties.agentPublicKeyCertificate") + private String agentPublicKeyCertificate; + + /** + * 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 ConnectedClusterPatch object itself. + */ + public ConnectedClusterPatch withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Get base64 encoded public certificate used by the agent to do the initial handshake to the backend services in Azure. + * + * @return the agentPublicKeyCertificate value + */ + public String agentPublicKeyCertificate() { + return this.agentPublicKeyCertificate; + } + + /** + * Set base64 encoded public certificate used by the agent to do the initial handshake to the backend services in Azure. + * + * @param agentPublicKeyCertificate the agentPublicKeyCertificate value to set + * @return the ConnectedClusterPatch object itself. + */ + public ConnectedClusterPatch withAgentPublicKeyCertificate(String agentPublicKeyCertificate) { + this.agentPublicKeyCertificate = agentPublicKeyCertificate; + return this; + } + +} diff --git a/hybridkubernetes/resource-manager/v2020_01_01_preview/src/main/java/com/microsoft/azure/management/hybridkubernetes/v2020_01_01_preview/ConnectedClusters.java b/hybridkubernetes/resource-manager/v2020_01_01_preview/src/main/java/com/microsoft/azure/management/hybridkubernetes/v2020_01_01_preview/ConnectedClusters.java new file mode 100644 index 0000000000000..138668c7fd586 --- /dev/null +++ b/hybridkubernetes/resource-manager/v2020_01_01_preview/src/main/java/com/microsoft/azure/management/hybridkubernetes/v2020_01_01_preview/ConnectedClusters.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.hybridkubernetes.v2020_01_01_preview; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import com.microsoft.azure.arm.resources.collection.SupportsDeletingByResourceGroup; +import com.microsoft.azure.arm.resources.collection.SupportsBatchDeletion; +import com.microsoft.azure.arm.resources.collection.SupportsGettingByResourceGroup; +import rx.Observable; +import com.microsoft.azure.arm.resources.collection.SupportsListingByResourceGroup; +import com.microsoft.azure.arm.collection.SupportsListing; +import com.microsoft.azure.management.hybridkubernetes.v2020_01_01_preview.implementation.ConnectedClustersInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing ConnectedClusters. + */ +public interface ConnectedClusters extends SupportsCreating, SupportsDeletingByResourceGroup, SupportsBatchDeletion, SupportsGettingByResourceGroup, SupportsListingByResourceGroup, SupportsListing, HasInner { + /** + * Gets cluster user credentials of a connected cluster. + * Gets cluster user credentials of the connected cluster with a specified resource group and name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the Kubernetes cluster on which get is called. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listClusterUserCredentialsAsync(String resourceGroupName, String clusterName); + +} diff --git a/hybridkubernetes/resource-manager/v2020_01_01_preview/src/main/java/com/microsoft/azure/management/hybridkubernetes/v2020_01_01_preview/CredentialResult.java b/hybridkubernetes/resource-manager/v2020_01_01_preview/src/main/java/com/microsoft/azure/management/hybridkubernetes/v2020_01_01_preview/CredentialResult.java new file mode 100644 index 0000000000000..76695ce25cd60 --- /dev/null +++ b/hybridkubernetes/resource-manager/v2020_01_01_preview/src/main/java/com/microsoft/azure/management/hybridkubernetes/v2020_01_01_preview/CredentialResult.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.hybridkubernetes.v2020_01_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The credential result response. + */ +public class CredentialResult { + /** + * The name of the credential. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /** + * Base64-encoded Kubernetes configuration file. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private byte[] value; + + /** + * Get the name of the credential. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Get base64-encoded Kubernetes configuration file. + * + * @return the value value + */ + public byte[] value() { + return this.value; + } + +} diff --git a/hybridkubernetes/resource-manager/v2020_01_01_preview/src/main/java/com/microsoft/azure/management/hybridkubernetes/v2020_01_01_preview/CredentialResults.java b/hybridkubernetes/resource-manager/v2020_01_01_preview/src/main/java/com/microsoft/azure/management/hybridkubernetes/v2020_01_01_preview/CredentialResults.java new file mode 100644 index 0000000000000..5873856d66b86 --- /dev/null +++ b/hybridkubernetes/resource-manager/v2020_01_01_preview/src/main/java/com/microsoft/azure/management/hybridkubernetes/v2020_01_01_preview/CredentialResults.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.hybridkubernetes.v2020_01_01_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.hybridkubernetes.v2020_01_01_preview.implementation.KubernetesManager; +import com.microsoft.azure.management.hybridkubernetes.v2020_01_01_preview.implementation.CredentialResultsInner; +import java.util.List; + +/** + * Type representing CredentialResults. + */ +public interface CredentialResults extends HasInner, HasManager { + /** + * @return the kubeconfigs value. + */ + List kubeconfigs(); + +} diff --git a/hybridkubernetes/resource-manager/v2020_01_01_preview/src/main/java/com/microsoft/azure/management/hybridkubernetes/v2020_01_01_preview/ErrorDetails.java b/hybridkubernetes/resource-manager/v2020_01_01_preview/src/main/java/com/microsoft/azure/management/hybridkubernetes/v2020_01_01_preview/ErrorDetails.java new file mode 100644 index 0000000000000..4de497f9aa283 --- /dev/null +++ b/hybridkubernetes/resource-manager/v2020_01_01_preview/src/main/java/com/microsoft/azure/management/hybridkubernetes/v2020_01_01_preview/ErrorDetails.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.hybridkubernetes.v2020_01_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The error response details containing error code and error message. + */ +public class ErrorDetails { + /** + * The error code. + */ + @JsonProperty(value = "code", access = JsonProperty.Access.WRITE_ONLY) + private String code; + + /** + * The error message. + */ + @JsonProperty(value = "message", access = JsonProperty.Access.WRITE_ONLY) + private String message; + + /** + * Get the error code. + * + * @return the code value + */ + public String code() { + return this.code; + } + + /** + * Get the error message. + * + * @return the message value + */ + public String message() { + return this.message; + } + +} diff --git a/hybridkubernetes/resource-manager/v2020_01_01_preview/src/main/java/com/microsoft/azure/management/hybridkubernetes/v2020_01_01_preview/ErrorResponse.java b/hybridkubernetes/resource-manager/v2020_01_01_preview/src/main/java/com/microsoft/azure/management/hybridkubernetes/v2020_01_01_preview/ErrorResponse.java new file mode 100644 index 0000000000000..1c1efc8731b99 --- /dev/null +++ b/hybridkubernetes/resource-manager/v2020_01_01_preview/src/main/java/com/microsoft/azure/management/hybridkubernetes/v2020_01_01_preview/ErrorResponse.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.hybridkubernetes.v2020_01_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The error response that indicates why an operation has failed. + */ +public class ErrorResponse { + /** + * The error property. + */ + @JsonProperty(value = "error") + private ErrorDetails error; + + /** + * Get the error value. + * + * @return the error value + */ + public ErrorDetails error() { + return this.error; + } + + /** + * Set the error value. + * + * @param error the error value to set + * @return the ErrorResponse object itself. + */ + public ErrorResponse withError(ErrorDetails error) { + this.error = error; + return this; + } + +} diff --git a/hybridkubernetes/resource-manager/v2020_01_01_preview/src/main/java/com/microsoft/azure/management/hybridkubernetes/v2020_01_01_preview/ErrorResponseException.java b/hybridkubernetes/resource-manager/v2020_01_01_preview/src/main/java/com/microsoft/azure/management/hybridkubernetes/v2020_01_01_preview/ErrorResponseException.java new file mode 100644 index 0000000000000..5114a679b7f13 --- /dev/null +++ b/hybridkubernetes/resource-manager/v2020_01_01_preview/src/main/java/com/microsoft/azure/management/hybridkubernetes/v2020_01_01_preview/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.hybridkubernetes.v2020_01_01_preview; + +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/hybridkubernetes/resource-manager/v2020_01_01_preview/src/main/java/com/microsoft/azure/management/hybridkubernetes/v2020_01_01_preview/Operation.java b/hybridkubernetes/resource-manager/v2020_01_01_preview/src/main/java/com/microsoft/azure/management/hybridkubernetes/v2020_01_01_preview/Operation.java new file mode 100644 index 0000000000000..b1ba50222b2d4 --- /dev/null +++ b/hybridkubernetes/resource-manager/v2020_01_01_preview/src/main/java/com/microsoft/azure/management/hybridkubernetes/v2020_01_01_preview/Operation.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.hybridkubernetes.v2020_01_01_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.hybridkubernetes.v2020_01_01_preview.implementation.KubernetesManager; +import com.microsoft.azure.management.hybridkubernetes.v2020_01_01_preview.implementation.OperationInner; + +/** + * Type representing Operation. + */ +public interface Operation extends HasInner, HasManager { + /** + * @return the display value. + */ + OperationDisplay display(); + + /** + * @return the name value. + */ + String name(); + +} diff --git a/hybridkubernetes/resource-manager/v2020_01_01_preview/src/main/java/com/microsoft/azure/management/hybridkubernetes/v2020_01_01_preview/OperationDisplay.java b/hybridkubernetes/resource-manager/v2020_01_01_preview/src/main/java/com/microsoft/azure/management/hybridkubernetes/v2020_01_01_preview/OperationDisplay.java new file mode 100644 index 0000000000000..1a08ac27cc9ff --- /dev/null +++ b/hybridkubernetes/resource-manager/v2020_01_01_preview/src/main/java/com/microsoft/azure/management/hybridkubernetes/v2020_01_01_preview/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.hybridkubernetes.v2020_01_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The object that represents the operation. + */ +public class OperationDisplay { + /** + * Service provider: Microsoft.connectedClusters. + */ + @JsonProperty(value = "provider") + private String provider; + + /** + * Connected Cluster Resource on which the operation is performed. + */ + @JsonProperty(value = "resource") + private String resource; + + /** + * Operation type: Read, write, delete, etc. + */ + @JsonProperty(value = "operation") + private String operation; + + /** + * Description of the operation. + */ + @JsonProperty(value = "description") + private String description; + + /** + * Get service provider: Microsoft.connectedClusters. + * + * @return the provider value + */ + public String provider() { + return this.provider; + } + + /** + * Set service provider: Microsoft.connectedClusters. + * + * @param provider the provider value to set + * @return the OperationDisplay object itself. + */ + public OperationDisplay withProvider(String provider) { + this.provider = provider; + return this; + } + + /** + * Get connected Cluster Resource on which the operation is performed. + * + * @return the resource value + */ + public String resource() { + return this.resource; + } + + /** + * Set connected Cluster Resource 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 operation type: Read, write, delete, etc. + * + * @return the operation value + */ + public String operation() { + return this.operation; + } + + /** + * Set operation type: Read, write, delete, etc. + * + * @param operation the operation value to set + * @return the OperationDisplay object itself. + */ + public OperationDisplay withOperation(String operation) { + this.operation = operation; + return this; + } + + /** + * Get description of the operation. + * + * @return the description value + */ + public String description() { + return this.description; + } + + /** + * Set description 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/hybridkubernetes/resource-manager/v2020_01_01_preview/src/main/java/com/microsoft/azure/management/hybridkubernetes/v2020_01_01_preview/Operations.java b/hybridkubernetes/resource-manager/v2020_01_01_preview/src/main/java/com/microsoft/azure/management/hybridkubernetes/v2020_01_01_preview/Operations.java new file mode 100644 index 0000000000000..2aab76e0cbe78 --- /dev/null +++ b/hybridkubernetes/resource-manager/v2020_01_01_preview/src/main/java/com/microsoft/azure/management/hybridkubernetes/v2020_01_01_preview/Operations.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.hybridkubernetes.v2020_01_01_preview; + +import rx.Observable; +import com.microsoft.azure.management.hybridkubernetes.v2020_01_01_preview.implementation.OperationsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing Operations. + */ +public interface Operations extends HasInner { + /** + * Lists all of the available API operations for Connected Cluster resource. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(); + +} diff --git a/hybridkubernetes/resource-manager/v2020_01_01_preview/src/main/java/com/microsoft/azure/management/hybridkubernetes/v2020_01_01_preview/ProvisioningState.java b/hybridkubernetes/resource-manager/v2020_01_01_preview/src/main/java/com/microsoft/azure/management/hybridkubernetes/v2020_01_01_preview/ProvisioningState.java new file mode 100644 index 0000000000000..51be66f692e3c --- /dev/null +++ b/hybridkubernetes/resource-manager/v2020_01_01_preview/src/main/java/com/microsoft/azure/management/hybridkubernetes/v2020_01_01_preview/ProvisioningState.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.hybridkubernetes.v2020_01_01_preview; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for ProvisioningState. + */ +public final class ProvisioningState extends ExpandableStringEnum { + /** Static value Succeeded for ProvisioningState. */ + public static final ProvisioningState SUCCEEDED = fromString("Succeeded"); + + /** Static value Failed for ProvisioningState. */ + public static final ProvisioningState FAILED = fromString("Failed"); + + /** Static value Canceled for ProvisioningState. */ + public static final ProvisioningState CANCELED = fromString("Canceled"); + + /** Static value Provisioning for ProvisioningState. */ + public static final ProvisioningState PROVISIONING = fromString("Provisioning"); + + /** Static value Updating for ProvisioningState. */ + public static final ProvisioningState UPDATING = fromString("Updating"); + + /** Static value Deleting for ProvisioningState. */ + public static final ProvisioningState DELETING = fromString("Deleting"); + + /** Static value Accepted for ProvisioningState. */ + public static final ProvisioningState ACCEPTED = fromString("Accepted"); + + /** + * Creates or finds a ProvisioningState from its string representation. + * @param name a name to look for + * @return the corresponding ProvisioningState + */ + @JsonCreator + public static ProvisioningState fromString(String name) { + return fromString(name, ProvisioningState.class); + } + + /** + * @return known ProvisioningState values + */ + public static Collection values() { + return values(ProvisioningState.class); + } +} diff --git a/hybridkubernetes/resource-manager/v2020_01_01_preview/src/main/java/com/microsoft/azure/management/hybridkubernetes/v2020_01_01_preview/ResourceIdentityType.java b/hybridkubernetes/resource-manager/v2020_01_01_preview/src/main/java/com/microsoft/azure/management/hybridkubernetes/v2020_01_01_preview/ResourceIdentityType.java new file mode 100644 index 0000000000000..53aeb1b87cbf8 --- /dev/null +++ b/hybridkubernetes/resource-manager/v2020_01_01_preview/src/main/java/com/microsoft/azure/management/hybridkubernetes/v2020_01_01_preview/ResourceIdentityType.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.hybridkubernetes.v2020_01_01_preview; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for ResourceIdentityType. + */ +public enum ResourceIdentityType { + /** Enum value None. */ + NONE("None"), + + /** Enum value SystemAssigned. */ + SYSTEM_ASSIGNED("SystemAssigned"); + + /** The actual serialized value for a ResourceIdentityType instance. */ + private String value; + + ResourceIdentityType(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a ResourceIdentityType instance. + * + * @param value the serialized value to parse. + * @return the parsed ResourceIdentityType object, or null if unable to parse. + */ + @JsonCreator + public static ResourceIdentityType fromString(String value) { + ResourceIdentityType[] items = ResourceIdentityType.values(); + for (ResourceIdentityType item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/hybridkubernetes/resource-manager/v2020_01_01_preview/src/main/java/com/microsoft/azure/management/hybridkubernetes/v2020_01_01_preview/implementation/ConnectedClusterImpl.java b/hybridkubernetes/resource-manager/v2020_01_01_preview/src/main/java/com/microsoft/azure/management/hybridkubernetes/v2020_01_01_preview/implementation/ConnectedClusterImpl.java new file mode 100644 index 0000000000000..bed187b297280 --- /dev/null +++ b/hybridkubernetes/resource-manager/v2020_01_01_preview/src/main/java/com/microsoft/azure/management/hybridkubernetes/v2020_01_01_preview/implementation/ConnectedClusterImpl.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.hybridkubernetes.v2020_01_01_preview.implementation; + +import com.microsoft.azure.arm.resources.models.implementation.GroupableResourceCoreImpl; +import com.microsoft.azure.management.hybridkubernetes.v2020_01_01_preview.ConnectedCluster; +import rx.Observable; +import com.microsoft.azure.management.hybridkubernetes.v2020_01_01_preview.ConnectedClusterPatch; +import com.microsoft.azure.management.hybridkubernetes.v2020_01_01_preview.ConnectedClusterIdentity; +import com.microsoft.azure.management.hybridkubernetes.v2020_01_01_preview.ConnectedClusterAADProfile; +import com.microsoft.azure.management.hybridkubernetes.v2020_01_01_preview.ProvisioningState; +import rx.functions.Func1; + +class ConnectedClusterImpl extends GroupableResourceCoreImpl implements ConnectedCluster, ConnectedCluster.Definition, ConnectedCluster.Update { + private ConnectedClusterPatch updateParameter; + ConnectedClusterImpl(String name, ConnectedClusterInner inner, KubernetesManager manager) { + super(name, inner, manager); + this.updateParameter = new ConnectedClusterPatch(); + } + + @Override + public Observable createResourceAsync() { + ConnectedClustersInner client = this.manager().inner().connectedClusters(); + return client.createAsync(this.resourceGroupName(), this.name(), this.inner()) + .map(new Func1() { + @Override + public ConnectedClusterInner call(ConnectedClusterInner resource) { + resetCreateUpdateParameters(); + return resource; + } + }) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + ConnectedClustersInner client = this.manager().inner().connectedClusters(); + return client.updateAsync(this.resourceGroupName(), this.name(), this.updateParameter) + .map(new Func1() { + @Override + public ConnectedClusterInner call(ConnectedClusterInner resource) { + resetCreateUpdateParameters(); + return resource; + } + }) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + ConnectedClustersInner client = this.manager().inner().connectedClusters(); + return client.getByResourceGroupAsync(this.resourceGroupName(), this.name()); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + private void resetCreateUpdateParameters() { + this.updateParameter = new ConnectedClusterPatch(); + } + + @Override + public ConnectedClusterAADProfile aadProfile() { + return this.inner().aadProfile(); + } + + @Override + public String agentPublicKeyCertificate() { + return this.inner().agentPublicKeyCertificate(); + } + + @Override + public String agentVersion() { + return this.inner().agentVersion(); + } + + @Override + public ConnectedClusterIdentity identity() { + return this.inner().identity(); + } + + @Override + public String kubernetesVersion() { + return this.inner().kubernetesVersion(); + } + + @Override + public ProvisioningState provisioningState() { + return this.inner().provisioningState(); + } + + @Override + public Integer totalNodeCount() { + return this.inner().totalNodeCount(); + } + + @Override + public ConnectedClusterImpl withAadProfile(ConnectedClusterAADProfile aadProfile) { + this.inner().withAadProfile(aadProfile); + return this; + } + + @Override + public ConnectedClusterImpl withIdentity(ConnectedClusterIdentity identity) { + this.inner().withIdentity(identity); + return this; + } + + @Override + public ConnectedClusterImpl withProvisioningState(ProvisioningState provisioningState) { + this.inner().withProvisioningState(provisioningState); + return this; + } + + @Override + public ConnectedClusterImpl withAgentPublicKeyCertificate(String agentPublicKeyCertificate) { + if (isInCreateMode()) { + this.inner().withAgentPublicKeyCertificate(agentPublicKeyCertificate); + } else { + this.updateParameter.withAgentPublicKeyCertificate(agentPublicKeyCertificate); + } + return this; + } + +} diff --git a/hybridkubernetes/resource-manager/v2020_01_01_preview/src/main/java/com/microsoft/azure/management/hybridkubernetes/v2020_01_01_preview/implementation/ConnectedClusterInner.java b/hybridkubernetes/resource-manager/v2020_01_01_preview/src/main/java/com/microsoft/azure/management/hybridkubernetes/v2020_01_01_preview/implementation/ConnectedClusterInner.java new file mode 100644 index 0000000000000..f08c8f7cd4c5f --- /dev/null +++ b/hybridkubernetes/resource-manager/v2020_01_01_preview/src/main/java/com/microsoft/azure/management/hybridkubernetes/v2020_01_01_preview/implementation/ConnectedClusterInner.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.hybridkubernetes.v2020_01_01_preview.implementation; + +import com.microsoft.azure.management.hybridkubernetes.v2020_01_01_preview.ConnectedClusterIdentity; +import com.microsoft.azure.management.hybridkubernetes.v2020_01_01_preview.ConnectedClusterAADProfile; +import com.microsoft.azure.management.hybridkubernetes.v2020_01_01_preview.ProvisioningState; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.Resource; + +/** + * Represents a connected cluster. + */ +@JsonFlatten +public class ConnectedClusterInner extends Resource { + /** + * The identity of the connected cluster. + */ + @JsonProperty(value = "identity", required = true) + private ConnectedClusterIdentity identity; + + /** + * Base64 encoded public certificate used by the agent to do the initial + * handshake to the backend services in Azure. + */ + @JsonProperty(value = "properties.agentPublicKeyCertificate", required = true) + private String agentPublicKeyCertificate; + + /** + * The aadProfile property. + */ + @JsonProperty(value = "properties.aadProfile", required = true) + private ConnectedClusterAADProfile aadProfile; + + /** + * The Kubernetes version of the connected cluster resource. + */ + @JsonProperty(value = "properties.kubernetesVersion", access = JsonProperty.Access.WRITE_ONLY) + private String kubernetesVersion; + + /** + * Number of nodes present in the connected cluster resource. + */ + @JsonProperty(value = "properties.totalNodeCount", access = JsonProperty.Access.WRITE_ONLY) + private Integer totalNodeCount; + + /** + * Version of the agent running on the connected cluster resource. + */ + @JsonProperty(value = "properties.agentVersion", access = JsonProperty.Access.WRITE_ONLY) + private String agentVersion; + + /** + * Possible values include: 'Succeeded', 'Failed', 'Canceled', + * 'Provisioning', 'Updating', 'Deleting', 'Accepted'. + */ + @JsonProperty(value = "properties.provisioningState") + private ProvisioningState provisioningState; + + /** + * Get the identity of the connected cluster. + * + * @return the identity value + */ + public ConnectedClusterIdentity identity() { + return this.identity; + } + + /** + * Set the identity of the connected cluster. + * + * @param identity the identity value to set + * @return the ConnectedClusterInner object itself. + */ + public ConnectedClusterInner withIdentity(ConnectedClusterIdentity identity) { + this.identity = identity; + return this; + } + + /** + * Get base64 encoded public certificate used by the agent to do the initial handshake to the backend services in Azure. + * + * @return the agentPublicKeyCertificate value + */ + public String agentPublicKeyCertificate() { + return this.agentPublicKeyCertificate; + } + + /** + * Set base64 encoded public certificate used by the agent to do the initial handshake to the backend services in Azure. + * + * @param agentPublicKeyCertificate the agentPublicKeyCertificate value to set + * @return the ConnectedClusterInner object itself. + */ + public ConnectedClusterInner withAgentPublicKeyCertificate(String agentPublicKeyCertificate) { + this.agentPublicKeyCertificate = agentPublicKeyCertificate; + return this; + } + + /** + * Get the aadProfile value. + * + * @return the aadProfile value + */ + public ConnectedClusterAADProfile aadProfile() { + return this.aadProfile; + } + + /** + * Set the aadProfile value. + * + * @param aadProfile the aadProfile value to set + * @return the ConnectedClusterInner object itself. + */ + public ConnectedClusterInner withAadProfile(ConnectedClusterAADProfile aadProfile) { + this.aadProfile = aadProfile; + return this; + } + + /** + * Get the Kubernetes version of the connected cluster resource. + * + * @return the kubernetesVersion value + */ + public String kubernetesVersion() { + return this.kubernetesVersion; + } + + /** + * Get number of nodes present in the connected cluster resource. + * + * @return the totalNodeCount value + */ + public Integer totalNodeCount() { + return this.totalNodeCount; + } + + /** + * Get version of the agent running on the connected cluster resource. + * + * @return the agentVersion value + */ + public String agentVersion() { + return this.agentVersion; + } + + /** + * Get possible values include: 'Succeeded', 'Failed', 'Canceled', 'Provisioning', 'Updating', 'Deleting', 'Accepted'. + * + * @return the provisioningState value + */ + public ProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * Set possible values include: 'Succeeded', 'Failed', 'Canceled', 'Provisioning', 'Updating', 'Deleting', 'Accepted'. + * + * @param provisioningState the provisioningState value to set + * @return the ConnectedClusterInner object itself. + */ + public ConnectedClusterInner withProvisioningState(ProvisioningState provisioningState) { + this.provisioningState = provisioningState; + return this; + } + +} diff --git a/hybridkubernetes/resource-manager/v2020_01_01_preview/src/main/java/com/microsoft/azure/management/hybridkubernetes/v2020_01_01_preview/implementation/ConnectedClustersImpl.java b/hybridkubernetes/resource-manager/v2020_01_01_preview/src/main/java/com/microsoft/azure/management/hybridkubernetes/v2020_01_01_preview/implementation/ConnectedClustersImpl.java new file mode 100644 index 0000000000000..c046a9a465a3d --- /dev/null +++ b/hybridkubernetes/resource-manager/v2020_01_01_preview/src/main/java/com/microsoft/azure/management/hybridkubernetes/v2020_01_01_preview/implementation/ConnectedClustersImpl.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. + * def + */ + +package com.microsoft.azure.management.hybridkubernetes.v2020_01_01_preview.implementation; + +import com.microsoft.azure.arm.resources.collection.implementation.GroupableResourcesCoreImpl; +import com.microsoft.azure.management.hybridkubernetes.v2020_01_01_preview.ConnectedClusters; +import com.microsoft.azure.management.hybridkubernetes.v2020_01_01_preview.ConnectedCluster; +import rx.Observable; +import rx.Completable; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import com.microsoft.azure.arm.resources.ResourceUtilsCore; +import com.microsoft.azure.arm.utils.RXMapper; +import rx.functions.Func1; +import com.microsoft.azure.PagedList; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.hybridkubernetes.v2020_01_01_preview.CredentialResults; + +class ConnectedClustersImpl extends GroupableResourcesCoreImpl implements ConnectedClusters { + protected ConnectedClustersImpl(KubernetesManager manager) { + super(manager.inner().connectedClusters(), manager); + } + + @Override + protected Observable getInnerAsync(String resourceGroupName, String name) { + ConnectedClustersInner client = this.inner(); + return client.getByResourceGroupAsync(resourceGroupName, name); + } + + @Override + protected Completable deleteInnerAsync(String resourceGroupName, String name) { + ConnectedClustersInner client = this.inner(); + return client.deleteAsync(resourceGroupName, name).toCompletable(); + } + + @Override + public Observable deleteByIdsAsync(Collection ids) { + if (ids == null || ids.isEmpty()) { + return Observable.empty(); + } + Collection> observables = new ArrayList<>(); + for (String id : ids) { + final String resourceGroupName = ResourceUtilsCore.groupFromResourceId(id); + final String name = ResourceUtilsCore.nameFromResourceId(id); + Observable o = RXMapper.map(this.inner().deleteAsync(resourceGroupName, name), id); + observables.add(o); + } + return Observable.mergeDelayError(observables); + } + + @Override + public Observable deleteByIdsAsync(String...ids) { + return this.deleteByIdsAsync(new ArrayList(Arrays.asList(ids))); + } + + @Override + public void deleteByIds(Collection ids) { + if (ids != null && !ids.isEmpty()) { + this.deleteByIdsAsync(ids).toBlocking().last(); + } + } + + @Override + public void deleteByIds(String...ids) { + this.deleteByIds(new ArrayList(Arrays.asList(ids))); + } + + @Override + public PagedList listByResourceGroup(String resourceGroupName) { + ConnectedClustersInner client = this.inner(); + return this.wrapList(client.listByResourceGroup(resourceGroupName)); + } + + @Override + public Observable listByResourceGroupAsync(String resourceGroupName) { + ConnectedClustersInner 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 ConnectedCluster call(ConnectedClusterInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public PagedList list() { + ConnectedClustersInner client = this.inner(); + return this.wrapList(client.list()); + } + + @Override + public Observable listAsync() { + ConnectedClustersInner client = this.inner(); + return client.listAsync() + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public ConnectedCluster call(ConnectedClusterInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public ConnectedClusterImpl define(String name) { + return wrapModel(name); + } + + @Override + public Observable listClusterUserCredentialsAsync(String resourceGroupName, String clusterName) { + ConnectedClustersInner client = this.inner(); + return client.listClusterUserCredentialsAsync(resourceGroupName, clusterName) + .map(new Func1() { + @Override + public CredentialResults call(CredentialResultsInner inner) { + return new CredentialResultsImpl(inner, manager()); + } + }); + } + + @Override + protected ConnectedClusterImpl wrapModel(ConnectedClusterInner inner) { + return new ConnectedClusterImpl(inner.name(), inner, manager()); + } + + @Override + protected ConnectedClusterImpl wrapModel(String name) { + return new ConnectedClusterImpl(name, new ConnectedClusterInner(), this.manager()); + } + +} diff --git a/hybridkubernetes/resource-manager/v2020_01_01_preview/src/main/java/com/microsoft/azure/management/hybridkubernetes/v2020_01_01_preview/implementation/ConnectedClustersInner.java b/hybridkubernetes/resource-manager/v2020_01_01_preview/src/main/java/com/microsoft/azure/management/hybridkubernetes/v2020_01_01_preview/implementation/ConnectedClustersInner.java new file mode 100644 index 0000000000000..7c1c293ac37f8 --- /dev/null +++ b/hybridkubernetes/resource-manager/v2020_01_01_preview/src/main/java/com/microsoft/azure/management/hybridkubernetes/v2020_01_01_preview/implementation/ConnectedClustersInner.java @@ -0,0 +1,1291 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.hybridkubernetes.v2020_01_01_preview.implementation; + +import com.microsoft.azure.arm.collection.InnerSupportsGet; +import com.microsoft.azure.arm.collection.InnerSupportsDelete; +import com.microsoft.azure.arm.collection.InnerSupportsListing; +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.management.hybridkubernetes.v2020_01_01_preview.AuthenticationDetails; +import com.microsoft.azure.management.hybridkubernetes.v2020_01_01_preview.ConnectedClusterPatch; +import com.microsoft.azure.management.hybridkubernetes.v2020_01_01_preview.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.Validator; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.Body; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.HTTP; +import retrofit2.http.PATCH; +import retrofit2.http.Path; +import retrofit2.http.POST; +import retrofit2.http.PUT; +import retrofit2.http.Query; +import retrofit2.http.Url; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in ConnectedClusters. + */ +public class ConnectedClustersInner implements InnerSupportsGet, InnerSupportsDelete, InnerSupportsListing { + /** The Retrofit service to perform REST calls. */ + private ConnectedClustersService service; + /** The service client containing this operation class. */ + private HybridKubernetesManagementClientImpl client; + + /** + * Initializes an instance of ConnectedClustersInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public ConnectedClustersInner(Retrofit retrofit, HybridKubernetesManagementClientImpl client) { + this.service = retrofit.create(ConnectedClustersService.class); + this.client = client; + } + + /** + * The interface defining all the services for ConnectedClusters to be + * used by Retrofit to perform actually REST calls. + */ + interface ConnectedClustersService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.hybridkubernetes.v2020_01_01_preview.ConnectedClusters create" }) + @PUT("subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Kubernetes/connectedClusters/{clusterName}") + Observable> create(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("clusterName") String clusterName, @Query("api-version") String apiVersion, @Body ConnectedClusterInner connectedCluster, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.hybridkubernetes.v2020_01_01_preview.ConnectedClusters beginCreate" }) + @PUT("subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Kubernetes/connectedClusters/{clusterName}") + Observable> beginCreate(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("clusterName") String clusterName, @Query("api-version") String apiVersion, @Body ConnectedClusterInner connectedCluster, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.hybridkubernetes.v2020_01_01_preview.ConnectedClusters update" }) + @PATCH("subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Kubernetes/connectedClusters/{clusterName}") + Observable> update(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("clusterName") String clusterName, @Query("api-version") String apiVersion, @Body ConnectedClusterPatch connectedClusterPatch, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.hybridkubernetes.v2020_01_01_preview.ConnectedClusters getByResourceGroup" }) + @GET("subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Kubernetes/connectedClusters/{clusterName}") + Observable> getByResourceGroup(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("clusterName") String clusterName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.hybridkubernetes.v2020_01_01_preview.ConnectedClusters delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Kubernetes/connectedClusters/{clusterName}", method = "DELETE", hasBody = true) + Observable> delete(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("clusterName") String clusterName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.hybridkubernetes.v2020_01_01_preview.ConnectedClusters beginDelete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Kubernetes/connectedClusters/{clusterName}", method = "DELETE", hasBody = true) + Observable> beginDelete(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("clusterName") String clusterName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.hybridkubernetes.v2020_01_01_preview.ConnectedClusters listClusterUserCredentials" }) + @POST("subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Kubernetes/connectedClusters/{clusterName}/listClusterUserCredentials") + Observable> listClusterUserCredentials(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("clusterName") String clusterName, @Query("api-version") String apiVersion, @Body AuthenticationDetails clientAuthenticationDetails, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.hybridkubernetes.v2020_01_01_preview.ConnectedClusters listByResourceGroup" }) + @GET("subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Kubernetes/connectedClusters") + Observable> listByResourceGroup(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.hybridkubernetes.v2020_01_01_preview.ConnectedClusters list" }) + @GET("subscriptions/{subscriptionId}/providers/Microsoft.Kubernetes/connectedClusters") + 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.hybridkubernetes.v2020_01_01_preview.ConnectedClusters 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.hybridkubernetes.v2020_01_01_preview.ConnectedClusters listNext" }) + @GET + Observable> listNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Register a new Kubernetes cluster with Azure Resource Manager. + * API to register a new Kubernetes cluster and create a tracked resource in Azure Resource Manager (ARM). + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the Kubernetes cluster on which get is called. + * @param connectedCluster Parameters supplied to Create a Connected Cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ConnectedClusterInner object if successful. + */ + public ConnectedClusterInner create(String resourceGroupName, String clusterName, ConnectedClusterInner connectedCluster) { + return createWithServiceResponseAsync(resourceGroupName, clusterName, connectedCluster).toBlocking().last().body(); + } + + /** + * Register a new Kubernetes cluster with Azure Resource Manager. + * API to register a new Kubernetes cluster and create a tracked resource in Azure Resource Manager (ARM). + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the Kubernetes cluster on which get is called. + * @param connectedCluster Parameters supplied to Create a Connected Cluster. + * @param serviceCallback 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 clusterName, ConnectedClusterInner connectedCluster, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createWithServiceResponseAsync(resourceGroupName, clusterName, connectedCluster), serviceCallback); + } + + /** + * Register a new Kubernetes cluster with Azure Resource Manager. + * API to register a new Kubernetes cluster and create a tracked resource in Azure Resource Manager (ARM). + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the Kubernetes cluster on which get is called. + * @param connectedCluster Parameters supplied to Create a Connected Cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable createAsync(String resourceGroupName, String clusterName, ConnectedClusterInner connectedCluster) { + return createWithServiceResponseAsync(resourceGroupName, clusterName, connectedCluster).map(new Func1, ConnectedClusterInner>() { + @Override + public ConnectedClusterInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Register a new Kubernetes cluster with Azure Resource Manager. + * API to register a new Kubernetes cluster and create a tracked resource in Azure Resource Manager (ARM). + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the Kubernetes cluster on which get is called. + * @param connectedCluster Parameters supplied to Create a Connected Cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> createWithServiceResponseAsync(String resourceGroupName, String clusterName, ConnectedClusterInner connectedCluster) { + 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 (clusterName == null) { + throw new IllegalArgumentException("Parameter clusterName 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 (connectedCluster == null) { + throw new IllegalArgumentException("Parameter connectedCluster is required and cannot be null."); + } + Validator.validate(connectedCluster); + Observable> observable = service.create(this.client.subscriptionId(), resourceGroupName, clusterName, this.client.apiVersion(), connectedCluster, this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Register a new Kubernetes cluster with Azure Resource Manager. + * API to register a new Kubernetes cluster and create a tracked resource in Azure Resource Manager (ARM). + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the Kubernetes cluster on which get is called. + * @param connectedCluster Parameters supplied to Create a Connected Cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ConnectedClusterInner object if successful. + */ + public ConnectedClusterInner beginCreate(String resourceGroupName, String clusterName, ConnectedClusterInner connectedCluster) { + return beginCreateWithServiceResponseAsync(resourceGroupName, clusterName, connectedCluster).toBlocking().single().body(); + } + + /** + * Register a new Kubernetes cluster with Azure Resource Manager. + * API to register a new Kubernetes cluster and create a tracked resource in Azure Resource Manager (ARM). + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the Kubernetes cluster on which get is called. + * @param connectedCluster Parameters supplied to Create a Connected Cluster. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture beginCreateAsync(String resourceGroupName, String clusterName, ConnectedClusterInner connectedCluster, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginCreateWithServiceResponseAsync(resourceGroupName, clusterName, connectedCluster), serviceCallback); + } + + /** + * Register a new Kubernetes cluster with Azure Resource Manager. + * API to register a new Kubernetes cluster and create a tracked resource in Azure Resource Manager (ARM). + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the Kubernetes cluster on which get is called. + * @param connectedCluster Parameters supplied to Create a Connected Cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ConnectedClusterInner object + */ + public Observable beginCreateAsync(String resourceGroupName, String clusterName, ConnectedClusterInner connectedCluster) { + return beginCreateWithServiceResponseAsync(resourceGroupName, clusterName, connectedCluster).map(new Func1, ConnectedClusterInner>() { + @Override + public ConnectedClusterInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Register a new Kubernetes cluster with Azure Resource Manager. + * API to register a new Kubernetes cluster and create a tracked resource in Azure Resource Manager (ARM). + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the Kubernetes cluster on which get is called. + * @param connectedCluster Parameters supplied to Create a Connected Cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ConnectedClusterInner object + */ + public Observable> beginCreateWithServiceResponseAsync(String resourceGroupName, String clusterName, ConnectedClusterInner connectedCluster) { + 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 (clusterName == null) { + throw new IllegalArgumentException("Parameter clusterName 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 (connectedCluster == null) { + throw new IllegalArgumentException("Parameter connectedCluster is required and cannot be null."); + } + Validator.validate(connectedCluster); + return service.beginCreate(this.client.subscriptionId(), resourceGroupName, clusterName, this.client.apiVersion(), connectedCluster, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginCreateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginCreateDelegate(Response response) throws 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 a connected cluster. + * API to update certain properties of the connected cluster resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the Kubernetes cluster on which get is called. + * @param connectedClusterPatch Parameters supplied to update Connected Cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ConnectedClusterInner object if successful. + */ + public ConnectedClusterInner update(String resourceGroupName, String clusterName, ConnectedClusterPatch connectedClusterPatch) { + return updateWithServiceResponseAsync(resourceGroupName, clusterName, connectedClusterPatch).toBlocking().single().body(); + } + + /** + * Updates a connected cluster. + * API to update certain properties of the connected cluster resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the Kubernetes cluster on which get is called. + * @param connectedClusterPatch Parameters supplied to update Connected Cluster. + * @param serviceCallback 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 clusterName, ConnectedClusterPatch connectedClusterPatch, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateWithServiceResponseAsync(resourceGroupName, clusterName, connectedClusterPatch), serviceCallback); + } + + /** + * Updates a connected cluster. + * API to update certain properties of the connected cluster resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the Kubernetes cluster on which get is called. + * @param connectedClusterPatch Parameters supplied to update Connected Cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ConnectedClusterInner object + */ + public Observable updateAsync(String resourceGroupName, String clusterName, ConnectedClusterPatch connectedClusterPatch) { + return updateWithServiceResponseAsync(resourceGroupName, clusterName, connectedClusterPatch).map(new Func1, ConnectedClusterInner>() { + @Override + public ConnectedClusterInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates a connected cluster. + * API to update certain properties of the connected cluster resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the Kubernetes cluster on which get is called. + * @param connectedClusterPatch Parameters supplied to update Connected Cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ConnectedClusterInner object + */ + public Observable> updateWithServiceResponseAsync(String resourceGroupName, String clusterName, ConnectedClusterPatch connectedClusterPatch) { + 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 (clusterName == null) { + throw new IllegalArgumentException("Parameter clusterName 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 (connectedClusterPatch == null) { + throw new IllegalArgumentException("Parameter connectedClusterPatch is required and cannot be null."); + } + Validator.validate(connectedClusterPatch); + return service.update(this.client.subscriptionId(), resourceGroupName, clusterName, this.client.apiVersion(), connectedClusterPatch, 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(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Get the properties of the specified connected cluster. + * Returns the properties of the specified connected cluster, including name, identity, properties, and additional cluster details. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the Kubernetes cluster on which get is called. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ConnectedClusterInner object if successful. + */ + public ConnectedClusterInner getByResourceGroup(String resourceGroupName, String clusterName) { + return getByResourceGroupWithServiceResponseAsync(resourceGroupName, clusterName).toBlocking().single().body(); + } + + /** + * Get the properties of the specified connected cluster. + * Returns the properties of the specified connected cluster, including name, identity, properties, and additional cluster details. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the Kubernetes cluster on which get is called. + * @param serviceCallback 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 clusterName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getByResourceGroupWithServiceResponseAsync(resourceGroupName, clusterName), serviceCallback); + } + + /** + * Get the properties of the specified connected cluster. + * Returns the properties of the specified connected cluster, including name, identity, properties, and additional cluster details. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the Kubernetes cluster on which get is called. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ConnectedClusterInner object + */ + public Observable getByResourceGroupAsync(String resourceGroupName, String clusterName) { + return getByResourceGroupWithServiceResponseAsync(resourceGroupName, clusterName).map(new Func1, ConnectedClusterInner>() { + @Override + public ConnectedClusterInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Get the properties of the specified connected cluster. + * Returns the properties of the specified connected cluster, including name, identity, properties, and additional cluster details. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the Kubernetes cluster on which get is called. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ConnectedClusterInner object + */ + public Observable> getByResourceGroupWithServiceResponseAsync(String resourceGroupName, String clusterName) { + 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 (clusterName == null) { + throw new IllegalArgumentException("Parameter clusterName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.getByResourceGroup(this.client.subscriptionId(), resourceGroupName, clusterName, 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 ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Delete a connected cluster. + * Delete a connected cluster, removing the tracked resource in Azure Resource Manager (ARM). + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the Kubernetes cluster on which get is called. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @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 clusterName) { + deleteWithServiceResponseAsync(resourceGroupName, clusterName).toBlocking().last().body(); + } + + /** + * Delete a connected cluster. + * Delete a connected cluster, removing the tracked resource in Azure Resource Manager (ARM). + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the Kubernetes cluster on which get is called. + * @param serviceCallback 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 clusterName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, clusterName), serviceCallback); + } + + /** + * Delete a connected cluster. + * Delete a connected cluster, removing the tracked resource in Azure Resource Manager (ARM). + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the Kubernetes cluster on which get is called. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable deleteAsync(String resourceGroupName, String clusterName) { + return deleteWithServiceResponseAsync(resourceGroupName, clusterName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Delete a connected cluster. + * Delete a connected cluster, removing the tracked resource in Azure Resource Manager (ARM). + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the Kubernetes cluster on which get is called. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> deleteWithServiceResponseAsync(String resourceGroupName, String clusterName) { + 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 (clusterName == null) { + throw new IllegalArgumentException("Parameter clusterName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Observable> observable = service.delete(this.client.subscriptionId(), resourceGroupName, clusterName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Delete a connected cluster. + * Delete a connected cluster, removing the tracked resource in Azure Resource Manager (ARM). + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the Kubernetes cluster on which get is called. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @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 beginDelete(String resourceGroupName, String clusterName) { + beginDeleteWithServiceResponseAsync(resourceGroupName, clusterName).toBlocking().single().body(); + } + + /** + * Delete a connected cluster. + * Delete a connected cluster, removing the tracked resource in Azure Resource Manager (ARM). + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the Kubernetes cluster on which get is called. + * @param serviceCallback 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 clusterName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginDeleteWithServiceResponseAsync(resourceGroupName, clusterName), serviceCallback); + } + + /** + * Delete a connected cluster. + * Delete a connected cluster, removing the tracked resource in Azure Resource Manager (ARM). + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the Kubernetes cluster on which get is called. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable beginDeleteAsync(String resourceGroupName, String clusterName) { + return beginDeleteWithServiceResponseAsync(resourceGroupName, clusterName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Delete a connected cluster. + * Delete a connected cluster, removing the tracked resource in Azure Resource Manager (ARM). + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the Kubernetes cluster on which get is called. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> beginDeleteWithServiceResponseAsync(String resourceGroupName, String clusterName) { + 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 (clusterName == null) { + throw new IllegalArgumentException("Parameter clusterName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.beginDelete(this.client.subscriptionId(), resourceGroupName, clusterName, 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 ErrorResponseException, 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(ErrorResponseException.class) + .build(response); + } + + /** + * Gets cluster user credentials of a connected cluster. + * Gets cluster user credentials of the connected cluster with a specified resource group and name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the Kubernetes cluster on which get is called. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the CredentialResultsInner object if successful. + */ + public CredentialResultsInner listClusterUserCredentials(String resourceGroupName, String clusterName) { + return listClusterUserCredentialsWithServiceResponseAsync(resourceGroupName, clusterName).toBlocking().single().body(); + } + + /** + * Gets cluster user credentials of a connected cluster. + * Gets cluster user credentials of the connected cluster with a specified resource group and name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the Kubernetes cluster on which get is called. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture listClusterUserCredentialsAsync(String resourceGroupName, String clusterName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(listClusterUserCredentialsWithServiceResponseAsync(resourceGroupName, clusterName), serviceCallback); + } + + /** + * Gets cluster user credentials of a connected cluster. + * Gets cluster user credentials of the connected cluster with a specified resource group and name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the Kubernetes cluster on which get is called. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the CredentialResultsInner object + */ + public Observable listClusterUserCredentialsAsync(String resourceGroupName, String clusterName) { + return listClusterUserCredentialsWithServiceResponseAsync(resourceGroupName, clusterName).map(new Func1, CredentialResultsInner>() { + @Override + public CredentialResultsInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets cluster user credentials of a connected cluster. + * Gets cluster user credentials of the connected cluster with a specified resource group and name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the Kubernetes cluster on which get is called. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the CredentialResultsInner object + */ + public Observable> listClusterUserCredentialsWithServiceResponseAsync(String resourceGroupName, String clusterName) { + 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 (clusterName == null) { + throw new IllegalArgumentException("Parameter clusterName 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 AuthenticationDetails clientAuthenticationDetails = null; + return service.listClusterUserCredentials(this.client.subscriptionId(), resourceGroupName, clusterName, this.client.apiVersion(), clientAuthenticationDetails, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = listClusterUserCredentialsDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Gets cluster user credentials of a connected cluster. + * Gets cluster user credentials of the connected cluster with a specified resource group and name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the Kubernetes cluster on which get is called. + * @param clientAuthenticationDetails Authentication parameters supplied by the user to fetch credentials for accessing the cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the CredentialResultsInner object if successful. + */ + public CredentialResultsInner listClusterUserCredentials(String resourceGroupName, String clusterName, AuthenticationDetails clientAuthenticationDetails) { + return listClusterUserCredentialsWithServiceResponseAsync(resourceGroupName, clusterName, clientAuthenticationDetails).toBlocking().single().body(); + } + + /** + * Gets cluster user credentials of a connected cluster. + * Gets cluster user credentials of the connected cluster with a specified resource group and name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the Kubernetes cluster on which get is called. + * @param clientAuthenticationDetails Authentication parameters supplied by the user to fetch credentials for accessing the cluster. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture listClusterUserCredentialsAsync(String resourceGroupName, String clusterName, AuthenticationDetails clientAuthenticationDetails, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(listClusterUserCredentialsWithServiceResponseAsync(resourceGroupName, clusterName, clientAuthenticationDetails), serviceCallback); + } + + /** + * Gets cluster user credentials of a connected cluster. + * Gets cluster user credentials of the connected cluster with a specified resource group and name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the Kubernetes cluster on which get is called. + * @param clientAuthenticationDetails Authentication parameters supplied by the user to fetch credentials for accessing the cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the CredentialResultsInner object + */ + public Observable listClusterUserCredentialsAsync(String resourceGroupName, String clusterName, AuthenticationDetails clientAuthenticationDetails) { + return listClusterUserCredentialsWithServiceResponseAsync(resourceGroupName, clusterName, clientAuthenticationDetails).map(new Func1, CredentialResultsInner>() { + @Override + public CredentialResultsInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets cluster user credentials of a connected cluster. + * Gets cluster user credentials of the connected cluster with a specified resource group and name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the Kubernetes cluster on which get is called. + * @param clientAuthenticationDetails Authentication parameters supplied by the user to fetch credentials for accessing the cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the CredentialResultsInner object + */ + public Observable> listClusterUserCredentialsWithServiceResponseAsync(String resourceGroupName, String clusterName, AuthenticationDetails clientAuthenticationDetails) { + 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 (clusterName == null) { + throw new IllegalArgumentException("Parameter clusterName 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(clientAuthenticationDetails); + return service.listClusterUserCredentials(this.client.subscriptionId(), resourceGroupName, clusterName, this.client.apiVersion(), clientAuthenticationDetails, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = listClusterUserCredentialsDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse listClusterUserCredentialsDelegate(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 all connected clusters. + * API to enumerate registered connected K8s clusters under a Resource Group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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<ConnectedClusterInner> object if successful. + */ + public PagedList listByResourceGroup(final String resourceGroupName) { + ServiceResponse> response = listByResourceGroupSinglePageAsync(resourceGroupName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByResourceGroupNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists all connected clusters. + * API to enumerate registered connected K8s clusters under a Resource Group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByResourceGroupAsync(final String resourceGroupName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByResourceGroupSinglePageAsync(resourceGroupName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByResourceGroupNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists all connected clusters. + * API to enumerate registered connected K8s clusters under a Resource Group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ConnectedClusterInner> object + */ + public Observable> listByResourceGroupAsync(final String resourceGroupName) { + return listByResourceGroupWithServiceResponseAsync(resourceGroupName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all connected clusters. + * API to enumerate registered connected K8s clusters under a Resource Group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ConnectedClusterInner> object + */ + public Observable>> listByResourceGroupWithServiceResponseAsync(final String resourceGroupName) { + return listByResourceGroupSinglePageAsync(resourceGroupName) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByResourceGroupNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists all connected clusters. + * API to enumerate registered connected K8s clusters under a Resource Group. + * + ServiceResponse> * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ConnectedClusterInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByResourceGroupSinglePageAsync(final String resourceGroupName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.listByResourceGroup(this.client.subscriptionId(), resourceGroupName, 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 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 connected clusters. + * API to enumerate registered connected K8s clusters under a 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 + * @return the PagedList<ConnectedClusterInner> 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 connected clusters. + * API to enumerate registered connected K8s clusters under a 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 connected clusters. + * API to enumerate registered connected K8s clusters under a Subscription. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ConnectedClusterInner> object + */ + public Observable> listAsync() { + return listWithServiceResponseAsync() + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all connected clusters. + * API to enumerate registered connected K8s clusters under a Subscription. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ConnectedClusterInner> 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 connected clusters. + * API to enumerate registered connected K8s clusters under a Subscription. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ConnectedClusterInner> 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 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 connected clusters. + * API to enumerate registered connected K8s clusters under a Resource 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<ConnectedClusterInner> object if successful. + */ + public PagedList listByResourceGroupNext(final String nextPageLink) { + ServiceResponse> response = listByResourceGroupNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByResourceGroupNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists all connected clusters. + * API to enumerate registered connected K8s clusters under 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); + } + + /** + * Lists all connected clusters. + * API to enumerate registered connected K8s clusters under 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<ConnectedClusterInner> object + */ + public Observable> listByResourceGroupNextAsync(final String nextPageLink) { + return listByResourceGroupNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all connected clusters. + * API to enumerate registered connected K8s clusters under 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<ConnectedClusterInner> object + */ + public Observable>> listByResourceGroupNextWithServiceResponseAsync(final String nextPageLink) { + return listByResourceGroupNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByResourceGroupNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists all connected clusters. + * API to enumerate registered connected K8s clusters under 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<ConnectedClusterInner> 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 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 connected clusters. + * API to enumerate registered connected K8s clusters under a Subscription. + * + * @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<ConnectedClusterInner> 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 connected clusters. + * API to enumerate registered connected K8s clusters under a 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 connected clusters. + * API to enumerate registered connected K8s clusters under a 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<ConnectedClusterInner> 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 connected clusters. + * API to enumerate registered connected K8s clusters under a 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<ConnectedClusterInner> 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 connected clusters. + * API to enumerate registered connected K8s clusters under a 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<ConnectedClusterInner> 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/hybridkubernetes/resource-manager/v2020_01_01_preview/src/main/java/com/microsoft/azure/management/hybridkubernetes/v2020_01_01_preview/implementation/CredentialResultsImpl.java b/hybridkubernetes/resource-manager/v2020_01_01_preview/src/main/java/com/microsoft/azure/management/hybridkubernetes/v2020_01_01_preview/implementation/CredentialResultsImpl.java new file mode 100644 index 0000000000000..5636fcab98476 --- /dev/null +++ b/hybridkubernetes/resource-manager/v2020_01_01_preview/src/main/java/com/microsoft/azure/management/hybridkubernetes/v2020_01_01_preview/implementation/CredentialResultsImpl.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.hybridkubernetes.v2020_01_01_preview.implementation; + +import com.microsoft.azure.management.hybridkubernetes.v2020_01_01_preview.CredentialResults; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import java.util.List; +import com.microsoft.azure.management.hybridkubernetes.v2020_01_01_preview.CredentialResult; + +class CredentialResultsImpl extends WrapperImpl implements CredentialResults { + private final KubernetesManager manager; + CredentialResultsImpl(CredentialResultsInner inner, KubernetesManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public KubernetesManager manager() { + return this.manager; + } + + @Override + public List kubeconfigs() { + return this.inner().kubeconfigs(); + } + +} diff --git a/hybridkubernetes/resource-manager/v2020_01_01_preview/src/main/java/com/microsoft/azure/management/hybridkubernetes/v2020_01_01_preview/implementation/CredentialResultsInner.java b/hybridkubernetes/resource-manager/v2020_01_01_preview/src/main/java/com/microsoft/azure/management/hybridkubernetes/v2020_01_01_preview/implementation/CredentialResultsInner.java new file mode 100644 index 0000000000000..62f5b6794e62c --- /dev/null +++ b/hybridkubernetes/resource-manager/v2020_01_01_preview/src/main/java/com/microsoft/azure/management/hybridkubernetes/v2020_01_01_preview/implementation/CredentialResultsInner.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. + */ + +package com.microsoft.azure.management.hybridkubernetes.v2020_01_01_preview.implementation; + +import java.util.List; +import com.microsoft.azure.management.hybridkubernetes.v2020_01_01_preview.CredentialResult; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The list of credential result response. + */ +public class CredentialResultsInner { + /** + * Base64-encoded Kubernetes configuration file. + */ + @JsonProperty(value = "kubeconfigs", access = JsonProperty.Access.WRITE_ONLY) + private List kubeconfigs; + + /** + * Get base64-encoded Kubernetes configuration file. + * + * @return the kubeconfigs value + */ + public List kubeconfigs() { + return this.kubeconfigs; + } + +} diff --git a/hybridkubernetes/resource-manager/v2020_01_01_preview/src/main/java/com/microsoft/azure/management/hybridkubernetes/v2020_01_01_preview/implementation/HybridKubernetesManagementClientImpl.java b/hybridkubernetes/resource-manager/v2020_01_01_preview/src/main/java/com/microsoft/azure/management/hybridkubernetes/v2020_01_01_preview/implementation/HybridKubernetesManagementClientImpl.java new file mode 100644 index 0000000000000..9ade2d822b03c --- /dev/null +++ b/hybridkubernetes/resource-manager/v2020_01_01_preview/src/main/java/com/microsoft/azure/management/hybridkubernetes/v2020_01_01_preview/implementation/HybridKubernetesManagementClientImpl.java @@ -0,0 +1,210 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.hybridkubernetes.v2020_01_01_preview.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 HybridKubernetesManagementClientImpl class. + */ +public class HybridKubernetesManagementClientImpl extends AzureServiceClient { + /** the {@link AzureClient} used for long running operations. */ + private AzureClient azureClient; + + /** + * Gets the {@link AzureClient} used for long running operations. + * @return the azure client; + */ + public AzureClient getAzureClient() { + return this.azureClient; + } + + /** The API version to use for this operation. */ + private String apiVersion; + + /** + * Gets The API version to use for this operation. + * + * @return the apiVersion value. + */ + public String apiVersion() { + return this.apiVersion; + } + + /** The ID of the target subscription. */ + private String subscriptionId; + + /** + * Gets The ID of the target subscription. + * + * @return the subscriptionId value. + */ + public String subscriptionId() { + return this.subscriptionId; + } + + /** + * Sets The ID of the target subscription. + * + * @param subscriptionId the subscriptionId value. + * @return the service client itself + */ + public HybridKubernetesManagementClientImpl 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 HybridKubernetesManagementClientImpl 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 HybridKubernetesManagementClientImpl 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 HybridKubernetesManagementClientImpl withGenerateClientRequestId(boolean generateClientRequestId) { + this.generateClientRequestId = generateClientRequestId; + return this; + } + + /** + * The ConnectedClustersInner object to access its operations. + */ + private ConnectedClustersInner connectedClusters; + + /** + * Gets the ConnectedClustersInner object to access its operations. + * @return the ConnectedClustersInner object. + */ + public ConnectedClustersInner connectedClusters() { + return this.connectedClusters; + } + + /** + * The OperationsInner object to access its operations. + */ + private OperationsInner operations; + + /** + * Gets the OperationsInner object to access its operations. + * @return the OperationsInner object. + */ + public OperationsInner operations() { + return this.operations; + } + + /** + * Initializes an instance of HybridKubernetesManagementClient client. + * + * @param credentials the management credentials for Azure + */ + public HybridKubernetesManagementClientImpl(ServiceClientCredentials credentials) { + this("https://management.azure.com", credentials); + } + + /** + * Initializes an instance of HybridKubernetesManagementClient client. + * + * @param baseUrl the base URL of the host + * @param credentials the management credentials for Azure + */ + public HybridKubernetesManagementClientImpl(String baseUrl, ServiceClientCredentials credentials) { + super(baseUrl, credentials); + initialize(); + } + + /** + * Initializes an instance of HybridKubernetesManagementClient client. + * + * @param restClient the REST client to connect to Azure. + */ + public HybridKubernetesManagementClientImpl(RestClient restClient) { + super(restClient); + initialize(); + } + + protected void initialize() { + this.apiVersion = "2020-01-01-preview"; + this.acceptLanguage = "en-US"; + this.longRunningOperationRetryTimeout = 30; + this.generateClientRequestId = true; + this.connectedClusters = new ConnectedClustersInner(restClient().retrofit(), this); + this.operations = new OperationsInner(restClient().retrofit(), this); + this.azureClient = new AzureClient(this); + } + + /** + * Gets the User-Agent header for the client. + * + * @return the user agent string. + */ + @Override + public String userAgent() { + return String.format("%s (%s, %s, auto-generated)", super.userAgent(), "HybridKubernetesManagementClient", "2020-01-01-preview"); + } +} diff --git a/hybridkubernetes/resource-manager/v2020_01_01_preview/src/main/java/com/microsoft/azure/management/hybridkubernetes/v2020_01_01_preview/implementation/IdParsingUtils.java b/hybridkubernetes/resource-manager/v2020_01_01_preview/src/main/java/com/microsoft/azure/management/hybridkubernetes/v2020_01_01_preview/implementation/IdParsingUtils.java new file mode 100644 index 0000000000000..c633be3e244dd --- /dev/null +++ b/hybridkubernetes/resource-manager/v2020_01_01_preview/src/main/java/com/microsoft/azure/management/hybridkubernetes/v2020_01_01_preview/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.hybridkubernetes.v2020_01_01_preview.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/hybridkubernetes/resource-manager/v2020_01_01_preview/src/main/java/com/microsoft/azure/management/hybridkubernetes/v2020_01_01_preview/implementation/KubernetesManager.java b/hybridkubernetes/resource-manager/v2020_01_01_preview/src/main/java/com/microsoft/azure/management/hybridkubernetes/v2020_01_01_preview/implementation/KubernetesManager.java new file mode 100644 index 0000000000000..a244702ab0506 --- /dev/null +++ b/hybridkubernetes/resource-manager/v2020_01_01_preview/src/main/java/com/microsoft/azure/management/hybridkubernetes/v2020_01_01_preview/implementation/KubernetesManager.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.hybridkubernetes.v2020_01_01_preview.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.hybridkubernetes.v2020_01_01_preview.ConnectedClusters; +import com.microsoft.azure.management.hybridkubernetes.v2020_01_01_preview.Operations; +import com.microsoft.azure.arm.resources.implementation.AzureConfigurableCoreImpl; +import com.microsoft.azure.arm.resources.implementation.ManagerCore; + +/** + * Entry point to Azure Kubernetes resource management. + */ +public final class KubernetesManager extends ManagerCore { + private ConnectedClusters connectedClusters; + private Operations operations; + /** + * Get a Configurable instance that can be used to create KubernetesManager with optional configuration. + * + * @return the instance allowing configurations + */ + public static Configurable configure() { + return new KubernetesManager.ConfigurableImpl(); + } + /** + * Creates an instance of KubernetesManager that exposes Kubernetes resource management API entry points. + * + * @param credentials the credentials to use + * @param subscriptionId the subscription UUID + * @return the KubernetesManager + */ + public static KubernetesManager authenticate(AzureTokenCredentials credentials, String subscriptionId) { + return new KubernetesManager(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 KubernetesManager that exposes Kubernetes resource management API entry points. + * + * @param restClient the RestClient to be used for API calls. + * @param subscriptionId the subscription UUID + * @return the KubernetesManager + */ + public static KubernetesManager authenticate(RestClient restClient, String subscriptionId) { + return new KubernetesManager(restClient, subscriptionId); + } + /** + * The interface allowing configurations to be set. + */ + public interface Configurable extends AzureConfigurable { + /** + * Creates an instance of KubernetesManager that exposes Kubernetes management API entry points. + * + * @param credentials the credentials to use + * @param subscriptionId the subscription UUID + * @return the interface exposing Kubernetes management API entry points that work across subscriptions + */ + KubernetesManager authenticate(AzureTokenCredentials credentials, String subscriptionId); + } + + /** + * @return Entry point to manage ConnectedClusters. + */ + public ConnectedClusters connectedClusters() { + if (this.connectedClusters == null) { + this.connectedClusters = new ConnectedClustersImpl(this); + } + return this.connectedClusters; + } + + /** + * @return Entry point to manage Operations. + */ + public Operations operations() { + if (this.operations == null) { + this.operations = new OperationsImpl(this); + } + return this.operations; + } + + /** + * The implementation for Configurable interface. + */ + private static final class ConfigurableImpl extends AzureConfigurableCoreImpl implements Configurable { + public KubernetesManager authenticate(AzureTokenCredentials credentials, String subscriptionId) { + return KubernetesManager.authenticate(buildRestClient(credentials), subscriptionId); + } + } + private KubernetesManager(RestClient restClient, String subscriptionId) { + super( + restClient, + subscriptionId, + new HybridKubernetesManagementClientImpl(restClient).withSubscriptionId(subscriptionId)); + } +} diff --git a/hybridkubernetes/resource-manager/v2020_01_01_preview/src/main/java/com/microsoft/azure/management/hybridkubernetes/v2020_01_01_preview/implementation/OperationImpl.java b/hybridkubernetes/resource-manager/v2020_01_01_preview/src/main/java/com/microsoft/azure/management/hybridkubernetes/v2020_01_01_preview/implementation/OperationImpl.java new file mode 100644 index 0000000000000..33299721ae5e2 --- /dev/null +++ b/hybridkubernetes/resource-manager/v2020_01_01_preview/src/main/java/com/microsoft/azure/management/hybridkubernetes/v2020_01_01_preview/implementation/OperationImpl.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.hybridkubernetes.v2020_01_01_preview.implementation; + +import com.microsoft.azure.management.hybridkubernetes.v2020_01_01_preview.Operation; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.hybridkubernetes.v2020_01_01_preview.OperationDisplay; + +class OperationImpl extends WrapperImpl implements Operation { + private final KubernetesManager manager; + OperationImpl(OperationInner inner, KubernetesManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public KubernetesManager manager() { + return this.manager; + } + + @Override + public OperationDisplay display() { + return this.inner().display(); + } + + @Override + public String name() { + return this.inner().name(); + } + +} diff --git a/hybridkubernetes/resource-manager/v2020_01_01_preview/src/main/java/com/microsoft/azure/management/hybridkubernetes/v2020_01_01_preview/implementation/OperationInner.java b/hybridkubernetes/resource-manager/v2020_01_01_preview/src/main/java/com/microsoft/azure/management/hybridkubernetes/v2020_01_01_preview/implementation/OperationInner.java new file mode 100644 index 0000000000000..44b5168f4bf99 --- /dev/null +++ b/hybridkubernetes/resource-manager/v2020_01_01_preview/src/main/java/com/microsoft/azure/management/hybridkubernetes/v2020_01_01_preview/implementation/OperationInner.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.hybridkubernetes.v2020_01_01_preview.implementation; + +import com.microsoft.azure.management.hybridkubernetes.v2020_01_01_preview.OperationDisplay; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The Connected cluster API operation. + */ +public class OperationInner { + /** + * Operation name: {Microsoft.Kubernetes}/{resource}/{operation}. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /** + * The object that represents the operation. + */ + @JsonProperty(value = "display", access = JsonProperty.Access.WRITE_ONLY) + private OperationDisplay display; + + /** + * Get operation name: {Microsoft.Kubernetes}/{resource}/{operation}. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Get the object that represents the operation. + * + * @return the display value + */ + public OperationDisplay display() { + return this.display; + } + +} diff --git a/hybridkubernetes/resource-manager/v2020_01_01_preview/src/main/java/com/microsoft/azure/management/hybridkubernetes/v2020_01_01_preview/implementation/OperationsImpl.java b/hybridkubernetes/resource-manager/v2020_01_01_preview/src/main/java/com/microsoft/azure/management/hybridkubernetes/v2020_01_01_preview/implementation/OperationsImpl.java new file mode 100644 index 0000000000000..ac094fb5a4dfa --- /dev/null +++ b/hybridkubernetes/resource-manager/v2020_01_01_preview/src/main/java/com/microsoft/azure/management/hybridkubernetes/v2020_01_01_preview/implementation/OperationsImpl.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.hybridkubernetes.v2020_01_01_preview.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.hybridkubernetes.v2020_01_01_preview.Operations; +import rx.functions.Func1; +import rx.Observable; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.hybridkubernetes.v2020_01_01_preview.Operation; + +class OperationsImpl extends WrapperImpl implements Operations { + private final KubernetesManager manager; + + OperationsImpl(KubernetesManager manager) { + super(manager.inner().operations()); + this.manager = manager; + } + + public KubernetesManager manager() { + return this.manager; + } + + @Override + public Observable getAsync() { + OperationsInner client = this.inner(); + return client.getAsync() + .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/hybridkubernetes/resource-manager/v2020_01_01_preview/src/main/java/com/microsoft/azure/management/hybridkubernetes/v2020_01_01_preview/implementation/OperationsInner.java b/hybridkubernetes/resource-manager/v2020_01_01_preview/src/main/java/com/microsoft/azure/management/hybridkubernetes/v2020_01_01_preview/implementation/OperationsInner.java new file mode 100644 index 0000000000000..2a54acb2a4058 --- /dev/null +++ b/hybridkubernetes/resource-manager/v2020_01_01_preview/src/main/java/com/microsoft/azure/management/hybridkubernetes/v2020_01_01_preview/implementation/OperationsInner.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.hybridkubernetes.v2020_01_01_preview.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.hybridkubernetes.v2020_01_01_preview.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.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 HybridKubernetesManagementClientImpl 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, HybridKubernetesManagementClientImpl 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.hybridkubernetes.v2020_01_01_preview.Operations get" }) + @GET("providers/Microsoft.Kubernetes/operations") + Observable> get(@Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.hybridkubernetes.v2020_01_01_preview.Operations getNext" }) + @GET + Observable> getNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Lists all of the available API operations for Connected Cluster resource. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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 get() { + ServiceResponse> response = getSinglePageAsync().toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return getNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists all of the available API operations for Connected Cluster resource. + * + * @param serviceCallback 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(final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + getSinglePageAsync(), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return getNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists all of the available API operations for Connected Cluster resource. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<OperationInner> object + */ + public Observable> getAsync() { + return getWithServiceResponseAsync() + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all of the available API operations for Connected Cluster resource. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<OperationInner> object + */ + public Observable>> getWithServiceResponseAsync() { + return getSinglePageAsync() + .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(getNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists all of the available API operations for Connected Cluster resource. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<OperationInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> getSinglePageAsync() { + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.get(this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = getDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> getDelegate(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 of the available API operations for Connected Cluster resource. + * + * @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<OperationInner> object if successful. + */ + public PagedList getNext(final String nextPageLink) { + ServiceResponse> response = getNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return getNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists all of the available API operations for Connected Cluster resource. + * + * @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> getNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + getNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return getNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists all of the available API operations for Connected Cluster resource. + * + * @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> getNextAsync(final String nextPageLink) { + return getNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all of the available API operations for Connected Cluster resource. + * + * @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>> getNextWithServiceResponseAsync(final String nextPageLink) { + return getNextSinglePageAsync(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(getNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists all of the available API operations for Connected Cluster resource. + * + 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>> getNextSinglePageAsync(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.getNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = getNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> getNextDelegate(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/hybridkubernetes/resource-manager/v2020_01_01_preview/src/main/java/com/microsoft/azure/management/hybridkubernetes/v2020_01_01_preview/implementation/PageImpl.java b/hybridkubernetes/resource-manager/v2020_01_01_preview/src/main/java/com/microsoft/azure/management/hybridkubernetes/v2020_01_01_preview/implementation/PageImpl.java new file mode 100644 index 0000000000000..19c47d8cce132 --- /dev/null +++ b/hybridkubernetes/resource-manager/v2020_01_01_preview/src/main/java/com/microsoft/azure/management/hybridkubernetes/v2020_01_01_preview/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.hybridkubernetes.v2020_01_01_preview.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/hybridkubernetes/resource-manager/v2020_01_01_preview/src/main/java/com/microsoft/azure/management/hybridkubernetes/v2020_01_01_preview/implementation/package-info.java b/hybridkubernetes/resource-manager/v2020_01_01_preview/src/main/java/com/microsoft/azure/management/hybridkubernetes/v2020_01_01_preview/implementation/package-info.java new file mode 100644 index 0000000000000..8f8c422b0002a --- /dev/null +++ b/hybridkubernetes/resource-manager/v2020_01_01_preview/src/main/java/com/microsoft/azure/management/hybridkubernetes/v2020_01_01_preview/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 HybridKubernetesManagementClient. + * Hybrid Kubernetes Client. + */ +package com.microsoft.azure.management.hybridkubernetes.v2020_01_01_preview.implementation; diff --git a/hybridkubernetes/resource-manager/v2020_01_01_preview/src/main/java/com/microsoft/azure/management/hybridkubernetes/v2020_01_01_preview/package-info.java b/hybridkubernetes/resource-manager/v2020_01_01_preview/src/main/java/com/microsoft/azure/management/hybridkubernetes/v2020_01_01_preview/package-info.java new file mode 100644 index 0000000000000..3c2cf93bdfe2b --- /dev/null +++ b/hybridkubernetes/resource-manager/v2020_01_01_preview/src/main/java/com/microsoft/azure/management/hybridkubernetes/v2020_01_01_preview/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 HybridKubernetesManagementClient. + * Hybrid Kubernetes Client. + */ +package com.microsoft.azure.management.hybridkubernetes.v2020_01_01_preview;