diff --git a/authorization/resource-manager/v2015_07_01/src/main/java/com/microsoft/azure/management/authorization/v2015_07_01/ElevateAccess.java b/authorization/resource-manager/v2015_07_01/src/main/java/com/microsoft/azure/management/authorization/v2015_07_01/ElevateAccess.java new file mode 100644 index 000000000000..f2d4937870ff --- /dev/null +++ b/authorization/resource-manager/v2015_07_01/src/main/java/com/microsoft/azure/management/authorization/v2015_07_01/ElevateAccess.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.authorization.v2015_07_01; + +import rx.Completable; +import com.microsoft.azure.management.authorization.v2015_07_01.implementation.ElevateAccessInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing ElevateAccess. + */ +public interface ElevateAccess extends HasInner { + /** + * Elevates access for a Global Administrator. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable postAsync(); + +} diff --git a/authorization/resource-manager/v2015_07_01/src/main/java/com/microsoft/azure/management/authorization/v2015_07_01/implementation/AuthorizationManagementClientImpl.java b/authorization/resource-manager/v2015_07_01/src/main/java/com/microsoft/azure/management/authorization/v2015_07_01/implementation/AuthorizationManagementClientImpl.java index de1757b192e5..10a436afbaf2 100644 --- a/authorization/resource-manager/v2015_07_01/src/main/java/com/microsoft/azure/management/authorization/v2015_07_01/implementation/AuthorizationManagementClientImpl.java +++ b/authorization/resource-manager/v2015_07_01/src/main/java/com/microsoft/azure/management/authorization/v2015_07_01/implementation/AuthorizationManagementClientImpl.java @@ -184,6 +184,19 @@ public RoleDefinitionsInner roleDefinitions() { return this.roleDefinitions; } + /** + * The ElevateAccessInner object to access its operations. + */ + private ElevateAccessInner elevateAccess; + + /** + * Gets the ElevateAccessInner object to access its operations. + * @return the ElevateAccessInner object. + */ + public ElevateAccessInner elevateAccess() { + return this.elevateAccess; + } + /** * The ClassicAdministratorsInner object to access its operations. */ @@ -236,6 +249,7 @@ protected void initialize() { this.providerOperationsMetadatas = new ProviderOperationsMetadatasInner(restClient().retrofit(), this); this.roleAssignments = new RoleAssignmentsInner(restClient().retrofit(), this); this.roleDefinitions = new RoleDefinitionsInner(restClient().retrofit(), this); + this.elevateAccess = new ElevateAccessInner(restClient().retrofit(), this); this.classicAdministrators = new ClassicAdministratorsInner(restClient().retrofit(), this); this.azureClient = new AzureClient(this); } diff --git a/authorization/resource-manager/v2015_07_01/src/main/java/com/microsoft/azure/management/authorization/v2015_07_01/implementation/AuthorizationManager.java b/authorization/resource-manager/v2015_07_01/src/main/java/com/microsoft/azure/management/authorization/v2015_07_01/implementation/AuthorizationManager.java index 2f96613e2d2d..bbf5bdc24138 100644 --- a/authorization/resource-manager/v2015_07_01/src/main/java/com/microsoft/azure/management/authorization/v2015_07_01/implementation/AuthorizationManager.java +++ b/authorization/resource-manager/v2015_07_01/src/main/java/com/microsoft/azure/management/authorization/v2015_07_01/implementation/AuthorizationManager.java @@ -20,6 +20,7 @@ import com.microsoft.azure.management.authorization.v2015_07_01.ProviderOperationsMetadatas; import com.microsoft.azure.management.authorization.v2015_07_01.RoleAssignments; import com.microsoft.azure.management.authorization.v2015_07_01.RoleDefinitions; +import com.microsoft.azure.management.authorization.v2015_07_01.ElevateAccess; import com.microsoft.azure.management.authorization.v2015_07_01.ClassicAdministrators; import com.microsoft.azure.arm.resources.implementation.AzureConfigurableCoreImpl; import com.microsoft.azure.arm.resources.implementation.ManagerCore; @@ -32,6 +33,7 @@ public final class AuthorizationManager extends ManagerCore implements ElevateAccess { + private final AuthorizationManager manager; + + ElevateAccessImpl(AuthorizationManager manager) { + super(manager.inner().elevateAccess()); + this.manager = manager; + } + + public AuthorizationManager manager() { + return this.manager; + } + + @Override + public Completable postAsync() { + ElevateAccessInner client = this.inner(); + return client.postAsync().toCompletable(); + } + +} diff --git a/authorization/resource-manager/v2015_07_01/src/main/java/com/microsoft/azure/management/authorization/v2015_07_01/implementation/ElevateAccessInner.java b/authorization/resource-manager/v2015_07_01/src/main/java/com/microsoft/azure/management/authorization/v2015_07_01/implementation/ElevateAccessInner.java new file mode 100644 index 000000000000..d9e326a9bc91 --- /dev/null +++ b/authorization/resource-manager/v2015_07_01/src/main/java/com/microsoft/azure/management/authorization/v2015_07_01/implementation/ElevateAccessInner.java @@ -0,0 +1,127 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.authorization.v2015_07_01.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.Header; +import retrofit2.http.Headers; +import retrofit2.http.POST; +import retrofit2.http.Query; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in ElevateAccess. + */ +public class ElevateAccessInner { + /** The Retrofit service to perform REST calls. */ + private ElevateAccessService service; + /** The service client containing this operation class. */ + private AuthorizationManagementClientImpl client; + + /** + * Initializes an instance of ElevateAccessInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public ElevateAccessInner(Retrofit retrofit, AuthorizationManagementClientImpl client) { + this.service = retrofit.create(ElevateAccessService.class); + this.client = client; + } + + /** + * The interface defining all the services for ElevateAccess to be + * used by Retrofit to perform actually REST calls. + */ + interface ElevateAccessService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.authorization.v2015_07_01.ElevateAccess post" }) + @POST("providers/Microsoft.Authorization/elevateAccess") + Observable> post(@Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Elevates access for a Global Administrator. + * + * @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 post() { + postWithServiceResponseAsync().toBlocking().single().body(); + } + + /** + * Elevates access for a Global Administrator. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture postAsync(final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(postWithServiceResponseAsync(), serviceCallback); + } + + /** + * Elevates access for a Global Administrator. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable postAsync() { + return postWithServiceResponseAsync().map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Elevates access for a Global Administrator. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> postWithServiceResponseAsync() { + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.post(this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = postDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse postDelegate(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/authorization/resource-manager/v2018_09_01_preview/src/main/java/com/microsoft/azure/management/authorization/v2018_09_01_preview/RoleAssignment.java b/authorization/resource-manager/v2018_09_01_preview/src/main/java/com/microsoft/azure/management/authorization/v2018_09_01_preview/RoleAssignment.java index c94e33be441f..3aece969d77b 100644 --- a/authorization/resource-manager/v2018_09_01_preview/src/main/java/com/microsoft/azure/management/authorization/v2018_09_01_preview/RoleAssignment.java +++ b/authorization/resource-manager/v2018_09_01_preview/src/main/java/com/microsoft/azure/management/authorization/v2018_09_01_preview/RoleAssignment.java @@ -41,6 +41,11 @@ public interface RoleAssignment extends HasInner, Indexable */ String principalId(); + /** + * @return the principalType value. + */ + PrincipalType principalType(); + /** * @return the roleDefinitionId value. */ @@ -125,7 +130,7 @@ interface WithRoleDefinitionId { interface WithCanDelegate { /** * Specifies canDelegate. - * @param canDelegate The delgation flag used for creating a role assignment + * @param canDelegate The delegation flag used for creating a role assignment * @return the next definition stage */ WithCreate withCanDelegate(Boolean canDelegate); @@ -167,7 +172,7 @@ interface UpdateStages { interface WithCanDelegate { /** * Specifies canDelegate. - * @param canDelegate The delgation flag used for creating a role assignment + * @param canDelegate The delegation flag used for creating a role assignment * @return the next update stage */ Update withCanDelegate(Boolean canDelegate); diff --git a/authorization/resource-manager/v2018_09_01_preview/src/main/java/com/microsoft/azure/management/authorization/v2018_09_01_preview/RoleAssignmentCreateParameters.java b/authorization/resource-manager/v2018_09_01_preview/src/main/java/com/microsoft/azure/management/authorization/v2018_09_01_preview/RoleAssignmentCreateParameters.java index 1d03f6918fff..386f5c011702 100644 --- a/authorization/resource-manager/v2018_09_01_preview/src/main/java/com/microsoft/azure/management/authorization/v2018_09_01_preview/RoleAssignmentCreateParameters.java +++ b/authorization/resource-manager/v2018_09_01_preview/src/main/java/com/microsoft/azure/management/authorization/v2018_09_01_preview/RoleAssignmentCreateParameters.java @@ -40,7 +40,7 @@ public class RoleAssignmentCreateParameters { private PrincipalType principalType; /** - * The delgation flag used for creating a role assignment. + * The delegation flag used for creating a role assignment. */ @JsonProperty(value = "properties.canDelegate") private Boolean canDelegate; @@ -106,7 +106,7 @@ public RoleAssignmentCreateParameters withPrincipalType(PrincipalType principalT } /** - * Get the delgation flag used for creating a role assignment. + * Get the delegation flag used for creating a role assignment. * * @return the canDelegate value */ @@ -115,7 +115,7 @@ public Boolean canDelegate() { } /** - * Set the delgation flag used for creating a role assignment. + * Set the delegation flag used for creating a role assignment. * * @param canDelegate the canDelegate value to set * @return the RoleAssignmentCreateParameters object itself. diff --git a/authorization/resource-manager/v2018_09_01_preview/src/main/java/com/microsoft/azure/management/authorization/v2018_09_01_preview/RoleAssignmentFilter.java b/authorization/resource-manager/v2018_09_01_preview/src/main/java/com/microsoft/azure/management/authorization/v2018_09_01_preview/RoleAssignmentFilter.java index 9c6dbc312348..11b40d7985f4 100644 --- a/authorization/resource-manager/v2018_09_01_preview/src/main/java/com/microsoft/azure/management/authorization/v2018_09_01_preview/RoleAssignmentFilter.java +++ b/authorization/resource-manager/v2018_09_01_preview/src/main/java/com/microsoft/azure/management/authorization/v2018_09_01_preview/RoleAssignmentFilter.java @@ -21,7 +21,7 @@ public class RoleAssignmentFilter { private String principalId; /** - * The Delegation flag for the roleassignment. + * The Delegation flag for the role assignment. */ @JsonProperty(value = "canDelegate") private Boolean canDelegate; @@ -47,7 +47,7 @@ public RoleAssignmentFilter withPrincipalId(String principalId) { } /** - * Get the Delegation flag for the roleassignment. + * Get the Delegation flag for the role assignment. * * @return the canDelegate value */ @@ -56,7 +56,7 @@ public Boolean canDelegate() { } /** - * Set the Delegation flag for the roleassignment. + * Set the Delegation flag for the role assignment. * * @param canDelegate the canDelegate value to set * @return the RoleAssignmentFilter object itself. diff --git a/authorization/resource-manager/v2018_09_01_preview/src/main/java/com/microsoft/azure/management/authorization/v2018_09_01_preview/implementation/RoleAssignmentImpl.java b/authorization/resource-manager/v2018_09_01_preview/src/main/java/com/microsoft/azure/management/authorization/v2018_09_01_preview/implementation/RoleAssignmentImpl.java index 5fd31a21099f..06c345eed40b 100644 --- a/authorization/resource-manager/v2018_09_01_preview/src/main/java/com/microsoft/azure/management/authorization/v2018_09_01_preview/implementation/RoleAssignmentImpl.java +++ b/authorization/resource-manager/v2018_09_01_preview/src/main/java/com/microsoft/azure/management/authorization/v2018_09_01_preview/implementation/RoleAssignmentImpl.java @@ -110,6 +110,11 @@ public String principalId() { return this.inner().principalId(); } + @Override + public PrincipalType principalType() { + return this.inner().principalType(); + } + @Override public String roleDefinitionId() { return this.inner().roleDefinitionId(); diff --git a/authorization/resource-manager/v2018_09_01_preview/src/main/java/com/microsoft/azure/management/authorization/v2018_09_01_preview/implementation/RoleAssignmentInner.java b/authorization/resource-manager/v2018_09_01_preview/src/main/java/com/microsoft/azure/management/authorization/v2018_09_01_preview/implementation/RoleAssignmentInner.java index cf55ba4fe6b3..e71726482500 100644 --- a/authorization/resource-manager/v2018_09_01_preview/src/main/java/com/microsoft/azure/management/authorization/v2018_09_01_preview/implementation/RoleAssignmentInner.java +++ b/authorization/resource-manager/v2018_09_01_preview/src/main/java/com/microsoft/azure/management/authorization/v2018_09_01_preview/implementation/RoleAssignmentInner.java @@ -8,6 +8,7 @@ package com.microsoft.azure.management.authorization.v2018_09_01_preview.implementation; +import com.microsoft.azure.management.authorization.v2018_09_01_preview.PrincipalType; import com.fasterxml.jackson.annotation.JsonProperty; import com.microsoft.rest.serializer.JsonFlatten; @@ -53,7 +54,16 @@ public class RoleAssignmentInner { private String principalId; /** - * The Delegation flag for the roleassignment. + * The principal type of the assigned principal ID. Possible values + * include: 'User', 'Group', 'ServicePrincipal', 'Unknown', + * 'DirectoryRoleTemplate', 'ForeignGroup', 'Application', 'MSI', + * 'DirectoryObjectOrGroup', 'Everyone'. + */ + @JsonProperty(value = "properties.principalType") + private PrincipalType principalType; + + /** + * The Delegation flag for the role assignment. */ @JsonProperty(value = "properties.canDelegate") private Boolean canDelegate; @@ -146,7 +156,27 @@ public RoleAssignmentInner withPrincipalId(String principalId) { } /** - * Get the Delegation flag for the roleassignment. + * Get the principal type of the assigned principal ID. Possible values include: 'User', 'Group', 'ServicePrincipal', 'Unknown', 'DirectoryRoleTemplate', 'ForeignGroup', 'Application', 'MSI', 'DirectoryObjectOrGroup', 'Everyone'. + * + * @return the principalType value + */ + public PrincipalType principalType() { + return this.principalType; + } + + /** + * Set the principal type of the assigned principal ID. Possible values include: 'User', 'Group', 'ServicePrincipal', 'Unknown', 'DirectoryRoleTemplate', 'ForeignGroup', 'Application', 'MSI', 'DirectoryObjectOrGroup', 'Everyone'. + * + * @param principalType the principalType value to set + * @return the RoleAssignmentInner object itself. + */ + public RoleAssignmentInner withPrincipalType(PrincipalType principalType) { + this.principalType = principalType; + return this; + } + + /** + * Get the Delegation flag for the role assignment. * * @return the canDelegate value */ @@ -155,7 +185,7 @@ public Boolean canDelegate() { } /** - * Set the Delegation flag for the roleassignment. + * Set the Delegation flag for the role assignment. * * @param canDelegate the canDelegate value to set * @return the RoleAssignmentInner object itself.