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 0000000000000..f2d4937870ffa --- /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 de1757b192e51..10a436afbaf2a 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 2f96613e2d2de..bbf5bdc24138e 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 0000000000000..d9e326a9bc91b --- /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); + } + +}