diff --git a/sdk/managedserviceidentity/mgmt-v2018-11-30/pom.xml b/sdk/managedserviceidentity/mgmt-v2018-11-30/pom.xml new file mode 100644 index 000000000000..0e553844fafe --- /dev/null +++ b/sdk/managedserviceidentity/mgmt-v2018-11-30/pom.xml @@ -0,0 +1,135 @@ + + + 4.0.0 + com.microsoft.azure.managedserviceidentity.v2018-11-30 + + com.microsoft.azure + azure-arm-parent + 1.1.0 + ../../../pom.management.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-sdk-for-java + + + The MIT License (MIT) + http://opensource.org/licenses/MIT + repo + + + + scm:git:https://github.com/Azure/azure-sdk-for-java + scm:git:git@github.com:Azure/azure-sdk-for-java.git + HEAD + + + UTF-8 + + + + + microsoft + Microsoft + + + + + com.microsoft.azure + azure-client-runtime + + + com.microsoft.azure + azure-arm-client-runtime + + + junit + junit + test + + + com.microsoft.azure + azure-client-authentication + test + + + com.microsoft.azure + azure-mgmt-resources + test + + + com.microsoft.azure + azure-arm-client-runtime + test-jar + test + + 1.6.5 + + + + + + org.apache.maven.plugins + maven-jar-plugin + + + + true + true + + + + + + org.codehaus.mojo + build-helper-maven-plugin + + + org.apache.maven.plugins + maven-compiler-plugin + 3.1 + + 1.7 + 1.7 + + + com.microsoft.azure.management.apigeneration.LangDefinitionProcessor + + + true + true + + true + true + + + + + org.apache.maven.plugins + maven-javadoc-plugin + 2.8 + + *.implementation.*;*.utils.*;com.microsoft.schemas._2003._10.serialization;*.blob.core.search + + + /** +
* Copyright (c) Microsoft Corporation. All rights reserved. +
* Licensed under the MIT License. See License.txt in the project root for +
* license information. +
*/ + ]]> +
+
+
+
+
+
diff --git a/sdk/managedserviceidentity/mgmt-v2018-11-30/src/main/java/com/microsoft/azure/management/managedserviceidentity/v2018-11-30/Identity.java b/sdk/managedserviceidentity/mgmt-v2018-11-30/src/main/java/com/microsoft/azure/management/managedserviceidentity/v2018-11-30/Identity.java new file mode 100644 index 000000000000..cd8cab258437 --- /dev/null +++ b/sdk/managedserviceidentity/mgmt-v2018-11-30/src/main/java/com/microsoft/azure/management/managedserviceidentity/v2018-11-30/Identity.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.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 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/sdk/managedserviceidentity/mgmt-v2018-11-30/src/main/java/com/microsoft/azure/management/managedserviceidentity/v2018-11-30/IdentityPatch.java b/sdk/managedserviceidentity/mgmt-v2018-11-30/src/main/java/com/microsoft/azure/management/managedserviceidentity/v2018-11-30/IdentityPatch.java new file mode 100644 index 000000000000..b2ef39c9fa76 --- /dev/null +++ b/sdk/managedserviceidentity/mgmt-v2018-11-30/src/main/java/com/microsoft/azure/management/managedserviceidentity/v2018-11-30/IdentityPatch.java @@ -0,0 +1,153 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.managedserviceidentity.v2018-11-30; + +import java.util.Map; +import java.util.UUID; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.SubResource; + +/** + * Describes an identity resource. + */ +@JsonFlatten +public class IdentityPatch extends SubResource { + /** + * Resource tags. + */ + @JsonProperty(value = "tags") + private Map tags; + + /** + * 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 type of resource i.e. + * Microsoft.ManagedIdentity/userAssignedIdentities. Possible values + * include: 'Microsoft.ManagedIdentity/userAssignedIdentities'. + */ + @JsonProperty(value = "type", access = JsonProperty.Access.WRITE_ONLY) + private UserAssignedIdentities type; + + /** + * The name of the resource. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /** + * The Azure region where the resource lives. + */ + @JsonProperty(value = "location") + private String location; + + /** + * Get resource tags. + * + * @return the tags value + */ + public Map tags() { + return this.tags; + } + + /** + * Set resource tags. + * + * @param tags the tags value to set + * @return the IdentityPatch object itself. + */ + public IdentityPatch withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * 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 type of resource i.e. Microsoft.ManagedIdentity/userAssignedIdentities. Possible values include: 'Microsoft.ManagedIdentity/userAssignedIdentities'. + * + * @return the type value + */ + public UserAssignedIdentities type() { + return this.type; + } + + /** + * Get the name of the resource. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Get the Azure region where the resource lives. + * + * @return the location value + */ + public String location() { + return this.location; + } + + /** + * Set the Azure region where the resource lives. + * + * @param location the location value to set + * @return the IdentityPatch object itself. + */ + public IdentityPatch withLocation(String location) { + this.location = location; + return this; + } + +} diff --git a/sdk/managedserviceidentity/mgmt-v2018-11-30/src/main/java/com/microsoft/azure/management/managedserviceidentity/v2018-11-30/Operation.java b/sdk/managedserviceidentity/mgmt-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/sdk/managedserviceidentity/mgmt-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/sdk/managedserviceidentity/mgmt-v2018-11-30/src/main/java/com/microsoft/azure/management/managedserviceidentity/v2018-11-30/OperationDisplay.java b/sdk/managedserviceidentity/mgmt-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/sdk/managedserviceidentity/mgmt-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/sdk/managedserviceidentity/mgmt-v2018-11-30/src/main/java/com/microsoft/azure/management/managedserviceidentity/v2018-11-30/Operations.java b/sdk/managedserviceidentity/mgmt-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/sdk/managedserviceidentity/mgmt-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/sdk/managedserviceidentity/mgmt-v2018-11-30/src/main/java/com/microsoft/azure/management/managedserviceidentity/v2018-11-30/SystemAssignedIdentities.java b/sdk/managedserviceidentity/mgmt-v2018-11-30/src/main/java/com/microsoft/azure/management/managedserviceidentity/v2018-11-30/SystemAssignedIdentities.java new file mode 100644 index 000000000000..9363c6e8e4cd --- /dev/null +++ b/sdk/managedserviceidentity/mgmt-v2018-11-30/src/main/java/com/microsoft/azure/management/managedserviceidentity/v2018-11-30/SystemAssignedIdentities.java @@ -0,0 +1,28 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT 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.SystemAssignedIdentitiesInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing SystemAssignedIdentities. + */ +public interface SystemAssignedIdentities extends HasInner { + /** + * Gets the systemAssignedIdentity available under the specified RP scope. + * + * @param scope The resource provider scope of the resource. Parent resource being extended by Managed Identities. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getByScopeAsync(String scope); + +} diff --git a/sdk/managedserviceidentity/mgmt-v2018-11-30/src/main/java/com/microsoft/azure/management/managedserviceidentity/v2018-11-30/SystemAssignedIdentity.java b/sdk/managedserviceidentity/mgmt-v2018-11-30/src/main/java/com/microsoft/azure/management/managedserviceidentity/v2018-11-30/SystemAssignedIdentity.java new file mode 100644 index 000000000000..88942f2e0961 --- /dev/null +++ b/sdk/managedserviceidentity/mgmt-v2018-11-30/src/main/java/com/microsoft/azure/management/managedserviceidentity/v2018-11-30/SystemAssignedIdentity.java @@ -0,0 +1,61 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.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.SystemAssignedIdentityInner; +import java.util.UUID; + +/** + * Type representing SystemAssignedIdentity. + */ +public interface SystemAssignedIdentity extends HasInner, HasManager { + /** + * @return the clientId value. + */ + UUID clientId(); + + /** + * @return the clientSecretUrl value. + */ + String clientSecretUrl(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the location value. + */ + String location(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the principalId value. + */ + UUID principalId(); + + /** + * @return the tenantId value. + */ + UUID tenantId(); + + /** + * @return the type value. + */ + String type(); + +} diff --git a/sdk/managedserviceidentity/mgmt-v2018-11-30/src/main/java/com/microsoft/azure/management/managedserviceidentity/v2018-11-30/UserAssignedIdentities.java b/sdk/managedserviceidentity/mgmt-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/sdk/managedserviceidentity/mgmt-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/sdk/managedserviceidentity/mgmt-v2018-11-30/src/main/java/com/microsoft/azure/management/managedserviceidentity/v2018-11-30/implementation/IdParsingUtils.java b/sdk/managedserviceidentity/mgmt-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/sdk/managedserviceidentity/mgmt-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/sdk/managedserviceidentity/mgmt-v2018-11-30/src/main/java/com/microsoft/azure/management/managedserviceidentity/v2018-11-30/implementation/IdentityImpl.java b/sdk/managedserviceidentity/mgmt-v2018-11-30/src/main/java/com/microsoft/azure/management/managedserviceidentity/v2018-11-30/implementation/IdentityImpl.java new file mode 100644 index 000000000000..e4936bafad5d --- /dev/null +++ b/sdk/managedserviceidentity/mgmt-v2018-11-30/src/main/java/com/microsoft/azure/management/managedserviceidentity/v2018-11-30/implementation/IdentityImpl.java @@ -0,0 +1,83 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.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 com.microsoft.azure.management.managedserviceidentity.v2018-11-30.IdentityPatch; +import java.util.UUID; +import rx.functions.Func1; + +class IdentityImpl extends GroupableResourceCoreImpl implements Identity, Identity.Definition, Identity.Update { + private IdentityPatch updateParameter; + IdentityImpl(String name, IdentityInner inner, ManagedIdentityManager manager) { + super(name, inner, manager); + this.updateParameter = new IdentityPatch(); + } + + @Override + public Observable createResourceAsync() { + UserAssignedIdentitiesInner client = this.manager().inner().userAssignedIdentities(); + return client.createOrUpdateAsync(this.resourceGroupName(), this.name(), this.inner()) + .map(new Func1() { + @Override + public IdentityInner call(IdentityInner resource) { + resetCreateUpdateParameters(); + return resource; + } + }) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + UserAssignedIdentitiesInner client = this.manager().inner().userAssignedIdentities(); + return client.updateAsync(this.resourceGroupName(), this.name(), this.updateParameter) + .map(new Func1() { + @Override + public IdentityInner call(IdentityInner resource) { + resetCreateUpdateParameters(); + return resource; + } + }) + .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; + } + + private void resetCreateUpdateParameters() { + this.updateParameter = new IdentityPatch(); + } + + @Override + public UUID clientId() { + return this.inner().clientId(); + } + + @Override + public UUID principalId() { + return this.inner().principalId(); + } + + @Override + public UUID tenantId() { + return this.inner().tenantId(); + } + +} diff --git a/sdk/managedserviceidentity/mgmt-v2018-11-30/src/main/java/com/microsoft/azure/management/managedserviceidentity/v2018-11-30/implementation/IdentityInner.java b/sdk/managedserviceidentity/mgmt-v2018-11-30/src/main/java/com/microsoft/azure/management/managedserviceidentity/v2018-11-30/implementation/IdentityInner.java new file mode 100644 index 000000000000..ab06e4e85ad8 --- /dev/null +++ b/sdk/managedserviceidentity/mgmt-v2018-11-30/src/main/java/com/microsoft/azure/management/managedserviceidentity/v2018-11-30/implementation/IdentityInner.java @@ -0,0 +1,154 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.managedserviceidentity.v2018-11-30.implementation; + +import java.util.Map; +import java.util.UUID; +import com.microsoft.azure.management.managedserviceidentity.v2018-11-30.UserAssignedIdentities; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.SubResource; + +/** + * Describes an identity resource. + */ +@JsonFlatten +public class IdentityInner extends SubResource { + /** + * Resource tags. + */ + @JsonProperty(value = "tags") + private Map tags; + + /** + * 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 type of resource i.e. + * Microsoft.ManagedIdentity/userAssignedIdentities. Possible values + * include: 'Microsoft.ManagedIdentity/userAssignedIdentities'. + */ + @JsonProperty(value = "type", access = JsonProperty.Access.WRITE_ONLY) + private UserAssignedIdentities type; + + /** + * The name of the resource. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /** + * The Azure region where the resource lives. + */ + @JsonProperty(value = "location") + private String location; + + /** + * Get resource tags. + * + * @return the tags value + */ + public Map tags() { + return this.tags; + } + + /** + * Set resource tags. + * + * @param tags the tags value to set + * @return the IdentityInner object itself. + */ + public IdentityInner withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * 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 type of resource i.e. Microsoft.ManagedIdentity/userAssignedIdentities. Possible values include: 'Microsoft.ManagedIdentity/userAssignedIdentities'. + * + * @return the type value + */ + public UserAssignedIdentities type() { + return this.type; + } + + /** + * Get the name of the resource. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Get the Azure region where the resource lives. + * + * @return the location value + */ + public String location() { + return this.location; + } + + /** + * Set the Azure region where the resource lives. + * + * @param location the location value to set + * @return the IdentityInner object itself. + */ + public IdentityInner withLocation(String location) { + this.location = location; + return this; + } + +} diff --git a/sdk/managedserviceidentity/mgmt-v2018-11-30/src/main/java/com/microsoft/azure/management/managedserviceidentity/v2018-11-30/implementation/ManagedIdentityManager.java b/sdk/managedserviceidentity/mgmt-v2018-11-30/src/main/java/com/microsoft/azure/management/managedserviceidentity/v2018-11-30/implementation/ManagedIdentityManager.java new file mode 100644 index 000000000000..76f8da43775d --- /dev/null +++ b/sdk/managedserviceidentity/mgmt-v2018-11-30/src/main/java/com/microsoft/azure/management/managedserviceidentity/v2018-11-30/implementation/ManagedIdentityManager.java @@ -0,0 +1,123 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.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.SystemAssignedIdentities; +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 SystemAssignedIdentities systemAssignedIdentities; + 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 SystemAssignedIdentities. + */ + public SystemAssignedIdentities systemAssignedIdentities() { + if (this.systemAssignedIdentities == null) { + this.systemAssignedIdentities = new SystemAssignedIdentitiesImpl(this); + } + return this.systemAssignedIdentities; + } + + /** + * @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/sdk/managedserviceidentity/mgmt-v2018-11-30/src/main/java/com/microsoft/azure/management/managedserviceidentity/v2018-11-30/implementation/ManagedServiceIdentityClientImpl.java b/sdk/managedserviceidentity/mgmt-v2018-11-30/src/main/java/com/microsoft/azure/management/managedserviceidentity/v2018-11-30/implementation/ManagedServiceIdentityClientImpl.java new file mode 100644 index 000000000000..01a18d0fb9db --- /dev/null +++ b/sdk/managedserviceidentity/mgmt-v2018-11-30/src/main/java/com/microsoft/azure/management/managedserviceidentity/v2018-11-30/implementation/ManagedServiceIdentityClientImpl.java @@ -0,0 +1,224 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT 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; + } + + /** The preferred language for the response. */ + private String acceptLanguage; + + /** + * Gets The preferred language for the response. + * + * @return the acceptLanguage value. + */ + public String acceptLanguage() { + return this.acceptLanguage; + } + + /** + * Sets The preferred language for the response. + * + * @param acceptLanguage the acceptLanguage value. + * @return the service client itself + */ + public ManagedServiceIdentityClientImpl withAcceptLanguage(String acceptLanguage) { + this.acceptLanguage = acceptLanguage; + return this; + } + + /** The retry timeout in seconds for Long Running Operations. Default value is 30. */ + private int longRunningOperationRetryTimeout; + + /** + * Gets The retry timeout in seconds for Long Running Operations. Default value is 30. + * + * @return the longRunningOperationRetryTimeout value. + */ + public int longRunningOperationRetryTimeout() { + return this.longRunningOperationRetryTimeout; + } + + /** + * Sets The retry timeout in seconds for Long Running Operations. Default value is 30. + * + * @param longRunningOperationRetryTimeout the longRunningOperationRetryTimeout value. + * @return the service client itself + */ + public ManagedServiceIdentityClientImpl withLongRunningOperationRetryTimeout(int longRunningOperationRetryTimeout) { + this.longRunningOperationRetryTimeout = longRunningOperationRetryTimeout; + return this; + } + + /** Whether a unique x-ms-client-request-id should be generated. When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. */ + private boolean generateClientRequestId; + + /** + * Gets Whether a unique x-ms-client-request-id should be generated. When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. + * + * @return the generateClientRequestId value. + */ + public boolean generateClientRequestId() { + return this.generateClientRequestId; + } + + /** + * Sets Whether a unique x-ms-client-request-id should be generated. When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. + * + * @param generateClientRequestId the generateClientRequestId value. + * @return the service client itself + */ + public ManagedServiceIdentityClientImpl withGenerateClientRequestId(boolean generateClientRequestId) { + this.generateClientRequestId = generateClientRequestId; + return this; + } + + /** + * The SystemAssignedIdentitiesInner object to access its operations. + */ + private SystemAssignedIdentitiesInner systemAssignedIdentities; + + /** + * Gets the SystemAssignedIdentitiesInner object to access its operations. + * @return the SystemAssignedIdentitiesInner object. + */ + public SystemAssignedIdentitiesInner systemAssignedIdentities() { + return this.systemAssignedIdentities; + } + + /** + * 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.systemAssignedIdentities = new SystemAssignedIdentitiesInner(restClient().retrofit(), this); + 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, auto-generated)", super.userAgent(), "ManagedServiceIdentityClient", "2018-11-30"); + } +} diff --git a/sdk/managedserviceidentity/mgmt-v2018-11-30/src/main/java/com/microsoft/azure/management/managedserviceidentity/v2018-11-30/implementation/OperationImpl.java b/sdk/managedserviceidentity/mgmt-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/sdk/managedserviceidentity/mgmt-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/sdk/managedserviceidentity/mgmt-v2018-11-30/src/main/java/com/microsoft/azure/management/managedserviceidentity/v2018-11-30/implementation/OperationInner.java b/sdk/managedserviceidentity/mgmt-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/sdk/managedserviceidentity/mgmt-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/sdk/managedserviceidentity/mgmt-v2018-11-30/src/main/java/com/microsoft/azure/management/managedserviceidentity/v2018-11-30/implementation/OperationsImpl.java b/sdk/managedserviceidentity/mgmt-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/sdk/managedserviceidentity/mgmt-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/sdk/managedserviceidentity/mgmt-v2018-11-30/src/main/java/com/microsoft/azure/management/managedserviceidentity/v2018-11-30/implementation/OperationsInner.java b/sdk/managedserviceidentity/mgmt-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/sdk/managedserviceidentity/mgmt-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/sdk/managedserviceidentity/mgmt-v2018-11-30/src/main/java/com/microsoft/azure/management/managedserviceidentity/v2018-11-30/implementation/PageImpl.java b/sdk/managedserviceidentity/mgmt-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/sdk/managedserviceidentity/mgmt-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/sdk/managedserviceidentity/mgmt-v2018-11-30/src/main/java/com/microsoft/azure/management/managedserviceidentity/v2018-11-30/implementation/SystemAssignedIdentitiesImpl.java b/sdk/managedserviceidentity/mgmt-v2018-11-30/src/main/java/com/microsoft/azure/management/managedserviceidentity/v2018-11-30/implementation/SystemAssignedIdentitiesImpl.java new file mode 100644 index 000000000000..e0f598949e80 --- /dev/null +++ b/sdk/managedserviceidentity/mgmt-v2018-11-30/src/main/java/com/microsoft/azure/management/managedserviceidentity/v2018-11-30/implementation/SystemAssignedIdentitiesImpl.java @@ -0,0 +1,42 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * abc + */ + +package com.microsoft.azure.management.managedserviceidentity.v2018-11-30.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.managedserviceidentity.v2018-11-30.SystemAssignedIdentities; +import rx.functions.Func1; +import rx.Observable; +import com.microsoft.azure.management.managedserviceidentity.v2018-11-30.SystemAssignedIdentity; + +class SystemAssignedIdentitiesImpl extends WrapperImpl implements SystemAssignedIdentities { + private final ManagedIdentityManager manager; + + SystemAssignedIdentitiesImpl(ManagedIdentityManager manager) { + super(manager.inner().systemAssignedIdentities()); + this.manager = manager; + } + + public ManagedIdentityManager manager() { + return this.manager; + } + + @Override + public Observable getByScopeAsync(String scope) { + SystemAssignedIdentitiesInner client = this.inner(); + return client.getByScopeAsync(scope) + .map(new Func1() { + @Override + public SystemAssignedIdentity call(SystemAssignedIdentityInner inner) { + return new SystemAssignedIdentityImpl(inner, manager()); + } + }); + } + +} diff --git a/sdk/managedserviceidentity/mgmt-v2018-11-30/src/main/java/com/microsoft/azure/management/managedserviceidentity/v2018-11-30/implementation/SystemAssignedIdentitiesInner.java b/sdk/managedserviceidentity/mgmt-v2018-11-30/src/main/java/com/microsoft/azure/management/managedserviceidentity/v2018-11-30/implementation/SystemAssignedIdentitiesInner.java new file mode 100644 index 000000000000..b54ea3e7b1fd --- /dev/null +++ b/sdk/managedserviceidentity/mgmt-v2018-11-30/src/main/java/com/microsoft/azure/management/managedserviceidentity/v2018-11-30/implementation/SystemAssignedIdentitiesInner.java @@ -0,0 +1,136 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT 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.CloudException; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import java.io.IOException; +import okhttp3.ResponseBody; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Path; +import retrofit2.http.Query; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in SystemAssignedIdentities. + */ +public class SystemAssignedIdentitiesInner { + /** The Retrofit service to perform REST calls. */ + private SystemAssignedIdentitiesService service; + /** The service client containing this operation class. */ + private ManagedServiceIdentityClientImpl client; + + /** + * Initializes an instance of SystemAssignedIdentitiesInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public SystemAssignedIdentitiesInner(Retrofit retrofit, ManagedServiceIdentityClientImpl client) { + this.service = retrofit.create(SystemAssignedIdentitiesService.class); + this.client = client; + } + + /** + * The interface defining all the services for SystemAssignedIdentities to be + * used by Retrofit to perform actually REST calls. + */ + interface SystemAssignedIdentitiesService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.managedserviceidentity.v2018-11-30.SystemAssignedIdentities getByScope" }) + @GET("{scope}/providers/Microsoft.ManagedIdentity/identities/default") + Observable> getByScope(@Path(value = "scope", encoded = true) String scope, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Gets the systemAssignedIdentity available under the specified RP scope. + * + * @param scope The resource provider scope of the resource. Parent resource being extended by Managed Identities. + * @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 SystemAssignedIdentityInner object if successful. + */ + public SystemAssignedIdentityInner getByScope(String scope) { + return getByScopeWithServiceResponseAsync(scope).toBlocking().single().body(); + } + + /** + * Gets the systemAssignedIdentity available under the specified RP scope. + * + * @param scope The resource provider scope of the resource. Parent resource being extended by Managed Identities. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getByScopeAsync(String scope, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getByScopeWithServiceResponseAsync(scope), serviceCallback); + } + + /** + * Gets the systemAssignedIdentity available under the specified RP scope. + * + * @param scope The resource provider scope of the resource. Parent resource being extended by Managed Identities. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SystemAssignedIdentityInner object + */ + public Observable getByScopeAsync(String scope) { + return getByScopeWithServiceResponseAsync(scope).map(new Func1, SystemAssignedIdentityInner>() { + @Override + public SystemAssignedIdentityInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets the systemAssignedIdentity available under the specified RP scope. + * + * @param scope The resource provider scope of the resource. Parent resource being extended by Managed Identities. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SystemAssignedIdentityInner object + */ + public Observable> getByScopeWithServiceResponseAsync(String scope) { + if (scope == null) { + throw new IllegalArgumentException("Parameter scope 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.getByScope(scope, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getByScopeDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getByScopeDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + +} diff --git a/sdk/managedserviceidentity/mgmt-v2018-11-30/src/main/java/com/microsoft/azure/management/managedserviceidentity/v2018-11-30/implementation/SystemAssignedIdentityImpl.java b/sdk/managedserviceidentity/mgmt-v2018-11-30/src/main/java/com/microsoft/azure/management/managedserviceidentity/v2018-11-30/implementation/SystemAssignedIdentityImpl.java new file mode 100644 index 000000000000..c39a28607b94 --- /dev/null +++ b/sdk/managedserviceidentity/mgmt-v2018-11-30/src/main/java/com/microsoft/azure/management/managedserviceidentity/v2018-11-30/implementation/SystemAssignedIdentityImpl.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.management.managedserviceidentity.v2018-11-30.SystemAssignedIdentity; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import java.util.UUID; + +class SystemAssignedIdentityImpl extends WrapperImpl implements SystemAssignedIdentity { + private final ManagedIdentityManager manager; + SystemAssignedIdentityImpl(SystemAssignedIdentityInner inner, ManagedIdentityManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public ManagedIdentityManager manager() { + return this.manager; + } + + @Override + public UUID clientId() { + return this.inner().clientId(); + } + + @Override + public String clientSecretUrl() { + return this.inner().clientSecretUrl(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String location() { + return this.inner().location(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public UUID principalId() { + return this.inner().principalId(); + } + + @Override + public UUID tenantId() { + return this.inner().tenantId(); + } + + @Override + public String type() { + return this.inner().type(); + } + +} diff --git a/sdk/managedserviceidentity/mgmt-v2018-11-30/src/main/java/com/microsoft/azure/management/managedserviceidentity/v2018-11-30/implementation/SystemAssignedIdentityInner.java b/sdk/managedserviceidentity/mgmt-v2018-11-30/src/main/java/com/microsoft/azure/management/managedserviceidentity/v2018-11-30/implementation/SystemAssignedIdentityInner.java new file mode 100644 index 000000000000..8dd406ab737c --- /dev/null +++ b/sdk/managedserviceidentity/mgmt-v2018-11-30/src/main/java/com/microsoft/azure/management/managedserviceidentity/v2018-11-30/implementation/SystemAssignedIdentityInner.java @@ -0,0 +1,140 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.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.SubResource; + +/** + * Describes a system assigned identity resource. + */ +@JsonFlatten +public class SystemAssignedIdentityInner extends SubResource { + /** + * 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; + + /** + * The type of resource i.e. Microsoft.Compute/virtualMachineScaleSets. + */ + @JsonProperty(value = "type", access = JsonProperty.Access.WRITE_ONLY) + private String type; + + /** + * The name of the resource. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /** + * The Azure region where the resource lives. + */ + @JsonProperty(value = "location") + private String location; + + /** + * 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; + } + + /** + * Get the type of resource i.e. Microsoft.Compute/virtualMachineScaleSets. + * + * @return the type value + */ + public String type() { + return this.type; + } + + /** + * Get the name of the resource. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Get the Azure region where the resource lives. + * + * @return the location value + */ + public String location() { + return this.location; + } + + /** + * Set the Azure region where the resource lives. + * + * @param location the location value to set + * @return the SystemAssignedIdentityInner object itself. + */ + public SystemAssignedIdentityInner withLocation(String location) { + this.location = location; + return this; + } + +} diff --git a/sdk/managedserviceidentity/mgmt-v2018-11-30/src/main/java/com/microsoft/azure/management/managedserviceidentity/v2018-11-30/implementation/UserAssignedIdentitiesImpl.java b/sdk/managedserviceidentity/mgmt-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/sdk/managedserviceidentity/mgmt-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/sdk/managedserviceidentity/mgmt-v2018-11-30/src/main/java/com/microsoft/azure/management/managedserviceidentity/v2018-11-30/implementation/UserAssignedIdentitiesInner.java b/sdk/managedserviceidentity/mgmt-v2018-11-30/src/main/java/com/microsoft/azure/management/managedserviceidentity/v2018-11-30/implementation/UserAssignedIdentitiesInner.java new file mode 100644 index 000000000000..0e3c13933e87 --- /dev/null +++ b/sdk/managedserviceidentity/mgmt-v2018-11-30/src/main/java/com/microsoft/azure/management/managedserviceidentity/v2018-11-30/implementation/UserAssignedIdentitiesInner.java @@ -0,0 +1,908 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT 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.management.managedserviceidentity.v2018-11-30.IdentityPatch; +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 IdentityPatch 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, IdentityPatch 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, IdentityPatch 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, IdentityPatch 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, IdentityPatch 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/sdk/managedserviceidentity/mgmt-v2018-11-30/src/main/java/com/microsoft/azure/management/managedserviceidentity/v2018-11-30/implementation/package-info.java b/sdk/managedserviceidentity/mgmt-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/sdk/managedserviceidentity/mgmt-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/sdk/managedserviceidentity/mgmt-v2018-11-30/src/main/java/com/microsoft/azure/management/managedserviceidentity/v2018-11-30/package-info.java b/sdk/managedserviceidentity/mgmt-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/sdk/managedserviceidentity/mgmt-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;