diff --git a/managedserviceidentity/resource-manager/v2015_08_31_preview/pom.xml b/managedserviceidentity/resource-manager/v2015_08_31_preview/pom.xml new file mode 100644 index 000000000000..08f99e0036b4 --- /dev/null +++ b/managedserviceidentity/resource-manager/v2015_08_31_preview/pom.xml @@ -0,0 +1,133 @@ + + + 4.0.0 + com.microsoft.azure.managedserviceidentity.v2015_08_31_preview + + com.microsoft.azure + azure-arm-parent + 0.0.2-beta + ../../../pom.xml + + azure-mgmt-managedidentity + 1.0.0-beta + jar + Microsoft Azure SDK for ManagedIdentity Management + This package contains Microsoft ManagedIdentity Management SDK. + https://github.com/Azure/azure-libraries-for-java + + + The MIT License (MIT) + http://opensource.org/licenses/MIT + repo + + + + scm:git:https://github.com/Azure/azure-libraries-for-java + scm:git:git@github.com:Azure/azure-libraries-for-java.git + HEAD + + + UTF-8 + + + + + microsoft + Microsoft + + + + + com.microsoft.azure + azure-client-runtime + + + com.microsoft.azure + azure-arm-client-runtime + + + junit + junit + test + + + com.microsoft.azure + azure-client-authentication + test + + + com.microsoft.azure + azure-mgmt-resources + test + + + com.microsoft.azure + azure-arm-client-runtime + test-jar + test + + + + + + org.apache.maven.plugins + maven-jar-plugin + + + + true + true + + + + + + org.codehaus.mojo + build-helper-maven-plugin + + + org.apache.maven.plugins + maven-compiler-plugin + 3.1 + + 1.7 + 1.7 + + + com.microsoft.azure.management.apigeneration.LangDefinitionProcessor + + + true + true + + true + true + + + + + org.apache.maven.plugins + maven-javadoc-plugin + 2.8 + + *.implementation.*;*.utils.*;com.microsoft.schemas._2003._10.serialization;*.blob.core.search + + + /** +
* Copyright (c) Microsoft Corporation. All rights reserved. +
* Licensed under the MIT License. See License.txt in the project root for +
* license information. +
*/ + ]]> +
+
+
+
+
+
diff --git a/managedserviceidentity/resource-manager/v2015_08_31_preview/src/main/java/com/microsoft/azure/management/managedserviceidentity/v2015_08_31_preview/Identity.java b/managedserviceidentity/resource-manager/v2015_08_31_preview/src/main/java/com/microsoft/azure/management/managedserviceidentity/v2015_08_31_preview/Identity.java new file mode 100644 index 000000000000..3070cd39c5ad --- /dev/null +++ b/managedserviceidentity/resource-manager/v2015_08_31_preview/src/main/java/com/microsoft/azure/management/managedserviceidentity/v2015_08_31_preview/Identity.java @@ -0,0 +1,89 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.managedserviceidentity.v2015_08_31_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.managedserviceidentity.v2015_08_31_preview.implementation.ManagedIdentityManager; +import java.util.UUID; +import com.microsoft.azure.management.managedserviceidentity.v2015_08_31_preview.implementation.IdentityInner; + +/** + * Type representing Identity. + */ +public interface Identity extends HasInner, Resource, GroupableResourceCore, HasResourceGroup, Refreshable, Updatable, HasManager { + /** + * @return the clientId value. + */ + UUID clientId(); + + /** + * @return the clientSecretUrl value. + */ + String clientSecretUrl(); + + /** + * @return the principalId value. + */ + UUID principalId(); + + /** + * @return the tenantId value. + */ + UUID tenantId(); + + /** + * The entirety of the Identity definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithGroup, DefinitionStages.WithCreate { + } + + /** + * Grouping of Identity definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a Identity definition. + */ + interface Blank extends GroupableResourceCore.DefinitionWithRegion { + } + + /** + * The stage of the Identity definition allowing to specify the resource group. + */ + interface WithGroup extends GroupableResourceCore.DefinitionStages.WithGroup { + } + + /** + * 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 { + } + } + /** + * The template for a Identity update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, Resource.UpdateWithTags { + } + + /** + * Grouping of Identity update stages. + */ + interface UpdateStages { + } +} diff --git a/managedserviceidentity/resource-manager/v2015_08_31_preview/src/main/java/com/microsoft/azure/management/managedserviceidentity/v2015_08_31_preview/Operation.java b/managedserviceidentity/resource-manager/v2015_08_31_preview/src/main/java/com/microsoft/azure/management/managedserviceidentity/v2015_08_31_preview/Operation.java new file mode 100644 index 000000000000..055ce3b21267 --- /dev/null +++ b/managedserviceidentity/resource-manager/v2015_08_31_preview/src/main/java/com/microsoft/azure/management/managedserviceidentity/v2015_08_31_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.managedserviceidentity.v2015_08_31_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.managedserviceidentity.v2015_08_31_preview.implementation.ManagedIdentityManager; +import com.microsoft.azure.management.managedserviceidentity.v2015_08_31_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/managedserviceidentity/resource-manager/v2015_08_31_preview/src/main/java/com/microsoft/azure/management/managedserviceidentity/v2015_08_31_preview/OperationDisplay.java b/managedserviceidentity/resource-manager/v2015_08_31_preview/src/main/java/com/microsoft/azure/management/managedserviceidentity/v2015_08_31_preview/OperationDisplay.java new file mode 100644 index 000000000000..677b0d022609 --- /dev/null +++ b/managedserviceidentity/resource-manager/v2015_08_31_preview/src/main/java/com/microsoft/azure/management/managedserviceidentity/v2015_08_31_preview/OperationDisplay.java @@ -0,0 +1,126 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.managedserviceidentity.v2015_08_31_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Operation Display. + * The object that describes the operation. + */ +public class OperationDisplay { + /** + * Resource Provider Name. + * Friendly name of the resource provider. + */ + @JsonProperty(value = "provider") + private String provider; + + /** + * Operation Type. + * The type of operation. For example: read, write, delete. + */ + @JsonProperty(value = "operation") + private String operation; + + /** + * Resource Type. + * The resource type on which the operation is performed. + */ + @JsonProperty(value = "resource") + private String resource; + + /** + * Operation description. + * A description of the operation. + */ + @JsonProperty(value = "description") + private String description; + + /** + * Get friendly name of the resource provider. + * + * @return the provider value + */ + public String provider() { + return this.provider; + } + + /** + * Set friendly name of the resource provider. + * + * @param provider the provider value to set + * @return the OperationDisplay object itself. + */ + public OperationDisplay withProvider(String provider) { + this.provider = provider; + return this; + } + + /** + * Get the type of operation. For example: read, write, delete. + * + * @return the operation value + */ + public String operation() { + return this.operation; + } + + /** + * Set the type of operation. For example: read, write, delete. + * + * @param operation the operation value to set + * @return the OperationDisplay object itself. + */ + public OperationDisplay withOperation(String operation) { + this.operation = operation; + return this; + } + + /** + * Get the resource type on which the operation is performed. + * + * @return the resource value + */ + public String resource() { + return this.resource; + } + + /** + * Set the resource type on which the operation is performed. + * + * @param resource the resource value to set + * @return the OperationDisplay object itself. + */ + public OperationDisplay withResource(String resource) { + this.resource = resource; + return this; + } + + /** + * Get a description of the operation. + * + * @return the description value + */ + public String description() { + return this.description; + } + + /** + * Set a 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/managedserviceidentity/resource-manager/v2015_08_31_preview/src/main/java/com/microsoft/azure/management/managedserviceidentity/v2015_08_31_preview/Operations.java b/managedserviceidentity/resource-manager/v2015_08_31_preview/src/main/java/com/microsoft/azure/management/managedserviceidentity/v2015_08_31_preview/Operations.java new file mode 100644 index 000000000000..3cb6e40110f4 --- /dev/null +++ b/managedserviceidentity/resource-manager/v2015_08_31_preview/src/main/java/com/microsoft/azure/management/managedserviceidentity/v2015_08_31_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.managedserviceidentity.v2015_08_31_preview; + +import rx.Observable; +import com.microsoft.azure.management.managedserviceidentity.v2015_08_31_preview.implementation.OperationsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing Operations. + */ +public interface Operations extends HasInner { + /** + * Lists available operations for the Microsoft.ManagedIdentity provider. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listAsync(); + +} diff --git a/managedserviceidentity/resource-manager/v2015_08_31_preview/src/main/java/com/microsoft/azure/management/managedserviceidentity/v2015_08_31_preview/UserAssignedIdentities.java b/managedserviceidentity/resource-manager/v2015_08_31_preview/src/main/java/com/microsoft/azure/management/managedserviceidentity/v2015_08_31_preview/UserAssignedIdentities.java new file mode 100644 index 000000000000..17596872e4d0 --- /dev/null +++ b/managedserviceidentity/resource-manager/v2015_08_31_preview/src/main/java/com/microsoft/azure/management/managedserviceidentity/v2015_08_31_preview/UserAssignedIdentities.java @@ -0,0 +1,38 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.managedserviceidentity.v2015_08_31_preview; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for UserAssignedIdentities. + */ +public final class UserAssignedIdentities extends ExpandableStringEnum { + /** Static value Microsoft.ManagedIdentity/userAssignedIdentities for UserAssignedIdentities. */ + public static final UserAssignedIdentities MICROSOFT_MANAGED_IDENTITYUSER_ASSIGNED_IDENTITIES = fromString("Microsoft.ManagedIdentity/userAssignedIdentities"); + + /** + * Creates or finds a UserAssignedIdentities from its string representation. + * @param name a name to look for + * @return the corresponding UserAssignedIdentities + */ + @JsonCreator + public static UserAssignedIdentities fromString(String name) { + return fromString(name, UserAssignedIdentities.class); + } + + /** + * @return known UserAssignedIdentities values + */ + public static Collection values() { + return values(UserAssignedIdentities.class); + } +} diff --git a/managedserviceidentity/resource-manager/v2015_08_31_preview/src/main/java/com/microsoft/azure/management/managedserviceidentity/v2015_08_31_preview/implementation/IdParsingUtils.java b/managedserviceidentity/resource-manager/v2015_08_31_preview/src/main/java/com/microsoft/azure/management/managedserviceidentity/v2015_08_31_preview/implementation/IdParsingUtils.java new file mode 100644 index 000000000000..7b3df1d6280e --- /dev/null +++ b/managedserviceidentity/resource-manager/v2015_08_31_preview/src/main/java/com/microsoft/azure/management/managedserviceidentity/v2015_08_31_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.managedserviceidentity.v2015_08_31_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/managedserviceidentity/resource-manager/v2015_08_31_preview/src/main/java/com/microsoft/azure/management/managedserviceidentity/v2015_08_31_preview/implementation/IdentityImpl.java b/managedserviceidentity/resource-manager/v2015_08_31_preview/src/main/java/com/microsoft/azure/management/managedserviceidentity/v2015_08_31_preview/implementation/IdentityImpl.java new file mode 100644 index 000000000000..e523f91caeeb --- /dev/null +++ b/managedserviceidentity/resource-manager/v2015_08_31_preview/src/main/java/com/microsoft/azure/management/managedserviceidentity/v2015_08_31_preview/implementation/IdentityImpl.java @@ -0,0 +1,67 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.managedserviceidentity.v2015_08_31_preview.implementation; + +import com.microsoft.azure.arm.resources.models.implementation.GroupableResourceCoreImpl; +import com.microsoft.azure.management.managedserviceidentity.v2015_08_31_preview.Identity; +import rx.Observable; +import java.util.UUID; + +class IdentityImpl extends GroupableResourceCoreImpl implements Identity, Identity.Definition, Identity.Update { + IdentityImpl(String name, IdentityInner inner, ManagedIdentityManager manager) { + super(name, inner, manager); + } + + @Override + public Observable createResourceAsync() { + UserAssignedIdentitiesInner client = this.manager().inner().userAssignedIdentities(); + return client.createOrUpdateAsync(this.resourceGroupName(), this.name(), this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + UserAssignedIdentitiesInner client = this.manager().inner().userAssignedIdentities(); + return client.updateAsync(this.resourceGroupName(), this.name(), this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + UserAssignedIdentitiesInner client = this.manager().inner().userAssignedIdentities(); + return client.getByResourceGroupAsync(this.resourceGroupName(), this.name()); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + + @Override + public UUID clientId() { + return this.inner().clientId(); + } + + @Override + public String clientSecretUrl() { + return this.inner().clientSecretUrl(); + } + + @Override + public UUID principalId() { + return this.inner().principalId(); + } + + @Override + public UUID tenantId() { + return this.inner().tenantId(); + } + +} diff --git a/managedserviceidentity/resource-manager/v2015_08_31_preview/src/main/java/com/microsoft/azure/management/managedserviceidentity/v2015_08_31_preview/implementation/IdentityInner.java b/managedserviceidentity/resource-manager/v2015_08_31_preview/src/main/java/com/microsoft/azure/management/managedserviceidentity/v2015_08_31_preview/implementation/IdentityInner.java new file mode 100644 index 000000000000..6ef43905d34e --- /dev/null +++ b/managedserviceidentity/resource-manager/v2015_08_31_preview/src/main/java/com/microsoft/azure/management/managedserviceidentity/v2015_08_31_preview/implementation/IdentityInner.java @@ -0,0 +1,84 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.managedserviceidentity.v2015_08_31_preview.implementation; + +import java.util.UUID; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.Resource; + +/** + * Describes an identity resource. + */ +@JsonFlatten +public class IdentityInner extends Resource { + /** + * The id of the tenant which the identity belongs to. + */ + @JsonProperty(value = "properties.tenantId", access = JsonProperty.Access.WRITE_ONLY) + private UUID tenantId; + + /** + * The id of the service principal object associated with the created + * identity. + */ + @JsonProperty(value = "properties.principalId", access = JsonProperty.Access.WRITE_ONLY) + private UUID principalId; + + /** + * The id of the app associated with the identity. This is a random + * generated UUID by MSI. + */ + @JsonProperty(value = "properties.clientId", access = JsonProperty.Access.WRITE_ONLY) + private UUID clientId; + + /** + * The ManagedServiceIdentity DataPlane URL that can be queried to obtain + * the identity credentials. + */ + @JsonProperty(value = "properties.clientSecretUrl", access = JsonProperty.Access.WRITE_ONLY) + private String clientSecretUrl; + + /** + * Get the id of the tenant which the identity belongs to. + * + * @return the tenantId value + */ + public UUID tenantId() { + return this.tenantId; + } + + /** + * Get the id of the service principal object associated with the created identity. + * + * @return the principalId value + */ + public UUID principalId() { + return this.principalId; + } + + /** + * Get the id of the app associated with the identity. This is a random generated UUID by MSI. + * + * @return the clientId value + */ + public UUID clientId() { + return this.clientId; + } + + /** + * Get the ManagedServiceIdentity DataPlane URL that can be queried to obtain the identity credentials. + * + * @return the clientSecretUrl value + */ + public String clientSecretUrl() { + return this.clientSecretUrl; + } + +} diff --git a/managedserviceidentity/resource-manager/v2015_08_31_preview/src/main/java/com/microsoft/azure/management/managedserviceidentity/v2015_08_31_preview/implementation/ManagedIdentityManager.java b/managedserviceidentity/resource-manager/v2015_08_31_preview/src/main/java/com/microsoft/azure/management/managedserviceidentity/v2015_08_31_preview/implementation/ManagedIdentityManager.java new file mode 100644 index 000000000000..922a282cee79 --- /dev/null +++ b/managedserviceidentity/resource-manager/v2015_08_31_preview/src/main/java/com/microsoft/azure/management/managedserviceidentity/v2015_08_31_preview/implementation/ManagedIdentityManager.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.managedserviceidentity.v2015_08_31_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.managedserviceidentity.v2015_08_31_preview.Operations; +import com.microsoft.azure.management.managedserviceidentity.v2015_08_31_preview.UserAssignedIdentities; +import com.microsoft.azure.arm.resources.implementation.AzureConfigurableCoreImpl; +import com.microsoft.azure.arm.resources.implementation.ManagerCore; + +/** + * Entry point to Azure ManagedIdentity resource management. + */ +public final class ManagedIdentityManager extends ManagerCore { + private Operations operations; + private UserAssignedIdentities userAssignedIdentities; + /** + * Get a Configurable instance that can be used to create ManagedIdentityManager with optional configuration. + * + * @return the instance allowing configurations + */ + public static Configurable configure() { + return new ManagedIdentityManager.ConfigurableImpl(); + } + /** + * Creates an instance of ManagedIdentityManager that exposes ManagedIdentity resource management API entry points. + * + * @param credentials the credentials to use + * @param subscriptionId the subscription UUID + * @return the ManagedIdentityManager + */ + public static ManagedIdentityManager authenticate(AzureTokenCredentials credentials, String subscriptionId) { + return new ManagedIdentityManager(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 ManagedIdentityManager that exposes ManagedIdentity resource management API entry points. + * + * @param restClient the RestClient to be used for API calls. + * @param subscriptionId the subscription UUID + * @return the ManagedIdentityManager + */ + public static ManagedIdentityManager authenticate(RestClient restClient, String subscriptionId) { + return new ManagedIdentityManager(restClient, subscriptionId); + } + /** + * The interface allowing configurations to be set. + */ + public interface Configurable extends AzureConfigurable { + /** + * Creates an instance of ManagedIdentityManager that exposes ManagedIdentity management API entry points. + * + * @param credentials the credentials to use + * @param subscriptionId the subscription UUID + * @return the interface exposing ManagedIdentity management API entry points that work across subscriptions + */ + ManagedIdentityManager authenticate(AzureTokenCredentials credentials, String subscriptionId); + } + + /** + * @return Entry point to manage Operations. + */ + public Operations operations() { + if (this.operations == null) { + this.operations = new OperationsImpl(this); + } + return this.operations; + } + + /** + * @return Entry point to manage UserAssignedIdentities. + */ + public UserAssignedIdentities userAssignedIdentities() { + if (this.userAssignedIdentities == null) { + this.userAssignedIdentities = new UserAssignedIdentitiesImpl(this); + } + return this.userAssignedIdentities; + } + + /** + * The implementation for Configurable interface. + */ + private static final class ConfigurableImpl extends AzureConfigurableCoreImpl implements Configurable { + public ManagedIdentityManager authenticate(AzureTokenCredentials credentials, String subscriptionId) { + return ManagedIdentityManager.authenticate(buildRestClient(credentials), subscriptionId); + } + } + private ManagedIdentityManager(RestClient restClient, String subscriptionId) { + super( + restClient, + subscriptionId, + new ManagedServiceIdentityClientImpl(restClient).withSubscriptionId(subscriptionId)); + } +} diff --git a/managedserviceidentity/resource-manager/v2015_08_31_preview/src/main/java/com/microsoft/azure/management/managedserviceidentity/v2015_08_31_preview/implementation/ManagedServiceIdentityClientImpl.java b/managedserviceidentity/resource-manager/v2015_08_31_preview/src/main/java/com/microsoft/azure/management/managedserviceidentity/v2015_08_31_preview/implementation/ManagedServiceIdentityClientImpl.java new file mode 100644 index 000000000000..1191627bee93 --- /dev/null +++ b/managedserviceidentity/resource-manager/v2015_08_31_preview/src/main/java/com/microsoft/azure/management/managedserviceidentity/v2015_08_31_preview/implementation/ManagedServiceIdentityClientImpl.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.managedserviceidentity.v2015_08_31_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 ManagedServiceIdentityClientImpl class. + */ +public class ManagedServiceIdentityClientImpl 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 Id of the Subscription to which the identity belongs. */ + private String subscriptionId; + + /** + * Gets The Id of the Subscription to which the identity belongs. + * + * @return the subscriptionId value. + */ + public String subscriptionId() { + return this.subscriptionId; + } + + /** + * Sets The Id of the Subscription to which the identity belongs. + * + * @param subscriptionId the subscriptionId value. + * @return the service client itself + */ + public ManagedServiceIdentityClientImpl withSubscriptionId(String subscriptionId) { + this.subscriptionId = subscriptionId; + return this; + } + + /** Version of API to invoke. */ + private String apiVersion; + + /** + * Gets Version of API to invoke. + * + * @return the apiVersion value. + */ + public String apiVersion() { + return this.apiVersion; + } + + /** Gets or sets the preferred language for the response. */ + private String acceptLanguage; + + /** + * Gets Gets or sets the preferred language for the response. + * + * @return the acceptLanguage value. + */ + public String acceptLanguage() { + return this.acceptLanguage; + } + + /** + * Sets Gets or sets the preferred language for the response. + * + * @param acceptLanguage the acceptLanguage value. + * @return the service client itself + */ + public ManagedServiceIdentityClientImpl withAcceptLanguage(String acceptLanguage) { + this.acceptLanguage = acceptLanguage; + return this; + } + + /** Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30. */ + private int longRunningOperationRetryTimeout; + + /** + * Gets Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30. + * + * @return the longRunningOperationRetryTimeout value. + */ + public int longRunningOperationRetryTimeout() { + return this.longRunningOperationRetryTimeout; + } + + /** + * Sets Gets or 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 ManagedServiceIdentityClientImpl withLongRunningOperationRetryTimeout(int longRunningOperationRetryTimeout) { + this.longRunningOperationRetryTimeout = longRunningOperationRetryTimeout; + return this; + } + + /** 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 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 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 ManagedServiceIdentityClientImpl withGenerateClientRequestId(boolean generateClientRequestId) { + this.generateClientRequestId = generateClientRequestId; + return this; + } + + /** + * The OperationsInner object to access its operations. + */ + private OperationsInner operations; + + /** + * Gets the OperationsInner object to access its operations. + * @return the OperationsInner object. + */ + public OperationsInner operations() { + return this.operations; + } + + /** + * The UserAssignedIdentitiesInner object to access its operations. + */ + private UserAssignedIdentitiesInner userAssignedIdentities; + + /** + * Gets the UserAssignedIdentitiesInner object to access its operations. + * @return the UserAssignedIdentitiesInner object. + */ + public UserAssignedIdentitiesInner userAssignedIdentities() { + return this.userAssignedIdentities; + } + + /** + * Initializes an instance of ManagedServiceIdentityClient client. + * + * @param credentials the management credentials for Azure + */ + public ManagedServiceIdentityClientImpl(ServiceClientCredentials credentials) { + this("https://management.azure.com", credentials); + } + + /** + * Initializes an instance of ManagedServiceIdentityClient client. + * + * @param baseUrl the base URL of the host + * @param credentials the management credentials for Azure + */ + public ManagedServiceIdentityClientImpl(String baseUrl, ServiceClientCredentials credentials) { + super(baseUrl, credentials); + initialize(); + } + + /** + * Initializes an instance of ManagedServiceIdentityClient client. + * + * @param restClient the REST client to connect to Azure. + */ + public ManagedServiceIdentityClientImpl(RestClient restClient) { + super(restClient); + initialize(); + } + + protected void initialize() { + this.apiVersion = "2015-08-31-preview"; + this.acceptLanguage = "en-US"; + this.longRunningOperationRetryTimeout = 30; + this.generateClientRequestId = true; + this.operations = new OperationsInner(restClient().retrofit(), this); + this.userAssignedIdentities = new UserAssignedIdentitiesInner(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)", super.userAgent(), "ManagedServiceIdentityClient", "2015-08-31-preview"); + } +} diff --git a/managedserviceidentity/resource-manager/v2015_08_31_preview/src/main/java/com/microsoft/azure/management/managedserviceidentity/v2015_08_31_preview/implementation/OperationImpl.java b/managedserviceidentity/resource-manager/v2015_08_31_preview/src/main/java/com/microsoft/azure/management/managedserviceidentity/v2015_08_31_preview/implementation/OperationImpl.java new file mode 100644 index 000000000000..494d94def2f0 --- /dev/null +++ b/managedserviceidentity/resource-manager/v2015_08_31_preview/src/main/java/com/microsoft/azure/management/managedserviceidentity/v2015_08_31_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.managedserviceidentity.v2015_08_31_preview.implementation; + +import com.microsoft.azure.management.managedserviceidentity.v2015_08_31_preview.Operation; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.managedserviceidentity.v2015_08_31_preview.OperationDisplay; + +class OperationImpl extends WrapperImpl implements Operation { + private final ManagedIdentityManager manager; + OperationImpl(OperationInner inner, ManagedIdentityManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public ManagedIdentityManager manager() { + return this.manager; + } + + @Override + public OperationDisplay display() { + return this.inner().display(); + } + + @Override + public String name() { + return this.inner().name(); + } + +} diff --git a/managedserviceidentity/resource-manager/v2015_08_31_preview/src/main/java/com/microsoft/azure/management/managedserviceidentity/v2015_08_31_preview/implementation/OperationInner.java b/managedserviceidentity/resource-manager/v2015_08_31_preview/src/main/java/com/microsoft/azure/management/managedserviceidentity/v2015_08_31_preview/implementation/OperationInner.java new file mode 100644 index 000000000000..ce63bff87960 --- /dev/null +++ b/managedserviceidentity/resource-manager/v2015_08_31_preview/src/main/java/com/microsoft/azure/management/managedserviceidentity/v2015_08_31_preview/implementation/OperationInner.java @@ -0,0 +1,74 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.managedserviceidentity.v2015_08_31_preview.implementation; + +import com.microsoft.azure.management.managedserviceidentity.v2015_08_31_preview.OperationDisplay; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Microsoft.ManagedIdentity Operation. + * Operation supported by the Microsoft.ManagedIdentity REST API. + */ +public class OperationInner { + /** + * Operation Name. + * The name of the REST Operation. This is of the format + * {provider}/{resource}/{operation}. + */ + @JsonProperty(value = "name") + private String name; + + /** + * Operation Display. + * The object that describes the operation. + */ + @JsonProperty(value = "display") + private OperationDisplay display; + + /** + * Get the name of the REST Operation. This is of the format {provider}/{resource}/{operation}. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set the name of the REST Operation. This is of the format {provider}/{resource}/{operation}. + * + * @param name the name value to set + * @return the OperationInner object itself. + */ + public OperationInner withName(String name) { + this.name = name; + return this; + } + + /** + * Get the object that describes the operation. + * + * @return the display value + */ + public OperationDisplay display() { + return this.display; + } + + /** + * Set the object that describes the operation. + * + * @param display the display value to set + * @return the OperationInner object itself. + */ + public OperationInner withDisplay(OperationDisplay display) { + this.display = display; + return this; + } + +} diff --git a/managedserviceidentity/resource-manager/v2015_08_31_preview/src/main/java/com/microsoft/azure/management/managedserviceidentity/v2015_08_31_preview/implementation/OperationsImpl.java b/managedserviceidentity/resource-manager/v2015_08_31_preview/src/main/java/com/microsoft/azure/management/managedserviceidentity/v2015_08_31_preview/implementation/OperationsImpl.java new file mode 100644 index 000000000000..dc6fd812eeff --- /dev/null +++ b/managedserviceidentity/resource-manager/v2015_08_31_preview/src/main/java/com/microsoft/azure/management/managedserviceidentity/v2015_08_31_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.managedserviceidentity.v2015_08_31_preview.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.managedserviceidentity.v2015_08_31_preview.Operations; +import rx.functions.Func1; +import rx.Observable; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.managedserviceidentity.v2015_08_31_preview.Operation; + +class OperationsImpl extends WrapperImpl implements Operations { + private final ManagedIdentityManager manager; + + OperationsImpl(ManagedIdentityManager manager) { + super(manager.inner().operations()); + this.manager = manager; + } + + public ManagedIdentityManager manager() { + return this.manager; + } + + @Override + public Observable listAsync() { + OperationsInner client = this.inner(); + return client.listAsync() + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public Operation call(OperationInner inner) { + return new OperationImpl(inner, manager()); + } + }); + } + +} diff --git a/managedserviceidentity/resource-manager/v2015_08_31_preview/src/main/java/com/microsoft/azure/management/managedserviceidentity/v2015_08_31_preview/implementation/OperationsInner.java b/managedserviceidentity/resource-manager/v2015_08_31_preview/src/main/java/com/microsoft/azure/management/managedserviceidentity/v2015_08_31_preview/implementation/OperationsInner.java new file mode 100644 index 000000000000..3abb9e69383b --- /dev/null +++ b/managedserviceidentity/resource-manager/v2015_08_31_preview/src/main/java/com/microsoft/azure/management/managedserviceidentity/v2015_08_31_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.managedserviceidentity.v2015_08_31_preview.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.CloudException; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Query; +import retrofit2.http.Url; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in Operations. + */ +public class OperationsInner { + /** The Retrofit service to perform REST calls. */ + private OperationsService service; + /** The service client containing this operation class. */ + private ManagedServiceIdentityClientImpl 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, ManagedServiceIdentityClientImpl 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.managedserviceidentity.v2015_08_31_preview.Operations list" }) + @GET("providers/Microsoft.ManagedIdentity/operations") + Observable> list(@Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.managedserviceidentity.v2015_08_31_preview.Operations listNext" }) + @GET + Observable> listNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Lists available operations for the Microsoft.ManagedIdentity provider. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<OperationInner> object if successful. + */ + public PagedList list() { + ServiceResponse> response = listSinglePageAsync().toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists available operations for the Microsoft.ManagedIdentity provider. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAsync(final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists available operations for the Microsoft.ManagedIdentity provider. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<OperationInner> object + */ + public Observable> listAsync() { + return listWithServiceResponseAsync() + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists available operations for the Microsoft.ManagedIdentity provider. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<OperationInner> object + */ + public Observable>> listWithServiceResponseAsync() { + return listSinglePageAsync() + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists available operations for the Microsoft.ManagedIdentity provider. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<OperationInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync() { + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.list(this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Lists available operations for the Microsoft.ManagedIdentity provider. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<OperationInner> object if successful. + */ + public PagedList listNext(final String nextPageLink) { + ServiceResponse> response = listNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists available operations for the Microsoft.ManagedIdentity provider. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists available operations for the Microsoft.ManagedIdentity provider. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<OperationInner> object + */ + public Observable> listNextAsync(final String nextPageLink) { + return listNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists available operations for the Microsoft.ManagedIdentity provider. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<OperationInner> object + */ + public Observable>> listNextWithServiceResponseAsync(final String nextPageLink) { + return listNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists available operations for the Microsoft.ManagedIdentity provider. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<OperationInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listNextDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + +} diff --git a/managedserviceidentity/resource-manager/v2015_08_31_preview/src/main/java/com/microsoft/azure/management/managedserviceidentity/v2015_08_31_preview/implementation/PageImpl.java b/managedserviceidentity/resource-manager/v2015_08_31_preview/src/main/java/com/microsoft/azure/management/managedserviceidentity/v2015_08_31_preview/implementation/PageImpl.java new file mode 100644 index 000000000000..a4e81c6796cc --- /dev/null +++ b/managedserviceidentity/resource-manager/v2015_08_31_preview/src/main/java/com/microsoft/azure/management/managedserviceidentity/v2015_08_31_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.managedserviceidentity.v2015_08_31_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/managedserviceidentity/resource-manager/v2015_08_31_preview/src/main/java/com/microsoft/azure/management/managedserviceidentity/v2015_08_31_preview/implementation/UserAssignedIdentitiesImpl.java b/managedserviceidentity/resource-manager/v2015_08_31_preview/src/main/java/com/microsoft/azure/management/managedserviceidentity/v2015_08_31_preview/implementation/UserAssignedIdentitiesImpl.java new file mode 100644 index 000000000000..80780112e017 --- /dev/null +++ b/managedserviceidentity/resource-manager/v2015_08_31_preview/src/main/java/com/microsoft/azure/management/managedserviceidentity/v2015_08_31_preview/implementation/UserAssignedIdentitiesImpl.java @@ -0,0 +1,138 @@ +/** + * Copyright (c) Microsoft Corporation. All rights 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.managedserviceidentity.v2015_08_31_preview.implementation; + +import com.microsoft.azure.arm.resources.collection.implementation.GroupableResourcesCoreImpl; +import com.microsoft.azure.management.managedserviceidentity.v2015_08_31_preview.UserAssignedIdentities; +import com.microsoft.azure.management.managedserviceidentity.v2015_08_31_preview.Identity; +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; + +class UserAssignedIdentitiesImpl extends GroupableResourcesCoreImpl implements UserAssignedIdentities { + protected UserAssignedIdentitiesImpl(ManagedIdentityManager manager) { + super(manager.inner().userAssignedIdentities(), manager); + } + + @Override + protected Observable getInnerAsync(String resourceGroupName, String name) { + UserAssignedIdentitiesInner client = this.inner(); + return client.getByResourceGroupAsync(resourceGroupName, name); + } + + @Override + protected Completable deleteInnerAsync(String resourceGroupName, String name) { + UserAssignedIdentitiesInner 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) { + UserAssignedIdentitiesInner client = this.inner(); + return this.wrapList(client.listByResourceGroup(resourceGroupName)); + } + + @Override + public Observable listByResourceGroupAsync(String resourceGroupName) { + UserAssignedIdentitiesInner 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 Identity call(IdentityInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public PagedList list() { + UserAssignedIdentitiesInner client = this.inner(); + return this.wrapList(client.list()); + } + + @Override + public Observable listAsync() { + UserAssignedIdentitiesInner client = this.inner(); + return client.listAsync() + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public Identity call(IdentityInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public IdentityImpl define(String name) { + return wrapModel(name); + } + + @Override + protected IdentityImpl wrapModel(IdentityInner inner) { + return new IdentityImpl(inner.name(), inner, manager()); + } + + @Override + protected IdentityImpl wrapModel(String name) { + return new IdentityImpl(name, new IdentityInner(), this.manager()); + } + +} diff --git a/managedserviceidentity/resource-manager/v2015_08_31_preview/src/main/java/com/microsoft/azure/management/managedserviceidentity/v2015_08_31_preview/implementation/UserAssignedIdentitiesInner.java b/managedserviceidentity/resource-manager/v2015_08_31_preview/src/main/java/com/microsoft/azure/management/managedserviceidentity/v2015_08_31_preview/implementation/UserAssignedIdentitiesInner.java new file mode 100644 index 000000000000..34e6e546b410 --- /dev/null +++ b/managedserviceidentity/resource-manager/v2015_08_31_preview/src/main/java/com/microsoft/azure/management/managedserviceidentity/v2015_08_31_preview/implementation/UserAssignedIdentitiesInner.java @@ -0,0 +1,907 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.managedserviceidentity.v2015_08_31_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.CloudException; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import 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.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 UserAssignedIdentities. + */ +public class UserAssignedIdentitiesInner implements InnerSupportsGet, InnerSupportsDelete, InnerSupportsListing { + /** The Retrofit service to perform REST calls. */ + private UserAssignedIdentitiesService service; + /** The service client containing this operation class. */ + private ManagedServiceIdentityClientImpl client; + + /** + * Initializes an instance of UserAssignedIdentitiesInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public UserAssignedIdentitiesInner(Retrofit retrofit, ManagedServiceIdentityClientImpl client) { + this.service = retrofit.create(UserAssignedIdentitiesService.class); + this.client = client; + } + + /** + * The interface defining all the services for UserAssignedIdentities to be + * used by Retrofit to perform actually REST calls. + */ + interface UserAssignedIdentitiesService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.managedserviceidentity.v2015_08_31_preview.UserAssignedIdentities list" }) + @GET("subscriptions/{subscriptionId}/providers/Microsoft.ManagedIdentity/userAssignedIdentities") + 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.managedserviceidentity.v2015_08_31_preview.UserAssignedIdentities listByResourceGroup" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities") + 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.managedserviceidentity.v2015_08_31_preview.UserAssignedIdentities createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{resourceName}") + Observable> createOrUpdate(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("resourceName") String resourceName, @Query("api-version") String apiVersion, @Body IdentityInner parameters, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.managedserviceidentity.v2015_08_31_preview.UserAssignedIdentities update" }) + @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{resourceName}") + Observable> update(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("resourceName") String resourceName, @Query("api-version") String apiVersion, @Body IdentityInner parameters, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.managedserviceidentity.v2015_08_31_preview.UserAssignedIdentities getByResourceGroup" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{resourceName}") + Observable> getByResourceGroup(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("resourceName") String resourceName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.managedserviceidentity.v2015_08_31_preview.UserAssignedIdentities delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{resourceName}", method = "DELETE", hasBody = true) + Observable> delete(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("resourceName") String resourceName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.managedserviceidentity.v2015_08_31_preview.UserAssignedIdentities listNext" }) + @GET + Observable> listNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.managedserviceidentity.v2015_08_31_preview.UserAssignedIdentities listByResourceGroupNext" }) + @GET + Observable> listByResourceGroupNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Lists all the userAssignedIdentities available under the specified subscription. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<IdentityInner> 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 the userAssignedIdentities available under the specified 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 the userAssignedIdentities available under the specified subscription. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<IdentityInner> object + */ + public Observable> listAsync() { + return listWithServiceResponseAsync() + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all the userAssignedIdentities available under the specified subscription. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<IdentityInner> 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 the userAssignedIdentities available under the specified subscription. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<IdentityInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync() { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.list(this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Lists all the userAssignedIdentities available under the specified ResourceGroup. + * + * @param resourceGroupName The name of the Resource Group to which the identity belongs. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<IdentityInner> 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 the userAssignedIdentities available under the specified ResourceGroup. + * + * @param resourceGroupName The name of the Resource Group to which the identity belongs. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByResourceGroupAsync(final String resourceGroupName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByResourceGroupSinglePageAsync(resourceGroupName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByResourceGroupNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists all the userAssignedIdentities available under the specified ResourceGroup. + * + * @param resourceGroupName The name of the Resource Group to which the identity belongs. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<IdentityInner> 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 the userAssignedIdentities available under the specified ResourceGroup. + * + * @param resourceGroupName The name of the Resource Group to which the identity belongs. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<IdentityInner> 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 the userAssignedIdentities available under the specified ResourceGroup. + * + ServiceResponse> * @param resourceGroupName The name of the Resource Group to which the identity belongs. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<IdentityInner> 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 CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Create or update an identity in the specified subscription and resource group. + * + * @param resourceGroupName The name of the Resource Group to which the identity belongs. + * @param resourceName The name of the identity resource. + * @param parameters Parameters to create or update the identity + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the IdentityInner object if successful. + */ + public IdentityInner createOrUpdate(String resourceGroupName, String resourceName, IdentityInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, resourceName, parameters).toBlocking().single().body(); + } + + /** + * Create or update an identity in the specified subscription and resource group. + * + * @param resourceGroupName The name of the Resource Group to which the identity belongs. + * @param resourceName The name of the identity resource. + * @param parameters Parameters to create or update the identity + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture createOrUpdateAsync(String resourceGroupName, String resourceName, IdentityInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, resourceName, parameters), serviceCallback); + } + + /** + * Create or update an identity in the specified subscription and resource group. + * + * @param resourceGroupName The name of the Resource Group to which the identity belongs. + * @param resourceName The name of the identity resource. + * @param parameters Parameters to create or update the identity + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the IdentityInner object + */ + public Observable createOrUpdateAsync(String resourceGroupName, String resourceName, IdentityInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, resourceName, parameters).map(new Func1, IdentityInner>() { + @Override + public IdentityInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Create or update an identity in the specified subscription and resource group. + * + * @param resourceGroupName The name of the Resource Group to which the identity belongs. + * @param resourceName The name of the identity resource. + * @param parameters Parameters to create or update the identity + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the IdentityInner object + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String resourceName, IdentityInner parameters) { + 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 (resourceName == null) { + throw new IllegalArgumentException("Parameter resourceName 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 (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + Validator.validate(parameters); + return service.createOrUpdate(this.client.subscriptionId(), resourceGroupName, resourceName, this.client.apiVersion(), parameters, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = createOrUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse createOrUpdateDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(201, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Update an identity in the specified subscription and resource group. + * + * @param resourceGroupName The name of the Resource Group to which the identity belongs. + * @param resourceName The name of the identity resource. + * @param parameters Parameters to update the identity + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the IdentityInner object if successful. + */ + public IdentityInner update(String resourceGroupName, String resourceName, IdentityInner parameters) { + return updateWithServiceResponseAsync(resourceGroupName, resourceName, parameters).toBlocking().single().body(); + } + + /** + * Update an identity in the specified subscription and resource group. + * + * @param resourceGroupName The name of the Resource Group to which the identity belongs. + * @param resourceName The name of the identity resource. + * @param parameters Parameters to update the identity + * @param serviceCallback 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 resourceName, IdentityInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateWithServiceResponseAsync(resourceGroupName, resourceName, parameters), serviceCallback); + } + + /** + * Update an identity in the specified subscription and resource group. + * + * @param resourceGroupName The name of the Resource Group to which the identity belongs. + * @param resourceName The name of the identity resource. + * @param parameters Parameters to update the identity + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the IdentityInner object + */ + public Observable updateAsync(String resourceGroupName, String resourceName, IdentityInner parameters) { + return updateWithServiceResponseAsync(resourceGroupName, resourceName, parameters).map(new Func1, IdentityInner>() { + @Override + public IdentityInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Update an identity in the specified subscription and resource group. + * + * @param resourceGroupName The name of the Resource Group to which the identity belongs. + * @param resourceName The name of the identity resource. + * @param parameters Parameters to update the identity + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the IdentityInner object + */ + public Observable> updateWithServiceResponseAsync(String resourceGroupName, String resourceName, IdentityInner parameters) { + 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 (resourceName == null) { + throw new IllegalArgumentException("Parameter resourceName 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 (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + Validator.validate(parameters); + return service.update(this.client.subscriptionId(), resourceGroupName, resourceName, this.client.apiVersion(), parameters, 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 CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Gets the identity. + * + * @param resourceGroupName The name of the Resource Group to which the identity belongs. + * @param resourceName The name of the identity resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the IdentityInner object if successful. + */ + public IdentityInner getByResourceGroup(String resourceGroupName, String resourceName) { + return getByResourceGroupWithServiceResponseAsync(resourceGroupName, resourceName).toBlocking().single().body(); + } + + /** + * Gets the identity. + * + * @param resourceGroupName The name of the Resource Group to which the identity belongs. + * @param resourceName The name of the identity 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 getByResourceGroupAsync(String resourceGroupName, String resourceName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getByResourceGroupWithServiceResponseAsync(resourceGroupName, resourceName), serviceCallback); + } + + /** + * Gets the identity. + * + * @param resourceGroupName The name of the Resource Group to which the identity belongs. + * @param resourceName The name of the identity resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the IdentityInner object + */ + public Observable getByResourceGroupAsync(String resourceGroupName, String resourceName) { + return getByResourceGroupWithServiceResponseAsync(resourceGroupName, resourceName).map(new Func1, IdentityInner>() { + @Override + public IdentityInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets the identity. + * + * @param resourceGroupName The name of the Resource Group to which the identity belongs. + * @param resourceName The name of the identity resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the IdentityInner object + */ + public Observable> getByResourceGroupWithServiceResponseAsync(String resourceGroupName, String resourceName) { + 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 (resourceName == null) { + throw new IllegalArgumentException("Parameter resourceName 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, resourceName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getByResourceGroupDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getByResourceGroupDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Deletes the identity. + * + * @param resourceGroupName The name of the Resource Group to which the identity belongs. + * @param resourceName The name of the identity resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void delete(String resourceGroupName, String resourceName) { + deleteWithServiceResponseAsync(resourceGroupName, resourceName).toBlocking().single().body(); + } + + /** + * Deletes the identity. + * + * @param resourceGroupName The name of the Resource Group to which the identity belongs. + * @param resourceName The name of the identity 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 deleteAsync(String resourceGroupName, String resourceName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, resourceName), serviceCallback); + } + + /** + * Deletes the identity. + * + * @param resourceGroupName The name of the Resource Group to which the identity belongs. + * @param resourceName The name of the identity resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable deleteAsync(String resourceGroupName, String resourceName) { + return deleteWithServiceResponseAsync(resourceGroupName, resourceName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes the identity. + * + * @param resourceGroupName The name of the Resource Group to which the identity belongs. + * @param resourceName The name of the identity resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> deleteWithServiceResponseAsync(String resourceGroupName, String resourceName) { + 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 (resourceName == null) { + throw new IllegalArgumentException("Parameter resourceName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.delete(this.client.subscriptionId(), resourceGroupName, resourceName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = deleteDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse deleteDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(204, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Lists all the userAssignedIdentities available under the specified subscription. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<IdentityInner> 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 the userAssignedIdentities available under the specified 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 the userAssignedIdentities available under the specified 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<IdentityInner> 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 the userAssignedIdentities available under the specified 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<IdentityInner> 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 the userAssignedIdentities available under the specified 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<IdentityInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listNextDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Lists all the userAssignedIdentities available under the specified ResourceGroup. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<IdentityInner> 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 the userAssignedIdentities available under the specified ResourceGroup. + * + * @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 the userAssignedIdentities available under the specified ResourceGroup. + * + * @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<IdentityInner> 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 the userAssignedIdentities available under the specified ResourceGroup. + * + * @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<IdentityInner> 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 the userAssignedIdentities available under the specified ResourceGroup. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<IdentityInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByResourceGroupNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listByResourceGroupNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByResourceGroupNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByResourceGroupNextDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + +} diff --git a/managedserviceidentity/resource-manager/v2015_08_31_preview/src/main/java/com/microsoft/azure/management/managedserviceidentity/v2015_08_31_preview/implementation/package-info.java b/managedserviceidentity/resource-manager/v2015_08_31_preview/src/main/java/com/microsoft/azure/management/managedserviceidentity/v2015_08_31_preview/implementation/package-info.java new file mode 100644 index 000000000000..1c4aea59ec92 --- /dev/null +++ b/managedserviceidentity/resource-manager/v2015_08_31_preview/src/main/java/com/microsoft/azure/management/managedserviceidentity/v2015_08_31_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 ManagedServiceIdentityClient. + * The Managed Service Identity Client. + */ +package com.microsoft.azure.management.managedserviceidentity.v2015_08_31_preview.implementation; diff --git a/managedserviceidentity/resource-manager/v2015_08_31_preview/src/main/java/com/microsoft/azure/management/managedserviceidentity/v2015_08_31_preview/package-info.java b/managedserviceidentity/resource-manager/v2015_08_31_preview/src/main/java/com/microsoft/azure/management/managedserviceidentity/v2015_08_31_preview/package-info.java new file mode 100644 index 000000000000..74a1c97b520e --- /dev/null +++ b/managedserviceidentity/resource-manager/v2015_08_31_preview/src/main/java/com/microsoft/azure/management/managedserviceidentity/v2015_08_31_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 ManagedServiceIdentityClient. + * The Managed Service Identity Client. + */ +package com.microsoft.azure.management.managedserviceidentity.v2015_08_31_preview; diff --git a/managedserviceidentity/resource-manager/v2018-11-30/pom.xml b/managedserviceidentity/resource-manager/v2018-11-30/pom.xml new file mode 100644 index 000000000000..3f180a5ab4c7 --- /dev/null +++ b/managedserviceidentity/resource-manager/v2018-11-30/pom.xml @@ -0,0 +1,133 @@ + + + 4.0.0 + com.microsoft.azure.managedserviceidentity.v2018-11-30 + + com.microsoft.azure + azure-arm-parent + 0.0.2-beta + ../../../pom.xml + + azure-mgmt-managedidentity + 1.0.0-beta + jar + Microsoft Azure SDK for ManagedIdentity Management + This package contains Microsoft ManagedIdentity Management SDK. + https://github.com/Azure/azure-libraries-for-java + + + The MIT License (MIT) + http://opensource.org/licenses/MIT + repo + + + + scm:git:https://github.com/Azure/azure-libraries-for-java + scm:git:git@github.com:Azure/azure-libraries-for-java.git + HEAD + + + UTF-8 + + + + + microsoft + Microsoft + + + + + com.microsoft.azure + azure-client-runtime + + + com.microsoft.azure + azure-arm-client-runtime + + + junit + junit + test + + + com.microsoft.azure + azure-client-authentication + test + + + com.microsoft.azure + azure-mgmt-resources + test + + + com.microsoft.azure + azure-arm-client-runtime + test-jar + test + + + + + + org.apache.maven.plugins + maven-jar-plugin + + + + true + true + + + + + + org.codehaus.mojo + build-helper-maven-plugin + + + org.apache.maven.plugins + maven-compiler-plugin + 3.1 + + 1.7 + 1.7 + + + com.microsoft.azure.management.apigeneration.LangDefinitionProcessor + + + true + true + + true + true + + + + + org.apache.maven.plugins + maven-javadoc-plugin + 2.8 + + *.implementation.*;*.utils.*;com.microsoft.schemas._2003._10.serialization;*.blob.core.search + + + /** +
* Copyright (c) Microsoft Corporation. All rights reserved. +
* Licensed under the MIT License. See License.txt in the project root for +
* license information. +
*/ + ]]> +
+
+
+
+
+
diff --git a/managedserviceidentity/resource-manager/v2018-11-30/src/main/java/com/microsoft/azure/management/managedserviceidentity/v2018-11-30/Identity.java b/managedserviceidentity/resource-manager/v2018-11-30/src/main/java/com/microsoft/azure/management/managedserviceidentity/v2018-11-30/Identity.java new file mode 100644 index 000000000000..4f81be9297cb --- /dev/null +++ b/managedserviceidentity/resource-manager/v2018-11-30/src/main/java/com/microsoft/azure/management/managedserviceidentity/v2018-11-30/Identity.java @@ -0,0 +1,89 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.managedserviceidentity.v2018-11-30; + +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.managedserviceidentity.v2018-11-30.implementation.ManagedIdentityManager; +import java.util.UUID; +import com.microsoft.azure.management.managedserviceidentity.v2018-11-30.implementation.IdentityInner; + +/** + * Type representing Identity. + */ +public interface Identity extends HasInner, Resource, GroupableResourceCore, HasResourceGroup, Refreshable, Updatable, HasManager { + /** + * @return the clientId value. + */ + UUID clientId(); + + /** + * @return the clientSecretUrl value. + */ + String clientSecretUrl(); + + /** + * @return the principalId value. + */ + UUID principalId(); + + /** + * @return the tenantId value. + */ + UUID tenantId(); + + /** + * The entirety of the Identity definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithGroup, DefinitionStages.WithCreate { + } + + /** + * Grouping of Identity definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a Identity definition. + */ + interface Blank extends GroupableResourceCore.DefinitionWithRegion { + } + + /** + * The stage of the Identity definition allowing to specify the resource group. + */ + interface WithGroup extends GroupableResourceCore.DefinitionStages.WithGroup { + } + + /** + * 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 { + } + } + /** + * The template for a Identity update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, Resource.UpdateWithTags { + } + + /** + * Grouping of Identity update stages. + */ + interface UpdateStages { + } +} diff --git a/managedserviceidentity/resource-manager/v2018-11-30/src/main/java/com/microsoft/azure/management/managedserviceidentity/v2018-11-30/Operation.java b/managedserviceidentity/resource-manager/v2018-11-30/src/main/java/com/microsoft/azure/management/managedserviceidentity/v2018-11-30/Operation.java new file mode 100644 index 000000000000..768537dab190 --- /dev/null +++ b/managedserviceidentity/resource-manager/v2018-11-30/src/main/java/com/microsoft/azure/management/managedserviceidentity/v2018-11-30/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.managedserviceidentity.v2018-11-30; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.managedserviceidentity.v2018-11-30.implementation.ManagedIdentityManager; +import com.microsoft.azure.management.managedserviceidentity.v2018-11-30.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/managedserviceidentity/resource-manager/v2018-11-30/src/main/java/com/microsoft/azure/management/managedserviceidentity/v2018-11-30/OperationDisplay.java b/managedserviceidentity/resource-manager/v2018-11-30/src/main/java/com/microsoft/azure/management/managedserviceidentity/v2018-11-30/OperationDisplay.java new file mode 100644 index 000000000000..96c3c16dc7d1 --- /dev/null +++ b/managedserviceidentity/resource-manager/v2018-11-30/src/main/java/com/microsoft/azure/management/managedserviceidentity/v2018-11-30/OperationDisplay.java @@ -0,0 +1,126 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.managedserviceidentity.v2018-11-30; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Operation Display. + * The object that describes the operation. + */ +public class OperationDisplay { + /** + * Resource Provider Name. + * Friendly name of the resource provider. + */ + @JsonProperty(value = "provider") + private String provider; + + /** + * Operation Type. + * The type of operation. For example: read, write, delete. + */ + @JsonProperty(value = "operation") + private String operation; + + /** + * Resource Type. + * The resource type on which the operation is performed. + */ + @JsonProperty(value = "resource") + private String resource; + + /** + * Operation description. + * A description of the operation. + */ + @JsonProperty(value = "description") + private String description; + + /** + * Get friendly name of the resource provider. + * + * @return the provider value + */ + public String provider() { + return this.provider; + } + + /** + * Set friendly name of the resource provider. + * + * @param provider the provider value to set + * @return the OperationDisplay object itself. + */ + public OperationDisplay withProvider(String provider) { + this.provider = provider; + return this; + } + + /** + * Get the type of operation. For example: read, write, delete. + * + * @return the operation value + */ + public String operation() { + return this.operation; + } + + /** + * Set the type of operation. For example: read, write, delete. + * + * @param operation the operation value to set + * @return the OperationDisplay object itself. + */ + public OperationDisplay withOperation(String operation) { + this.operation = operation; + return this; + } + + /** + * Get the resource type on which the operation is performed. + * + * @return the resource value + */ + public String resource() { + return this.resource; + } + + /** + * Set the resource type on which the operation is performed. + * + * @param resource the resource value to set + * @return the OperationDisplay object itself. + */ + public OperationDisplay withResource(String resource) { + this.resource = resource; + return this; + } + + /** + * Get a description of the operation. + * + * @return the description value + */ + public String description() { + return this.description; + } + + /** + * Set a 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/managedserviceidentity/resource-manager/v2018-11-30/src/main/java/com/microsoft/azure/management/managedserviceidentity/v2018-11-30/Operations.java b/managedserviceidentity/resource-manager/v2018-11-30/src/main/java/com/microsoft/azure/management/managedserviceidentity/v2018-11-30/Operations.java new file mode 100644 index 000000000000..94980c52c544 --- /dev/null +++ b/managedserviceidentity/resource-manager/v2018-11-30/src/main/java/com/microsoft/azure/management/managedserviceidentity/v2018-11-30/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.managedserviceidentity.v2018-11-30; + +import rx.Observable; +import com.microsoft.azure.management.managedserviceidentity.v2018-11-30.implementation.OperationsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing Operations. + */ +public interface Operations extends HasInner { + /** + * Lists available operations for the Microsoft.ManagedIdentity provider. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listAsync(); + +} diff --git a/managedserviceidentity/resource-manager/v2018-11-30/src/main/java/com/microsoft/azure/management/managedserviceidentity/v2018-11-30/UserAssignedIdentities.java b/managedserviceidentity/resource-manager/v2018-11-30/src/main/java/com/microsoft/azure/management/managedserviceidentity/v2018-11-30/UserAssignedIdentities.java new file mode 100644 index 000000000000..2fa402676e7a --- /dev/null +++ b/managedserviceidentity/resource-manager/v2018-11-30/src/main/java/com/microsoft/azure/management/managedserviceidentity/v2018-11-30/UserAssignedIdentities.java @@ -0,0 +1,38 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.managedserviceidentity.v2018-11-30; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for UserAssignedIdentities. + */ +public final class UserAssignedIdentities extends ExpandableStringEnum { + /** Static value Microsoft.ManagedIdentity/userAssignedIdentities for UserAssignedIdentities. */ + public static final UserAssignedIdentities MICROSOFT_MANAGED_IDENTITYUSER_ASSIGNED_IDENTITIES = fromString("Microsoft.ManagedIdentity/userAssignedIdentities"); + + /** + * Creates or finds a UserAssignedIdentities from its string representation. + * @param name a name to look for + * @return the corresponding UserAssignedIdentities + */ + @JsonCreator + public static UserAssignedIdentities fromString(String name) { + return fromString(name, UserAssignedIdentities.class); + } + + /** + * @return known UserAssignedIdentities values + */ + public static Collection values() { + return values(UserAssignedIdentities.class); + } +} diff --git a/managedserviceidentity/resource-manager/v2018-11-30/src/main/java/com/microsoft/azure/management/managedserviceidentity/v2018-11-30/implementation/IdParsingUtils.java b/managedserviceidentity/resource-manager/v2018-11-30/src/main/java/com/microsoft/azure/management/managedserviceidentity/v2018-11-30/implementation/IdParsingUtils.java new file mode 100644 index 000000000000..40c83cb38dfe --- /dev/null +++ b/managedserviceidentity/resource-manager/v2018-11-30/src/main/java/com/microsoft/azure/management/managedserviceidentity/v2018-11-30/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.managedserviceidentity.v2018-11-30.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/managedserviceidentity/resource-manager/v2018-11-30/src/main/java/com/microsoft/azure/management/managedserviceidentity/v2018-11-30/implementation/IdentityImpl.java b/managedserviceidentity/resource-manager/v2018-11-30/src/main/java/com/microsoft/azure/management/managedserviceidentity/v2018-11-30/implementation/IdentityImpl.java new file mode 100644 index 000000000000..356def959adc --- /dev/null +++ b/managedserviceidentity/resource-manager/v2018-11-30/src/main/java/com/microsoft/azure/management/managedserviceidentity/v2018-11-30/implementation/IdentityImpl.java @@ -0,0 +1,67 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.managedserviceidentity.v2018-11-30.implementation; + +import com.microsoft.azure.arm.resources.models.implementation.GroupableResourceCoreImpl; +import com.microsoft.azure.management.managedserviceidentity.v2018-11-30.Identity; +import rx.Observable; +import java.util.UUID; + +class IdentityImpl extends GroupableResourceCoreImpl implements Identity, Identity.Definition, Identity.Update { + IdentityImpl(String name, IdentityInner inner, ManagedIdentityManager manager) { + super(name, inner, manager); + } + + @Override + public Observable createResourceAsync() { + UserAssignedIdentitiesInner client = this.manager().inner().userAssignedIdentities(); + return client.createOrUpdateAsync(this.resourceGroupName(), this.name(), this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + UserAssignedIdentitiesInner client = this.manager().inner().userAssignedIdentities(); + return client.updateAsync(this.resourceGroupName(), this.name(), this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + UserAssignedIdentitiesInner client = this.manager().inner().userAssignedIdentities(); + return client.getByResourceGroupAsync(this.resourceGroupName(), this.name()); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + + @Override + public UUID clientId() { + return this.inner().clientId(); + } + + @Override + public String clientSecretUrl() { + return this.inner().clientSecretUrl(); + } + + @Override + public UUID principalId() { + return this.inner().principalId(); + } + + @Override + public UUID tenantId() { + return this.inner().tenantId(); + } + +} diff --git a/managedserviceidentity/resource-manager/v2018-11-30/src/main/java/com/microsoft/azure/management/managedserviceidentity/v2018-11-30/implementation/IdentityInner.java b/managedserviceidentity/resource-manager/v2018-11-30/src/main/java/com/microsoft/azure/management/managedserviceidentity/v2018-11-30/implementation/IdentityInner.java new file mode 100644 index 000000000000..150659528615 --- /dev/null +++ b/managedserviceidentity/resource-manager/v2018-11-30/src/main/java/com/microsoft/azure/management/managedserviceidentity/v2018-11-30/implementation/IdentityInner.java @@ -0,0 +1,86 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.managedserviceidentity.v2018-11-30.implementation; + +import java.util.UUID; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.Resource; + +/** + * Describes an identity resource. + */ +@JsonFlatten +public class IdentityInner extends Resource { + /** + * The id of the tenant which the identity belongs to. + */ + @JsonProperty(value = "properties.tenantId", access = JsonProperty.Access.WRITE_ONLY) + private UUID tenantId; + + /** + * The id of the service principal object associated with the created + * identity. + */ + @JsonProperty(value = "properties.principalId", access = JsonProperty.Access.WRITE_ONLY) + private UUID principalId; + + /** + * The id of the app associated with the identity. This is a random + * generated UUID by MSI. + */ + @JsonProperty(value = "properties.clientId", access = JsonProperty.Access.WRITE_ONLY) + private UUID clientId; + + /** + * The ManagedServiceIdentity DataPlane URL that can be queried to obtain + * the identity credentials. If identity is user assigned, then the + * clientSecretUrl will not be present in the response, otherwise it will + * be present. + */ + @JsonProperty(value = "properties.clientSecretUrl", access = JsonProperty.Access.WRITE_ONLY) + private String clientSecretUrl; + + /** + * Get the id of the tenant which the identity belongs to. + * + * @return the tenantId value + */ + public UUID tenantId() { + return this.tenantId; + } + + /** + * Get the id of the service principal object associated with the created identity. + * + * @return the principalId value + */ + public UUID principalId() { + return this.principalId; + } + + /** + * Get the id of the app associated with the identity. This is a random generated UUID by MSI. + * + * @return the clientId value + */ + public UUID clientId() { + return this.clientId; + } + + /** + * Get the ManagedServiceIdentity DataPlane URL that can be queried to obtain the identity credentials. If identity is user assigned, then the clientSecretUrl will not be present in the response, otherwise it will be present. + * + * @return the clientSecretUrl value + */ + public String clientSecretUrl() { + return this.clientSecretUrl; + } + +} diff --git a/managedserviceidentity/resource-manager/v2018-11-30/src/main/java/com/microsoft/azure/management/managedserviceidentity/v2018-11-30/implementation/ManagedIdentityManager.java b/managedserviceidentity/resource-manager/v2018-11-30/src/main/java/com/microsoft/azure/management/managedserviceidentity/v2018-11-30/implementation/ManagedIdentityManager.java new file mode 100644 index 000000000000..58f3ee73488e --- /dev/null +++ b/managedserviceidentity/resource-manager/v2018-11-30/src/main/java/com/microsoft/azure/management/managedserviceidentity/v2018-11-30/implementation/ManagedIdentityManager.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.managedserviceidentity.v2018-11-30.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.managedserviceidentity.v2018-11-30.Operations; +import com.microsoft.azure.management.managedserviceidentity.v2018-11-30.UserAssignedIdentities; +import com.microsoft.azure.arm.resources.implementation.AzureConfigurableCoreImpl; +import com.microsoft.azure.arm.resources.implementation.ManagerCore; + +/** + * Entry point to Azure ManagedIdentity resource management. + */ +public final class ManagedIdentityManager extends ManagerCore { + private Operations operations; + private UserAssignedIdentities userAssignedIdentities; + /** + * Get a Configurable instance that can be used to create ManagedIdentityManager with optional configuration. + * + * @return the instance allowing configurations + */ + public static Configurable configure() { + return new ManagedIdentityManager.ConfigurableImpl(); + } + /** + * Creates an instance of ManagedIdentityManager that exposes ManagedIdentity resource management API entry points. + * + * @param credentials the credentials to use + * @param subscriptionId the subscription UUID + * @return the ManagedIdentityManager + */ + public static ManagedIdentityManager authenticate(AzureTokenCredentials credentials, String subscriptionId) { + return new ManagedIdentityManager(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 ManagedIdentityManager that exposes ManagedIdentity resource management API entry points. + * + * @param restClient the RestClient to be used for API calls. + * @param subscriptionId the subscription UUID + * @return the ManagedIdentityManager + */ + public static ManagedIdentityManager authenticate(RestClient restClient, String subscriptionId) { + return new ManagedIdentityManager(restClient, subscriptionId); + } + /** + * The interface allowing configurations to be set. + */ + public interface Configurable extends AzureConfigurable { + /** + * Creates an instance of ManagedIdentityManager that exposes ManagedIdentity management API entry points. + * + * @param credentials the credentials to use + * @param subscriptionId the subscription UUID + * @return the interface exposing ManagedIdentity management API entry points that work across subscriptions + */ + ManagedIdentityManager authenticate(AzureTokenCredentials credentials, String subscriptionId); + } + + /** + * @return Entry point to manage Operations. + */ + public Operations operations() { + if (this.operations == null) { + this.operations = new OperationsImpl(this); + } + return this.operations; + } + + /** + * @return Entry point to manage UserAssignedIdentities. + */ + public UserAssignedIdentities userAssignedIdentities() { + if (this.userAssignedIdentities == null) { + this.userAssignedIdentities = new UserAssignedIdentitiesImpl(this); + } + return this.userAssignedIdentities; + } + + /** + * The implementation for Configurable interface. + */ + private static final class ConfigurableImpl extends AzureConfigurableCoreImpl implements Configurable { + public ManagedIdentityManager authenticate(AzureTokenCredentials credentials, String subscriptionId) { + return ManagedIdentityManager.authenticate(buildRestClient(credentials), subscriptionId); + } + } + private ManagedIdentityManager(RestClient restClient, String subscriptionId) { + super( + restClient, + subscriptionId, + new ManagedServiceIdentityClientImpl(restClient).withSubscriptionId(subscriptionId)); + } +} diff --git a/managedserviceidentity/resource-manager/v2018-11-30/src/main/java/com/microsoft/azure/management/managedserviceidentity/v2018-11-30/implementation/ManagedServiceIdentityClientImpl.java b/managedserviceidentity/resource-manager/v2018-11-30/src/main/java/com/microsoft/azure/management/managedserviceidentity/v2018-11-30/implementation/ManagedServiceIdentityClientImpl.java new file mode 100644 index 000000000000..919156cab0f7 --- /dev/null +++ b/managedserviceidentity/resource-manager/v2018-11-30/src/main/java/com/microsoft/azure/management/managedserviceidentity/v2018-11-30/implementation/ManagedServiceIdentityClientImpl.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.managedserviceidentity.v2018-11-30.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 ManagedServiceIdentityClientImpl class. + */ +public class ManagedServiceIdentityClientImpl 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 Id of the Subscription to which the identity belongs. */ + private String subscriptionId; + + /** + * Gets The Id of the Subscription to which the identity belongs. + * + * @return the subscriptionId value. + */ + public String subscriptionId() { + return this.subscriptionId; + } + + /** + * Sets The Id of the Subscription to which the identity belongs. + * + * @param subscriptionId the subscriptionId value. + * @return the service client itself + */ + public ManagedServiceIdentityClientImpl withSubscriptionId(String subscriptionId) { + this.subscriptionId = subscriptionId; + return this; + } + + /** Version of API to invoke. */ + private String apiVersion; + + /** + * Gets Version of API to invoke. + * + * @return the apiVersion value. + */ + public String apiVersion() { + return this.apiVersion; + } + + /** Gets or sets the preferred language for the response. */ + private String acceptLanguage; + + /** + * Gets Gets or sets the preferred language for the response. + * + * @return the acceptLanguage value. + */ + public String acceptLanguage() { + return this.acceptLanguage; + } + + /** + * Sets Gets or sets the preferred language for the response. + * + * @param acceptLanguage the acceptLanguage value. + * @return the service client itself + */ + public ManagedServiceIdentityClientImpl withAcceptLanguage(String acceptLanguage) { + this.acceptLanguage = acceptLanguage; + return this; + } + + /** Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30. */ + private int longRunningOperationRetryTimeout; + + /** + * Gets Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30. + * + * @return the longRunningOperationRetryTimeout value. + */ + public int longRunningOperationRetryTimeout() { + return this.longRunningOperationRetryTimeout; + } + + /** + * Sets Gets or 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 ManagedServiceIdentityClientImpl withLongRunningOperationRetryTimeout(int longRunningOperationRetryTimeout) { + this.longRunningOperationRetryTimeout = longRunningOperationRetryTimeout; + return this; + } + + /** 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 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 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 ManagedServiceIdentityClientImpl withGenerateClientRequestId(boolean generateClientRequestId) { + this.generateClientRequestId = generateClientRequestId; + return this; + } + + /** + * The OperationsInner object to access its operations. + */ + private OperationsInner operations; + + /** + * Gets the OperationsInner object to access its operations. + * @return the OperationsInner object. + */ + public OperationsInner operations() { + return this.operations; + } + + /** + * The UserAssignedIdentitiesInner object to access its operations. + */ + private UserAssignedIdentitiesInner userAssignedIdentities; + + /** + * Gets the UserAssignedIdentitiesInner object to access its operations. + * @return the UserAssignedIdentitiesInner object. + */ + public UserAssignedIdentitiesInner userAssignedIdentities() { + return this.userAssignedIdentities; + } + + /** + * Initializes an instance of ManagedServiceIdentityClient client. + * + * @param credentials the management credentials for Azure + */ + public ManagedServiceIdentityClientImpl(ServiceClientCredentials credentials) { + this("https://management.azure.com", credentials); + } + + /** + * Initializes an instance of ManagedServiceIdentityClient client. + * + * @param baseUrl the base URL of the host + * @param credentials the management credentials for Azure + */ + public ManagedServiceIdentityClientImpl(String baseUrl, ServiceClientCredentials credentials) { + super(baseUrl, credentials); + initialize(); + } + + /** + * Initializes an instance of ManagedServiceIdentityClient client. + * + * @param restClient the REST client to connect to Azure. + */ + public ManagedServiceIdentityClientImpl(RestClient restClient) { + super(restClient); + initialize(); + } + + protected void initialize() { + this.apiVersion = "2018-11-30"; + this.acceptLanguage = "en-US"; + this.longRunningOperationRetryTimeout = 30; + this.generateClientRequestId = true; + this.operations = new OperationsInner(restClient().retrofit(), this); + this.userAssignedIdentities = new UserAssignedIdentitiesInner(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)", super.userAgent(), "ManagedServiceIdentityClient", "2018-11-30"); + } +} diff --git a/managedserviceidentity/resource-manager/v2018-11-30/src/main/java/com/microsoft/azure/management/managedserviceidentity/v2018-11-30/implementation/OperationImpl.java b/managedserviceidentity/resource-manager/v2018-11-30/src/main/java/com/microsoft/azure/management/managedserviceidentity/v2018-11-30/implementation/OperationImpl.java new file mode 100644 index 000000000000..340ffd9e2072 --- /dev/null +++ b/managedserviceidentity/resource-manager/v2018-11-30/src/main/java/com/microsoft/azure/management/managedserviceidentity/v2018-11-30/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.managedserviceidentity.v2018-11-30.implementation; + +import com.microsoft.azure.management.managedserviceidentity.v2018-11-30.Operation; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.managedserviceidentity.v2018-11-30.OperationDisplay; + +class OperationImpl extends WrapperImpl implements Operation { + private final ManagedIdentityManager manager; + OperationImpl(OperationInner inner, ManagedIdentityManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public ManagedIdentityManager manager() { + return this.manager; + } + + @Override + public OperationDisplay display() { + return this.inner().display(); + } + + @Override + public String name() { + return this.inner().name(); + } + +} diff --git a/managedserviceidentity/resource-manager/v2018-11-30/src/main/java/com/microsoft/azure/management/managedserviceidentity/v2018-11-30/implementation/OperationInner.java b/managedserviceidentity/resource-manager/v2018-11-30/src/main/java/com/microsoft/azure/management/managedserviceidentity/v2018-11-30/implementation/OperationInner.java new file mode 100644 index 000000000000..020506dbee1d --- /dev/null +++ b/managedserviceidentity/resource-manager/v2018-11-30/src/main/java/com/microsoft/azure/management/managedserviceidentity/v2018-11-30/implementation/OperationInner.java @@ -0,0 +1,74 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.managedserviceidentity.v2018-11-30.implementation; + +import com.microsoft.azure.management.managedserviceidentity.v2018-11-30.OperationDisplay; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Microsoft.ManagedIdentity Operation. + * Operation supported by the Microsoft.ManagedIdentity REST API. + */ +public class OperationInner { + /** + * Operation Name. + * The name of the REST Operation. This is of the format + * {provider}/{resource}/{operation}. + */ + @JsonProperty(value = "name") + private String name; + + /** + * Operation Display. + * The object that describes the operation. + */ + @JsonProperty(value = "display") + private OperationDisplay display; + + /** + * Get the name of the REST Operation. This is of the format {provider}/{resource}/{operation}. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set the name of the REST Operation. This is of the format {provider}/{resource}/{operation}. + * + * @param name the name value to set + * @return the OperationInner object itself. + */ + public OperationInner withName(String name) { + this.name = name; + return this; + } + + /** + * Get the object that describes the operation. + * + * @return the display value + */ + public OperationDisplay display() { + return this.display; + } + + /** + * Set the object that describes the operation. + * + * @param display the display value to set + * @return the OperationInner object itself. + */ + public OperationInner withDisplay(OperationDisplay display) { + this.display = display; + return this; + } + +} diff --git a/managedserviceidentity/resource-manager/v2018-11-30/src/main/java/com/microsoft/azure/management/managedserviceidentity/v2018-11-30/implementation/OperationsImpl.java b/managedserviceidentity/resource-manager/v2018-11-30/src/main/java/com/microsoft/azure/management/managedserviceidentity/v2018-11-30/implementation/OperationsImpl.java new file mode 100644 index 000000000000..d1ffbfc5629d --- /dev/null +++ b/managedserviceidentity/resource-manager/v2018-11-30/src/main/java/com/microsoft/azure/management/managedserviceidentity/v2018-11-30/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.managedserviceidentity.v2018-11-30.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.managedserviceidentity.v2018-11-30.Operations; +import rx.functions.Func1; +import rx.Observable; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.managedserviceidentity.v2018-11-30.Operation; + +class OperationsImpl extends WrapperImpl implements Operations { + private final ManagedIdentityManager manager; + + OperationsImpl(ManagedIdentityManager manager) { + super(manager.inner().operations()); + this.manager = manager; + } + + public ManagedIdentityManager manager() { + return this.manager; + } + + @Override + public Observable listAsync() { + OperationsInner client = this.inner(); + return client.listAsync() + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public Operation call(OperationInner inner) { + return new OperationImpl(inner, manager()); + } + }); + } + +} diff --git a/managedserviceidentity/resource-manager/v2018-11-30/src/main/java/com/microsoft/azure/management/managedserviceidentity/v2018-11-30/implementation/OperationsInner.java b/managedserviceidentity/resource-manager/v2018-11-30/src/main/java/com/microsoft/azure/management/managedserviceidentity/v2018-11-30/implementation/OperationsInner.java new file mode 100644 index 000000000000..70116f623be5 --- /dev/null +++ b/managedserviceidentity/resource-manager/v2018-11-30/src/main/java/com/microsoft/azure/management/managedserviceidentity/v2018-11-30/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.managedserviceidentity.v2018-11-30.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.CloudException; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Query; +import retrofit2.http.Url; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in Operations. + */ +public class OperationsInner { + /** The Retrofit service to perform REST calls. */ + private OperationsService service; + /** The service client containing this operation class. */ + private ManagedServiceIdentityClientImpl 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, ManagedServiceIdentityClientImpl 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.managedserviceidentity.v2018-11-30.Operations list" }) + @GET("providers/Microsoft.ManagedIdentity/operations") + Observable> list(@Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.managedserviceidentity.v2018-11-30.Operations listNext" }) + @GET + Observable> listNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Lists available operations for the Microsoft.ManagedIdentity provider. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<OperationInner> object if successful. + */ + public PagedList list() { + ServiceResponse> response = listSinglePageAsync().toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists available operations for the Microsoft.ManagedIdentity provider. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAsync(final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists available operations for the Microsoft.ManagedIdentity provider. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<OperationInner> object + */ + public Observable> listAsync() { + return listWithServiceResponseAsync() + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists available operations for the Microsoft.ManagedIdentity provider. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<OperationInner> object + */ + public Observable>> listWithServiceResponseAsync() { + return listSinglePageAsync() + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists available operations for the Microsoft.ManagedIdentity provider. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<OperationInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync() { + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.list(this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Lists available operations for the Microsoft.ManagedIdentity provider. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<OperationInner> object if successful. + */ + public PagedList listNext(final String nextPageLink) { + ServiceResponse> response = listNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists available operations for the Microsoft.ManagedIdentity provider. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists available operations for the Microsoft.ManagedIdentity provider. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<OperationInner> object + */ + public Observable> listNextAsync(final String nextPageLink) { + return listNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists available operations for the Microsoft.ManagedIdentity provider. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<OperationInner> object + */ + public Observable>> listNextWithServiceResponseAsync(final String nextPageLink) { + return listNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists available operations for the Microsoft.ManagedIdentity provider. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<OperationInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listNextDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + +} diff --git a/managedserviceidentity/resource-manager/v2018-11-30/src/main/java/com/microsoft/azure/management/managedserviceidentity/v2018-11-30/implementation/PageImpl.java b/managedserviceidentity/resource-manager/v2018-11-30/src/main/java/com/microsoft/azure/management/managedserviceidentity/v2018-11-30/implementation/PageImpl.java new file mode 100644 index 000000000000..398af03fc748 --- /dev/null +++ b/managedserviceidentity/resource-manager/v2018-11-30/src/main/java/com/microsoft/azure/management/managedserviceidentity/v2018-11-30/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.managedserviceidentity.v2018-11-30.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/managedserviceidentity/resource-manager/v2018-11-30/src/main/java/com/microsoft/azure/management/managedserviceidentity/v2018-11-30/implementation/UserAssignedIdentitiesImpl.java b/managedserviceidentity/resource-manager/v2018-11-30/src/main/java/com/microsoft/azure/management/managedserviceidentity/v2018-11-30/implementation/UserAssignedIdentitiesImpl.java new file mode 100644 index 000000000000..da51ec7018ed --- /dev/null +++ b/managedserviceidentity/resource-manager/v2018-11-30/src/main/java/com/microsoft/azure/management/managedserviceidentity/v2018-11-30/implementation/UserAssignedIdentitiesImpl.java @@ -0,0 +1,138 @@ +/** + * Copyright (c) Microsoft Corporation. All rights 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.managedserviceidentity.v2018-11-30.implementation; + +import com.microsoft.azure.arm.resources.collection.implementation.GroupableResourcesCoreImpl; +import com.microsoft.azure.management.managedserviceidentity.v2018-11-30.UserAssignedIdentities; +import com.microsoft.azure.management.managedserviceidentity.v2018-11-30.Identity; +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; + +class UserAssignedIdentitiesImpl extends GroupableResourcesCoreImpl implements UserAssignedIdentities { + protected UserAssignedIdentitiesImpl(ManagedIdentityManager manager) { + super(manager.inner().userAssignedIdentities(), manager); + } + + @Override + protected Observable getInnerAsync(String resourceGroupName, String name) { + UserAssignedIdentitiesInner client = this.inner(); + return client.getByResourceGroupAsync(resourceGroupName, name); + } + + @Override + protected Completable deleteInnerAsync(String resourceGroupName, String name) { + UserAssignedIdentitiesInner 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) { + UserAssignedIdentitiesInner client = this.inner(); + return this.wrapList(client.listByResourceGroup(resourceGroupName)); + } + + @Override + public Observable listByResourceGroupAsync(String resourceGroupName) { + UserAssignedIdentitiesInner 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 Identity call(IdentityInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public PagedList list() { + UserAssignedIdentitiesInner client = this.inner(); + return this.wrapList(client.list()); + } + + @Override + public Observable listAsync() { + UserAssignedIdentitiesInner client = this.inner(); + return client.listAsync() + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public Identity call(IdentityInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public IdentityImpl define(String name) { + return wrapModel(name); + } + + @Override + protected IdentityImpl wrapModel(IdentityInner inner) { + return new IdentityImpl(inner.name(), inner, manager()); + } + + @Override + protected IdentityImpl wrapModel(String name) { + return new IdentityImpl(name, new IdentityInner(), this.manager()); + } + +} diff --git a/managedserviceidentity/resource-manager/v2018-11-30/src/main/java/com/microsoft/azure/management/managedserviceidentity/v2018-11-30/implementation/UserAssignedIdentitiesInner.java b/managedserviceidentity/resource-manager/v2018-11-30/src/main/java/com/microsoft/azure/management/managedserviceidentity/v2018-11-30/implementation/UserAssignedIdentitiesInner.java new file mode 100644 index 000000000000..6ca0470c72eb --- /dev/null +++ b/managedserviceidentity/resource-manager/v2018-11-30/src/main/java/com/microsoft/azure/management/managedserviceidentity/v2018-11-30/implementation/UserAssignedIdentitiesInner.java @@ -0,0 +1,907 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.managedserviceidentity.v2018-11-30.implementation; + +import com.microsoft.azure.arm.collection.InnerSupportsGet; +import com.microsoft.azure.arm.collection.InnerSupportsDelete; +import com.microsoft.azure.arm.collection.InnerSupportsListing; +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.CloudException; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.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.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 UserAssignedIdentities. + */ +public class UserAssignedIdentitiesInner implements InnerSupportsGet, InnerSupportsDelete, InnerSupportsListing { + /** The Retrofit service to perform REST calls. */ + private UserAssignedIdentitiesService service; + /** The service client containing this operation class. */ + private ManagedServiceIdentityClientImpl client; + + /** + * Initializes an instance of UserAssignedIdentitiesInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public UserAssignedIdentitiesInner(Retrofit retrofit, ManagedServiceIdentityClientImpl client) { + this.service = retrofit.create(UserAssignedIdentitiesService.class); + this.client = client; + } + + /** + * The interface defining all the services for UserAssignedIdentities to be + * used by Retrofit to perform actually REST calls. + */ + interface UserAssignedIdentitiesService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.managedserviceidentity.v2018-11-30.UserAssignedIdentities list" }) + @GET("subscriptions/{subscriptionId}/providers/Microsoft.ManagedIdentity/userAssignedIdentities") + 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.managedserviceidentity.v2018-11-30.UserAssignedIdentities listByResourceGroup" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities") + 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.managedserviceidentity.v2018-11-30.UserAssignedIdentities createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{resourceName}") + Observable> createOrUpdate(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("resourceName") String resourceName, @Query("api-version") String apiVersion, @Body IdentityInner parameters, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.managedserviceidentity.v2018-11-30.UserAssignedIdentities update" }) + @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{resourceName}") + Observable> update(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("resourceName") String resourceName, @Query("api-version") String apiVersion, @Body IdentityInner parameters, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.managedserviceidentity.v2018-11-30.UserAssignedIdentities getByResourceGroup" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{resourceName}") + Observable> getByResourceGroup(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("resourceName") String resourceName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.managedserviceidentity.v2018-11-30.UserAssignedIdentities delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{resourceName}", method = "DELETE", hasBody = true) + Observable> delete(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("resourceName") String resourceName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.managedserviceidentity.v2018-11-30.UserAssignedIdentities listNext" }) + @GET + Observable> listNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.managedserviceidentity.v2018-11-30.UserAssignedIdentities listByResourceGroupNext" }) + @GET + Observable> listByResourceGroupNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Lists all the userAssignedIdentities available under the specified subscription. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<IdentityInner> 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 the userAssignedIdentities available under the specified 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 the userAssignedIdentities available under the specified subscription. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<IdentityInner> object + */ + public Observable> listAsync() { + return listWithServiceResponseAsync() + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all the userAssignedIdentities available under the specified subscription. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<IdentityInner> 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 the userAssignedIdentities available under the specified subscription. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<IdentityInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync() { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.list(this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Lists all the userAssignedIdentities available under the specified ResourceGroup. + * + * @param resourceGroupName The name of the Resource Group to which the identity belongs. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<IdentityInner> 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 the userAssignedIdentities available under the specified ResourceGroup. + * + * @param resourceGroupName The name of the Resource Group to which the identity belongs. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByResourceGroupAsync(final String resourceGroupName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByResourceGroupSinglePageAsync(resourceGroupName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByResourceGroupNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists all the userAssignedIdentities available under the specified ResourceGroup. + * + * @param resourceGroupName The name of the Resource Group to which the identity belongs. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<IdentityInner> 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 the userAssignedIdentities available under the specified ResourceGroup. + * + * @param resourceGroupName The name of the Resource Group to which the identity belongs. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<IdentityInner> 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 the userAssignedIdentities available under the specified ResourceGroup. + * + ServiceResponse> * @param resourceGroupName The name of the Resource Group to which the identity belongs. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<IdentityInner> 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 CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Create or update an identity in the specified subscription and resource group. + * + * @param resourceGroupName The name of the Resource Group to which the identity belongs. + * @param resourceName The name of the identity resource. + * @param parameters Parameters to create or update the identity + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the IdentityInner object if successful. + */ + public IdentityInner createOrUpdate(String resourceGroupName, String resourceName, IdentityInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, resourceName, parameters).toBlocking().single().body(); + } + + /** + * Create or update an identity in the specified subscription and resource group. + * + * @param resourceGroupName The name of the Resource Group to which the identity belongs. + * @param resourceName The name of the identity resource. + * @param parameters Parameters to create or update the identity + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture createOrUpdateAsync(String resourceGroupName, String resourceName, IdentityInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, resourceName, parameters), serviceCallback); + } + + /** + * Create or update an identity in the specified subscription and resource group. + * + * @param resourceGroupName The name of the Resource Group to which the identity belongs. + * @param resourceName The name of the identity resource. + * @param parameters Parameters to create or update the identity + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the IdentityInner object + */ + public Observable createOrUpdateAsync(String resourceGroupName, String resourceName, IdentityInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, resourceName, parameters).map(new Func1, IdentityInner>() { + @Override + public IdentityInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Create or update an identity in the specified subscription and resource group. + * + * @param resourceGroupName The name of the Resource Group to which the identity belongs. + * @param resourceName The name of the identity resource. + * @param parameters Parameters to create or update the identity + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the IdentityInner object + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String resourceName, IdentityInner parameters) { + 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 (resourceName == null) { + throw new IllegalArgumentException("Parameter resourceName 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 (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + Validator.validate(parameters); + return service.createOrUpdate(this.client.subscriptionId(), resourceGroupName, resourceName, this.client.apiVersion(), parameters, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = createOrUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse createOrUpdateDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(201, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Update an identity in the specified subscription and resource group. + * + * @param resourceGroupName The name of the Resource Group to which the identity belongs. + * @param resourceName The name of the identity resource. + * @param parameters Parameters to update the identity + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the IdentityInner object if successful. + */ + public IdentityInner update(String resourceGroupName, String resourceName, IdentityInner parameters) { + return updateWithServiceResponseAsync(resourceGroupName, resourceName, parameters).toBlocking().single().body(); + } + + /** + * Update an identity in the specified subscription and resource group. + * + * @param resourceGroupName The name of the Resource Group to which the identity belongs. + * @param resourceName The name of the identity resource. + * @param parameters Parameters to update the identity + * @param serviceCallback 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 resourceName, IdentityInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateWithServiceResponseAsync(resourceGroupName, resourceName, parameters), serviceCallback); + } + + /** + * Update an identity in the specified subscription and resource group. + * + * @param resourceGroupName The name of the Resource Group to which the identity belongs. + * @param resourceName The name of the identity resource. + * @param parameters Parameters to update the identity + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the IdentityInner object + */ + public Observable updateAsync(String resourceGroupName, String resourceName, IdentityInner parameters) { + return updateWithServiceResponseAsync(resourceGroupName, resourceName, parameters).map(new Func1, IdentityInner>() { + @Override + public IdentityInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Update an identity in the specified subscription and resource group. + * + * @param resourceGroupName The name of the Resource Group to which the identity belongs. + * @param resourceName The name of the identity resource. + * @param parameters Parameters to update the identity + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the IdentityInner object + */ + public Observable> updateWithServiceResponseAsync(String resourceGroupName, String resourceName, IdentityInner parameters) { + 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 (resourceName == null) { + throw new IllegalArgumentException("Parameter resourceName 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 (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + Validator.validate(parameters); + return service.update(this.client.subscriptionId(), resourceGroupName, resourceName, this.client.apiVersion(), parameters, 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 CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Gets the identity. + * + * @param resourceGroupName The name of the Resource Group to which the identity belongs. + * @param resourceName The name of the identity resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the IdentityInner object if successful. + */ + public IdentityInner getByResourceGroup(String resourceGroupName, String resourceName) { + return getByResourceGroupWithServiceResponseAsync(resourceGroupName, resourceName).toBlocking().single().body(); + } + + /** + * Gets the identity. + * + * @param resourceGroupName The name of the Resource Group to which the identity belongs. + * @param resourceName The name of the identity 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 getByResourceGroupAsync(String resourceGroupName, String resourceName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getByResourceGroupWithServiceResponseAsync(resourceGroupName, resourceName), serviceCallback); + } + + /** + * Gets the identity. + * + * @param resourceGroupName The name of the Resource Group to which the identity belongs. + * @param resourceName The name of the identity resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the IdentityInner object + */ + public Observable getByResourceGroupAsync(String resourceGroupName, String resourceName) { + return getByResourceGroupWithServiceResponseAsync(resourceGroupName, resourceName).map(new Func1, IdentityInner>() { + @Override + public IdentityInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets the identity. + * + * @param resourceGroupName The name of the Resource Group to which the identity belongs. + * @param resourceName The name of the identity resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the IdentityInner object + */ + public Observable> getByResourceGroupWithServiceResponseAsync(String resourceGroupName, String resourceName) { + 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 (resourceName == null) { + throw new IllegalArgumentException("Parameter resourceName 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, resourceName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getByResourceGroupDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getByResourceGroupDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Deletes the identity. + * + * @param resourceGroupName The name of the Resource Group to which the identity belongs. + * @param resourceName The name of the identity resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void delete(String resourceGroupName, String resourceName) { + deleteWithServiceResponseAsync(resourceGroupName, resourceName).toBlocking().single().body(); + } + + /** + * Deletes the identity. + * + * @param resourceGroupName The name of the Resource Group to which the identity belongs. + * @param resourceName The name of the identity 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 deleteAsync(String resourceGroupName, String resourceName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, resourceName), serviceCallback); + } + + /** + * Deletes the identity. + * + * @param resourceGroupName The name of the Resource Group to which the identity belongs. + * @param resourceName The name of the identity resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable deleteAsync(String resourceGroupName, String resourceName) { + return deleteWithServiceResponseAsync(resourceGroupName, resourceName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes the identity. + * + * @param resourceGroupName The name of the Resource Group to which the identity belongs. + * @param resourceName The name of the identity resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> deleteWithServiceResponseAsync(String resourceGroupName, String resourceName) { + 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 (resourceName == null) { + throw new IllegalArgumentException("Parameter resourceName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.delete(this.client.subscriptionId(), resourceGroupName, resourceName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = deleteDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse deleteDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(204, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Lists all the userAssignedIdentities available under the specified subscription. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<IdentityInner> 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 the userAssignedIdentities available under the specified 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 the userAssignedIdentities available under the specified 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<IdentityInner> 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 the userAssignedIdentities available under the specified 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<IdentityInner> 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 the userAssignedIdentities available under the specified 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<IdentityInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listNextDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Lists all the userAssignedIdentities available under the specified ResourceGroup. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<IdentityInner> 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 the userAssignedIdentities available under the specified ResourceGroup. + * + * @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 the userAssignedIdentities available under the specified ResourceGroup. + * + * @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<IdentityInner> 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 the userAssignedIdentities available under the specified ResourceGroup. + * + * @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<IdentityInner> 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 the userAssignedIdentities available under the specified ResourceGroup. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<IdentityInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByResourceGroupNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listByResourceGroupNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByResourceGroupNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByResourceGroupNextDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + +} diff --git a/managedserviceidentity/resource-manager/v2018-11-30/src/main/java/com/microsoft/azure/management/managedserviceidentity/v2018-11-30/implementation/package-info.java b/managedserviceidentity/resource-manager/v2018-11-30/src/main/java/com/microsoft/azure/management/managedserviceidentity/v2018-11-30/implementation/package-info.java new file mode 100644 index 000000000000..8dcac320534d --- /dev/null +++ b/managedserviceidentity/resource-manager/v2018-11-30/src/main/java/com/microsoft/azure/management/managedserviceidentity/v2018-11-30/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 ManagedServiceIdentityClient. + * The Managed Service Identity Client. + */ +package com.microsoft.azure.management.managedserviceidentity.v2018-11-30.implementation; diff --git a/managedserviceidentity/resource-manager/v2018-11-30/src/main/java/com/microsoft/azure/management/managedserviceidentity/v2018-11-30/package-info.java b/managedserviceidentity/resource-manager/v2018-11-30/src/main/java/com/microsoft/azure/management/managedserviceidentity/v2018-11-30/package-info.java new file mode 100644 index 000000000000..3481eb7d9185 --- /dev/null +++ b/managedserviceidentity/resource-manager/v2018-11-30/src/main/java/com/microsoft/azure/management/managedserviceidentity/v2018-11-30/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 ManagedServiceIdentityClient. + * The Managed Service Identity Client. + */ +package com.microsoft.azure.management.managedserviceidentity.v2018-11-30;