diff --git a/authorization/resource-manager/v2015_06_01/pom.xml b/authorization/resource-manager/v2015_06_01/pom.xml new file mode 100644 index 000000000000..be05e0552cfd --- /dev/null +++ b/authorization/resource-manager/v2015_06_01/pom.xml @@ -0,0 +1,133 @@ + + + 4.0.0 + com.microsoft.azure.authorization.v2015_06_01 + + com.microsoft.azure + azure-arm-parent + 0.0.3-beta + ../../../pom.xml + + azure-mgmt-authorization + 1.0.0-beta + jar + Microsoft Azure SDK for Authorization Management + This package contains Microsoft Authorization 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 + + + + + + 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/authorization/resource-manager/v2015_06_01/src/main/java/com/microsoft/azure/management/authorization/v2015_06_01/ClassicAdministrator.java b/authorization/resource-manager/v2015_06_01/src/main/java/com/microsoft/azure/management/authorization/v2015_06_01/ClassicAdministrator.java new file mode 100644 index 000000000000..c8448eb8ee82 --- /dev/null +++ b/authorization/resource-manager/v2015_06_01/src/main/java/com/microsoft/azure/management/authorization/v2015_06_01/ClassicAdministrator.java @@ -0,0 +1,45 @@ +/** + * 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_06_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.authorization.v2015_06_01.implementation.ClassicAdministratorInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.authorization.v2015_06_01.implementation.AuthorizationManager; + +/** + * Type representing ClassicAdministrator. + */ +public interface ClassicAdministrator extends HasInner, HasManager { + /** + * @return the emailAddress value. + */ + String emailAddress(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the role value. + */ + String role(); + + /** + * @return the type value. + */ + String type(); + +} diff --git a/authorization/resource-manager/v2015_06_01/src/main/java/com/microsoft/azure/management/authorization/v2015_06_01/ClassicAdministrators.java b/authorization/resource-manager/v2015_06_01/src/main/java/com/microsoft/azure/management/authorization/v2015_06_01/ClassicAdministrators.java new file mode 100644 index 000000000000..2d465d0699be --- /dev/null +++ b/authorization/resource-manager/v2015_06_01/src/main/java/com/microsoft/azure/management/authorization/v2015_06_01/ClassicAdministrators.java @@ -0,0 +1,19 @@ +/** + * 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_06_01; + +import com.microsoft.azure.arm.collection.SupportsListing; +import com.microsoft.azure.management.authorization.v2015_06_01.implementation.ClassicAdministratorsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing ClassicAdministrators. + */ +public interface ClassicAdministrators extends SupportsListing, HasInner { +} diff --git a/authorization/resource-manager/v2015_06_01/src/main/java/com/microsoft/azure/management/authorization/v2015_06_01/implementation/AuthorizationManagementClientImpl.java b/authorization/resource-manager/v2015_06_01/src/main/java/com/microsoft/azure/management/authorization/v2015_06_01/implementation/AuthorizationManagementClientImpl.java new file mode 100644 index 000000000000..693faccb0cfb --- /dev/null +++ b/authorization/resource-manager/v2015_06_01/src/main/java/com/microsoft/azure/management/authorization/v2015_06_01/implementation/AuthorizationManagementClientImpl.java @@ -0,0 +1,196 @@ +/** + * 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_06_01.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 AuthorizationManagementClientImpl class. + */ +public class AuthorizationManagementClientImpl 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 target subscription. */ + private String subscriptionId; + + /** + * Gets The ID of the target subscription. + * + * @return the subscriptionId value. + */ + public String subscriptionId() { + return this.subscriptionId; + } + + /** + * Sets The ID of the target subscription. + * + * @param subscriptionId the subscriptionId value. + * @return the service client itself + */ + public AuthorizationManagementClientImpl withSubscriptionId(String subscriptionId) { + this.subscriptionId = subscriptionId; + return this; + } + + /** The API version to use for this operation. */ + private String apiVersion; + + /** + * Gets The API version to use for this operation. + * + * @return the apiVersion value. + */ + public String apiVersion() { + return this.apiVersion; + } + + /** The 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 AuthorizationManagementClientImpl 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 AuthorizationManagementClientImpl 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 AuthorizationManagementClientImpl withGenerateClientRequestId(boolean generateClientRequestId) { + this.generateClientRequestId = generateClientRequestId; + return this; + } + + /** + * The ClassicAdministratorsInner object to access its operations. + */ + private ClassicAdministratorsInner classicAdministrators; + + /** + * Gets the ClassicAdministratorsInner object to access its operations. + * @return the ClassicAdministratorsInner object. + */ + public ClassicAdministratorsInner classicAdministrators() { + return this.classicAdministrators; + } + + /** + * Initializes an instance of AuthorizationManagementClient client. + * + * @param credentials the management credentials for Azure + */ + public AuthorizationManagementClientImpl(ServiceClientCredentials credentials) { + this("https://management.azure.com", credentials); + } + + /** + * Initializes an instance of AuthorizationManagementClient client. + * + * @param baseUrl the base URL of the host + * @param credentials the management credentials for Azure + */ + public AuthorizationManagementClientImpl(String baseUrl, ServiceClientCredentials credentials) { + super(baseUrl, credentials); + initialize(); + } + + /** + * Initializes an instance of AuthorizationManagementClient client. + * + * @param restClient the REST client to connect to Azure. + */ + public AuthorizationManagementClientImpl(RestClient restClient) { + super(restClient); + initialize(); + } + + protected void initialize() { + this.apiVersion = "2015-06-01"; + this.acceptLanguage = "en-US"; + this.longRunningOperationRetryTimeout = 30; + this.generateClientRequestId = true; + this.classicAdministrators = new ClassicAdministratorsInner(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(), "AuthorizationManagementClient", "2015-06-01"); + } +} diff --git a/authorization/resource-manager/v2015_06_01/src/main/java/com/microsoft/azure/management/authorization/v2015_06_01/implementation/AuthorizationManager.java b/authorization/resource-manager/v2015_06_01/src/main/java/com/microsoft/azure/management/authorization/v2015_06_01/implementation/AuthorizationManager.java new file mode 100644 index 000000000000..4a854413172b --- /dev/null +++ b/authorization/resource-manager/v2015_06_01/src/main/java/com/microsoft/azure/management/authorization/v2015_06_01/implementation/AuthorizationManager.java @@ -0,0 +1,99 @@ +/** + * 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_06_01.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.authorization.v2015_06_01.ClassicAdministrators; +import com.microsoft.azure.arm.resources.implementation.AzureConfigurableCoreImpl; +import com.microsoft.azure.arm.resources.implementation.ManagerCore; + +/** + * Entry point to Azure Authorization resource management. + */ +public final class AuthorizationManager extends ManagerCore { + private ClassicAdministrators classicAdministrators; + /** + * Get a Configurable instance that can be used to create AuthorizationManager with optional configuration. + * + * @return the instance allowing configurations + */ + public static Configurable configure() { + return new AuthorizationManager.ConfigurableImpl(); + } + /** + * Creates an instance of AuthorizationManager that exposes Authorization resource management API entry points. + * + * @param credentials the credentials to use + * @param subscriptionId the subscription UUID + * @return the AuthorizationManager + */ + public static AuthorizationManager authenticate(AzureTokenCredentials credentials, String subscriptionId) { + return new AuthorizationManager(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 AuthorizationManager that exposes Authorization resource management API entry points. + * + * @param restClient the RestClient to be used for API calls. + * @param subscriptionId the subscription UUID + * @return the AuthorizationManager + */ + public static AuthorizationManager authenticate(RestClient restClient, String subscriptionId) { + return new AuthorizationManager(restClient, subscriptionId); + } + /** + * The interface allowing configurations to be set. + */ + public interface Configurable extends AzureConfigurable { + /** + * Creates an instance of AuthorizationManager that exposes Authorization management API entry points. + * + * @param credentials the credentials to use + * @param subscriptionId the subscription UUID + * @return the interface exposing Authorization management API entry points that work across subscriptions + */ + AuthorizationManager authenticate(AzureTokenCredentials credentials, String subscriptionId); + } + + /** + * @return Entry point to manage ClassicAdministrators. + */ + public ClassicAdministrators classicAdministrators() { + if (this.classicAdministrators == null) { + this.classicAdministrators = new ClassicAdministratorsImpl(this); + } + return this.classicAdministrators; + } + + /** + * The implementation for Configurable interface. + */ + private static final class ConfigurableImpl extends AzureConfigurableCoreImpl implements Configurable { + public AuthorizationManager authenticate(AzureTokenCredentials credentials, String subscriptionId) { + return AuthorizationManager.authenticate(buildRestClient(credentials), subscriptionId); + } + } + private AuthorizationManager(RestClient restClient, String subscriptionId) { + super( + restClient, + subscriptionId, + new AuthorizationManagementClientImpl(restClient).withSubscriptionId(subscriptionId)); + } +} diff --git a/authorization/resource-manager/v2015_06_01/src/main/java/com/microsoft/azure/management/authorization/v2015_06_01/implementation/ClassicAdministratorImpl.java b/authorization/resource-manager/v2015_06_01/src/main/java/com/microsoft/azure/management/authorization/v2015_06_01/implementation/ClassicAdministratorImpl.java new file mode 100644 index 000000000000..806f0000000e --- /dev/null +++ b/authorization/resource-manager/v2015_06_01/src/main/java/com/microsoft/azure/management/authorization/v2015_06_01/implementation/ClassicAdministratorImpl.java @@ -0,0 +1,56 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * + */ + +package com.microsoft.azure.management.authorization.v2015_06_01.implementation; + +import com.microsoft.azure.management.authorization.v2015_06_01.ClassicAdministrator; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import rx.Observable; + +class ClassicAdministratorImpl extends WrapperImpl implements ClassicAdministrator { + private final AuthorizationManager manager; + + ClassicAdministratorImpl(ClassicAdministratorInner inner, AuthorizationManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public AuthorizationManager manager() { + return this.manager; + } + + + + @Override + public String emailAddress() { + return this.inner().emailAddress(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public String role() { + return this.inner().role(); + } + + @Override + public String type() { + return this.inner().type(); + } + +} diff --git a/authorization/resource-manager/v2015_06_01/src/main/java/com/microsoft/azure/management/authorization/v2015_06_01/implementation/ClassicAdministratorInner.java b/authorization/resource-manager/v2015_06_01/src/main/java/com/microsoft/azure/management/authorization/v2015_06_01/implementation/ClassicAdministratorInner.java new file mode 100644 index 000000000000..a167874e7f4c --- /dev/null +++ b/authorization/resource-manager/v2015_06_01/src/main/java/com/microsoft/azure/management/authorization/v2015_06_01/implementation/ClassicAdministratorInner.java @@ -0,0 +1,149 @@ +/** + * 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_06_01.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; + +/** + * Classic Administrators. + */ +@JsonFlatten +public class ClassicAdministratorInner { + /** + * The ID of the administrator. + */ + @JsonProperty(value = "id") + private String id; + + /** + * The name of the administrator. + */ + @JsonProperty(value = "name") + private String name; + + /** + * The type of the administrator. + */ + @JsonProperty(value = "type") + private String type; + + /** + * The email address of the administrator. + */ + @JsonProperty(value = "properties.emailAddress") + private String emailAddress; + + /** + * The role of the administrator. + */ + @JsonProperty(value = "properties.role") + private String role; + + /** + * Get the ID of the administrator. + * + * @return the id value + */ + public String id() { + return this.id; + } + + /** + * Set the ID of the administrator. + * + * @param id the id value to set + * @return the ClassicAdministratorInner object itself. + */ + public ClassicAdministratorInner withId(String id) { + this.id = id; + return this; + } + + /** + * Get the name of the administrator. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set the name of the administrator. + * + * @param name the name value to set + * @return the ClassicAdministratorInner object itself. + */ + public ClassicAdministratorInner withName(String name) { + this.name = name; + return this; + } + + /** + * Get the type of the administrator. + * + * @return the type value + */ + public String type() { + return this.type; + } + + /** + * Set the type of the administrator. + * + * @param type the type value to set + * @return the ClassicAdministratorInner object itself. + */ + public ClassicAdministratorInner withType(String type) { + this.type = type; + return this; + } + + /** + * Get the email address of the administrator. + * + * @return the emailAddress value + */ + public String emailAddress() { + return this.emailAddress; + } + + /** + * Set the email address of the administrator. + * + * @param emailAddress the emailAddress value to set + * @return the ClassicAdministratorInner object itself. + */ + public ClassicAdministratorInner withEmailAddress(String emailAddress) { + this.emailAddress = emailAddress; + return this; + } + + /** + * Get the role of the administrator. + * + * @return the role value + */ + public String role() { + return this.role; + } + + /** + * Set the role of the administrator. + * + * @param role the role value to set + * @return the ClassicAdministratorInner object itself. + */ + public ClassicAdministratorInner withRole(String role) { + this.role = role; + return this; + } + +} diff --git a/authorization/resource-manager/v2015_06_01/src/main/java/com/microsoft/azure/management/authorization/v2015_06_01/implementation/ClassicAdministratorsImpl.java b/authorization/resource-manager/v2015_06_01/src/main/java/com/microsoft/azure/management/authorization/v2015_06_01/implementation/ClassicAdministratorsImpl.java new file mode 100644 index 000000000000..c3c07a0dd73b --- /dev/null +++ b/authorization/resource-manager/v2015_06_01/src/main/java/com/microsoft/azure/management/authorization/v2015_06_01/implementation/ClassicAdministratorsImpl.java @@ -0,0 +1,68 @@ +/** + * 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. + * jkl + */ + +package com.microsoft.azure.management.authorization.v2015_06_01.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.authorization.v2015_06_01.ClassicAdministrators; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.PagedList; +import com.microsoft.azure.Page; +import com.microsoft.azure.arm.utils.PagedListConverter; +import com.microsoft.azure.management.authorization.v2015_06_01.ClassicAdministrator; + +class ClassicAdministratorsImpl extends WrapperImpl implements ClassicAdministrators { + private PagedListConverter converter; + private final AuthorizationManager manager; + + ClassicAdministratorsImpl(AuthorizationManager manager) { + super(manager.inner().classicAdministrators()); + this.manager = manager; + this.converter = new PagedListConverter() { + @Override + public Observable typeConvertAsync(ClassicAdministratorInner inner) { + return Observable.just((ClassicAdministrator) wrapModel(inner)); + } + }; + } + + public AuthorizationManager manager() { + return this.manager; + } + + private ClassicAdministratorImpl wrapModel(ClassicAdministratorInner inner) { + return new ClassicAdministratorImpl(inner, manager()); + } + + @Override + public PagedList list() { + ClassicAdministratorsInner client = this.inner(); + return converter.convert(client.list()); + } + + @Override + public Observable listAsync() { + ClassicAdministratorsInner client = this.inner(); + return client.listAsync() + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public ClassicAdministrator call(ClassicAdministratorInner inner) { + return wrapModel(inner); + } + }); + } + +} diff --git a/authorization/resource-manager/v2015_06_01/src/main/java/com/microsoft/azure/management/authorization/v2015_06_01/implementation/ClassicAdministratorsInner.java b/authorization/resource-manager/v2015_06_01/src/main/java/com/microsoft/azure/management/authorization/v2015_06_01/implementation/ClassicAdministratorsInner.java new file mode 100644 index 000000000000..4835faab9ca5 --- /dev/null +++ b/authorization/resource-manager/v2015_06_01/src/main/java/com/microsoft/azure/management/authorization/v2015_06_01/implementation/ClassicAdministratorsInner.java @@ -0,0 +1,287 @@ +/** + * 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_06_01.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.Path; +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 ClassicAdministrators. + */ +public class ClassicAdministratorsInner { + /** The Retrofit service to perform REST calls. */ + private ClassicAdministratorsService service; + /** The service client containing this operation class. */ + private AuthorizationManagementClientImpl client; + + /** + * Initializes an instance of ClassicAdministratorsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public ClassicAdministratorsInner(Retrofit retrofit, AuthorizationManagementClientImpl client) { + this.service = retrofit.create(ClassicAdministratorsService.class); + this.client = client; + } + + /** + * The interface defining all the services for ClassicAdministrators to be + * used by Retrofit to perform actually REST calls. + */ + interface ClassicAdministratorsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.authorization.v2015_06_01.ClassicAdministrators list" }) + @GET("subscriptions/{subscriptionId}/providers/Microsoft.Authorization/classicAdministrators") + 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.authorization.v2015_06_01.ClassicAdministrators listNext" }) + @GET + Observable> listNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Gets service administrator, account administrator, and co-administrators for the 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<ClassicAdministratorInner> 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(); + } + }; + } + + /** + * Gets service administrator, account administrator, and co-administrators for the 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); + } + + /** + * Gets service administrator, account administrator, and co-administrators for the subscription. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ClassicAdministratorInner> object + */ + public Observable> listAsync() { + return listWithServiceResponseAsync() + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets service administrator, account administrator, and co-administrators for the subscription. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ClassicAdministratorInner> 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)); + } + }); + } + + /** + * Gets service administrator, account administrator, and co-administrators for the subscription. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ClassicAdministratorInner> 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); + } + + /** + * Gets service administrator, account administrator, and co-administrators for the 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<ClassicAdministratorInner> 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(); + } + }; + } + + /** + * Gets service administrator, account administrator, and co-administrators for the 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); + } + + /** + * Gets service administrator, account administrator, and co-administrators for the 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<ClassicAdministratorInner> object + */ + public Observable> listNextAsync(final String nextPageLink) { + return listNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets service administrator, account administrator, and co-administrators for the 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<ClassicAdministratorInner> 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)); + } + }); + } + + /** + * Gets service administrator, account administrator, and co-administrators for the 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<ClassicAdministratorInner> 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/authorization/resource-manager/v2015_06_01/src/main/java/com/microsoft/azure/management/authorization/v2015_06_01/implementation/IdParsingUtils.java b/authorization/resource-manager/v2015_06_01/src/main/java/com/microsoft/azure/management/authorization/v2015_06_01/implementation/IdParsingUtils.java new file mode 100644 index 000000000000..0fa4a9f2c8b3 --- /dev/null +++ b/authorization/resource-manager/v2015_06_01/src/main/java/com/microsoft/azure/management/authorization/v2015_06_01/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.authorization.v2015_06_01.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/authorization/resource-manager/v2015_06_01/src/main/java/com/microsoft/azure/management/authorization/v2015_06_01/implementation/PageImpl.java b/authorization/resource-manager/v2015_06_01/src/main/java/com/microsoft/azure/management/authorization/v2015_06_01/implementation/PageImpl.java new file mode 100644 index 000000000000..bb1dee787b40 --- /dev/null +++ b/authorization/resource-manager/v2015_06_01/src/main/java/com/microsoft/azure/management/authorization/v2015_06_01/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.authorization.v2015_06_01.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/authorization/resource-manager/v2015_06_01/src/main/java/com/microsoft/azure/management/authorization/v2015_06_01/implementation/package-info.java b/authorization/resource-manager/v2015_06_01/src/main/java/com/microsoft/azure/management/authorization/v2015_06_01/implementation/package-info.java new file mode 100644 index 000000000000..de24c00afe46 --- /dev/null +++ b/authorization/resource-manager/v2015_06_01/src/main/java/com/microsoft/azure/management/authorization/v2015_06_01/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 AuthorizationManagementClient. + * Role based access control provides you a way to apply granular level policy administration down to individual resources or resource groups. These operations enable you to manage role definitions and role assignments. A role definition describes the set of actions that can be performed on resources. A role assignment grants access to Azure Active Directory users. + */ +package com.microsoft.azure.management.authorization.v2015_06_01.implementation; diff --git a/authorization/resource-manager/v2015_06_01/src/main/java/com/microsoft/azure/management/authorization/v2015_06_01/package-info.java b/authorization/resource-manager/v2015_06_01/src/main/java/com/microsoft/azure/management/authorization/v2015_06_01/package-info.java new file mode 100644 index 000000000000..b1d72479e309 --- /dev/null +++ b/authorization/resource-manager/v2015_06_01/src/main/java/com/microsoft/azure/management/authorization/v2015_06_01/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 AuthorizationManagementClient. + * Role based access control provides you a way to apply granular level policy administration down to individual resources or resource groups. These operations enable you to manage role definitions and role assignments. A role definition describes the set of actions that can be performed on resources. A role assignment grants access to Azure Active Directory users. + */ +package com.microsoft.azure.management.authorization.v2015_06_01; diff --git a/authorization/resource-manager/v2015_07_01/pom.xml b/authorization/resource-manager/v2015_07_01/pom.xml index 58d699824738..70c4a4774505 100644 --- a/authorization/resource-manager/v2015_07_01/pom.xml +++ b/authorization/resource-manager/v2015_07_01/pom.xml @@ -11,7 +11,7 @@ com.microsoft.azure azure-arm-parent - 1.0.0 + 0.0.3-beta ../../../pom.xml azure-mgmt-authorization diff --git a/authorization/resource-manager/v2015_07_01/src/main/java/com/microsoft/azure/management/authorization/v2015_07_01/ClassicAdministrator.java b/authorization/resource-manager/v2015_07_01/src/main/java/com/microsoft/azure/management/authorization/v2015_07_01/ClassicAdministrator.java index 14bd689c278f..303f36a3aa52 100644 --- a/authorization/resource-manager/v2015_07_01/src/main/java/com/microsoft/azure/management/authorization/v2015_07_01/ClassicAdministrator.java +++ b/authorization/resource-manager/v2015_07_01/src/main/java/com/microsoft/azure/management/authorization/v2015_07_01/ClassicAdministrator.java @@ -9,14 +9,19 @@ package com.microsoft.azure.management.authorization.v2015_07_01; import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.authorization.v2015_07_01.implementation.ClassicAdministratorInner; import com.microsoft.azure.arm.resources.models.HasManager; import com.microsoft.azure.management.authorization.v2015_07_01.implementation.AuthorizationManager; -import com.microsoft.azure.management.authorization.v2015_07_01.implementation.ClassicAdministratorInner; /** * Type representing ClassicAdministrator. */ public interface ClassicAdministrator extends HasInner, HasManager { + /** + * @return the emailAddress value. + */ + String emailAddress(); + /** * @return the id value. */ @@ -28,9 +33,9 @@ public interface ClassicAdministrator extends HasInner { - /** - * Gets service administrator, account administrator, and co-administrators for the subscription. - * - * @param apiVersion The API version to use for this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable for the request - */ - Observable listAsync(final String apiVersion); - +public interface ClassicAdministrators extends SupportsListing, HasInner { } 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/GlobalAdministrators.java b/authorization/resource-manager/v2015_07_01/src/main/java/com/microsoft/azure/management/authorization/v2015_07_01/GlobalAdministrators.java new file mode 100644 index 000000000000..a2353931649f --- /dev/null +++ b/authorization/resource-manager/v2015_07_01/src/main/java/com/microsoft/azure/management/authorization/v2015_07_01/GlobalAdministrators.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.GlobalAdministratorsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing GlobalAdministrators. + */ +public interface GlobalAdministrators extends HasInner { + /** + * Elevates access for a Global Administrator. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable elevateAccessAsync(); + +} diff --git a/authorization/resource-manager/v2015_07_01/src/main/java/com/microsoft/azure/management/authorization/v2015_07_01/RoleDefinition.java b/authorization/resource-manager/v2015_07_01/src/main/java/com/microsoft/azure/management/authorization/v2015_07_01/RoleDefinition.java index 05c3456f5f3d..7f70ba88a8bb 100644 --- a/authorization/resource-manager/v2015_07_01/src/main/java/com/microsoft/azure/management/authorization/v2015_07_01/RoleDefinition.java +++ b/authorization/resource-manager/v2015_07_01/src/main/java/com/microsoft/azure/management/authorization/v2015_07_01/RoleDefinition.java @@ -24,6 +24,16 @@ * Type representing RoleDefinition. */ public interface RoleDefinition extends HasInner, Indexable, Updatable, Refreshable, HasManager { + /** + * @return the assignableScopes value. + */ + List assignableScopes(); + + /** + * @return the description value. + */ + String description(); + /** * @return the id value. */ @@ -35,9 +45,19 @@ public interface RoleDefinition extends HasInner, Indexable String name(); /** - * @return the properties value. + * @return the permissions value. + */ + List permissions(); + + /** + * @return the roleName value. */ - RoleDefinitionProperties properties(); + String roleName(); + + /** + * @return the roleType value. + */ + String roleType(); /** * @return the type value. @@ -47,7 +67,7 @@ public interface RoleDefinition extends HasInner, Indexable /** * The entirety of the RoleDefinition definition. */ - interface Definition extends DefinitionStages.Blank, DefinitionStages.WithScope, DefinitionStages.WithProperties, DefinitionStages.WithCreate { + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithScope, DefinitionStages.WithCreate { } /** @@ -69,19 +89,67 @@ interface WithScope { * @param scope The scope of the role definition * @return the next definition stage */ - WithProperties withScope(String scope); + WithCreate withScope(String scope); } /** - * The stage of the roledefinition definition allowing to specify Properties. + * The stage of the roledefinition definition allowing to specify AssignableScopes. */ - interface WithProperties { - /** - * Specifies properties. - * @param properties Role definition properties - * @return the next definition stage - */ - WithCreate withProperties(RoleDefinitionProperties properties); + interface WithAssignableScopes { + /** + * Specifies assignableScopes. + * @param assignableScopes Role definition assignable scopes + * @return the next definition stage + */ + WithCreate withAssignableScopes(List assignableScopes); + } + + /** + * The stage of the roledefinition definition allowing to specify Description. + */ + interface WithDescription { + /** + * Specifies description. + * @param description The role definition description + * @return the next definition stage + */ + WithCreate withDescription(String description); + } + + /** + * The stage of the roledefinition definition allowing to specify Permissions. + */ + interface WithPermissions { + /** + * Specifies permissions. + * @param permissions Role definition permissions + * @return the next definition stage + */ + WithCreate withPermissions(List permissions); + } + + /** + * The stage of the roledefinition definition allowing to specify RoleName. + */ + interface WithRoleName { + /** + * Specifies roleName. + * @param roleName The role name + * @return the next definition stage + */ + WithCreate withRoleName(String roleName); + } + + /** + * The stage of the roledefinition definition allowing to specify RoleType. + */ + interface WithRoleType { + /** + * Specifies roleType. + * @param roleType The role type + * @return the next definition stage + */ + WithCreate withRoleType(String roleType); } /** @@ -89,13 +157,13 @@ interface WithProperties { * the resource to be created (via {@link WithCreate#create()}), but also allows * for any other optional settings to be specified. */ - interface WithCreate extends Creatable { + interface WithCreate extends Creatable, DefinitionStages.WithAssignableScopes, DefinitionStages.WithDescription, DefinitionStages.WithPermissions, DefinitionStages.WithRoleName, DefinitionStages.WithRoleType { } } /** * The template for a RoleDefinition update operation, containing all the settings that can be modified. */ - interface Update extends Appliable, UpdateStages.WithProperties { + interface Update extends Appliable, UpdateStages.WithAssignableScopes, UpdateStages.WithDescription, UpdateStages.WithPermissions, UpdateStages.WithRoleName, UpdateStages.WithRoleType { } /** @@ -103,15 +171,63 @@ interface Update extends Appliable, UpdateStages.WithProperties */ interface UpdateStages { /** - * The stage of the roledefinition update allowing to specify Properties. + * The stage of the roledefinition update allowing to specify AssignableScopes. + */ + interface WithAssignableScopes { + /** + * Specifies assignableScopes. + * @param assignableScopes Role definition assignable scopes + * @return the next update stage + */ + Update withAssignableScopes(List assignableScopes); + } + + /** + * The stage of the roledefinition update allowing to specify Description. + */ + interface WithDescription { + /** + * Specifies description. + * @param description The role definition description + * @return the next update stage + */ + Update withDescription(String description); + } + + /** + * The stage of the roledefinition update allowing to specify Permissions. + */ + interface WithPermissions { + /** + * Specifies permissions. + * @param permissions Role definition permissions + * @return the next update stage + */ + Update withPermissions(List permissions); + } + + /** + * The stage of the roledefinition update allowing to specify RoleName. + */ + interface WithRoleName { + /** + * Specifies roleName. + * @param roleName The role name + * @return the next update stage + */ + Update withRoleName(String roleName); + } + + /** + * The stage of the roledefinition update allowing to specify RoleType. */ - interface WithProperties { + interface WithRoleType { /** - * Specifies properties. - * @param properties Role definition properties + * Specifies roleType. + * @param roleType The role type * @return the next update stage */ - Update withProperties(RoleDefinitionProperties properties); + Update withRoleType(String roleType); } } 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..3ae5b96363d1 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 @@ -145,6 +145,19 @@ public PermissionsInner permissions() { return this.permissions; } + /** + * The RoleDefinitionsInner object to access its operations. + */ + private RoleDefinitionsInner roleDefinitions; + + /** + * Gets the RoleDefinitionsInner object to access its operations. + * @return the RoleDefinitionsInner object. + */ + public RoleDefinitionsInner roleDefinitions() { + return this.roleDefinitions; + } + /** * The ProviderOperationsMetadatasInner object to access its operations. */ @@ -159,29 +172,29 @@ public ProviderOperationsMetadatasInner providerOperationsMetadatas() { } /** - * The RoleAssignmentsInner object to access its operations. + * The GlobalAdministratorsInner object to access its operations. */ - private RoleAssignmentsInner roleAssignments; + private GlobalAdministratorsInner globalAdministrators; /** - * Gets the RoleAssignmentsInner object to access its operations. - * @return the RoleAssignmentsInner object. + * Gets the GlobalAdministratorsInner object to access its operations. + * @return the GlobalAdministratorsInner object. */ - public RoleAssignmentsInner roleAssignments() { - return this.roleAssignments; + public GlobalAdministratorsInner globalAdministrators() { + return this.globalAdministrators; } /** - * The RoleDefinitionsInner object to access its operations. + * The RoleAssignmentsInner object to access its operations. */ - private RoleDefinitionsInner roleDefinitions; + private RoleAssignmentsInner roleAssignments; /** - * Gets the RoleDefinitionsInner object to access its operations. - * @return the RoleDefinitionsInner object. + * Gets the RoleAssignmentsInner object to access its operations. + * @return the RoleAssignmentsInner object. */ - public RoleDefinitionsInner roleDefinitions() { - return this.roleDefinitions; + public RoleAssignmentsInner roleAssignments() { + return this.roleAssignments; } /** @@ -233,9 +246,10 @@ protected void initialize() { this.longRunningOperationRetryTimeout = 30; this.generateClientRequestId = true; this.permissions = new PermissionsInner(restClient().retrofit(), this); + this.roleDefinitions = new RoleDefinitionsInner(restClient().retrofit(), this); this.providerOperationsMetadatas = new ProviderOperationsMetadatasInner(restClient().retrofit(), this); + this.globalAdministrators = new GlobalAdministratorsInner(restClient().retrofit(), this); this.roleAssignments = new RoleAssignmentsInner(restClient().retrofit(), this); - this.roleDefinitions = new RoleDefinitionsInner(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..080ac2a0538a 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 @@ -17,9 +17,10 @@ import com.microsoft.azure.serializer.AzureJacksonAdapter; import com.microsoft.rest.RestClient; import com.microsoft.azure.management.authorization.v2015_07_01.Permissions; +import com.microsoft.azure.management.authorization.v2015_07_01.RoleDefinitions; import com.microsoft.azure.management.authorization.v2015_07_01.ProviderOperationsMetadatas; +import com.microsoft.azure.management.authorization.v2015_07_01.GlobalAdministrators; 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.ClassicAdministrators; import com.microsoft.azure.arm.resources.implementation.AzureConfigurableCoreImpl; import com.microsoft.azure.arm.resources.implementation.ManagerCore; @@ -29,9 +30,10 @@ */ public final class AuthorizationManager extends ManagerCore { private Permissions permissions; + private RoleDefinitions roleDefinitions; private ProviderOperationsMetadatas providerOperationsMetadatas; + private GlobalAdministrators globalAdministrators; private RoleAssignments roleAssignments; - private RoleDefinitions roleDefinitions; private ClassicAdministrators classicAdministrators; /** * Get a Configurable instance that can be used to create AuthorizationManager with optional configuration. @@ -90,6 +92,16 @@ public Permissions permissions() { return this.permissions; } + /** + * @return Entry point to manage RoleDefinitions. + */ + public RoleDefinitions roleDefinitions() { + if (this.roleDefinitions == null) { + this.roleDefinitions = new RoleDefinitionsImpl(this); + } + return this.roleDefinitions; + } + /** * @return Entry point to manage ProviderOperationsMetadatas. */ @@ -101,23 +113,23 @@ public ProviderOperationsMetadatas providerOperationsMetadatas() { } /** - * @return Entry point to manage RoleAssignments. + * @return Entry point to manage GlobalAdministrators. */ - public RoleAssignments roleAssignments() { - if (this.roleAssignments == null) { - this.roleAssignments = new RoleAssignmentsImpl(this); + public GlobalAdministrators globalAdministrators() { + if (this.globalAdministrators == null) { + this.globalAdministrators = new GlobalAdministratorsImpl(this); } - return this.roleAssignments; + return this.globalAdministrators; } /** - * @return Entry point to manage RoleDefinitions. + * @return Entry point to manage RoleAssignments. */ - public RoleDefinitions roleDefinitions() { - if (this.roleDefinitions == null) { - this.roleDefinitions = new RoleDefinitionsImpl(this); + public RoleAssignments roleAssignments() { + if (this.roleAssignments == null) { + this.roleAssignments = new RoleAssignmentsImpl(this); } - return this.roleDefinitions; + return this.roleAssignments; } /** diff --git a/authorization/resource-manager/v2015_07_01/src/main/java/com/microsoft/azure/management/authorization/v2015_07_01/implementation/ClassicAdministratorImpl.java b/authorization/resource-manager/v2015_07_01/src/main/java/com/microsoft/azure/management/authorization/v2015_07_01/implementation/ClassicAdministratorImpl.java index 9f0d32a96736..0ba8b31c4153 100644 --- a/authorization/resource-manager/v2015_07_01/src/main/java/com/microsoft/azure/management/authorization/v2015_07_01/implementation/ClassicAdministratorImpl.java +++ b/authorization/resource-manager/v2015_07_01/src/main/java/com/microsoft/azure/management/authorization/v2015_07_01/implementation/ClassicAdministratorImpl.java @@ -4,17 +4,19 @@ * license information. * * Code generated by Microsoft (R) AutoRest Code Generator. + * */ package com.microsoft.azure.management.authorization.v2015_07_01.implementation; import com.microsoft.azure.management.authorization.v2015_07_01.ClassicAdministrator; import com.microsoft.azure.arm.model.implementation.WrapperImpl; -import com.microsoft.azure.management.authorization.v2015_07_01.ClassicAdministratorProperties; +import rx.Observable; class ClassicAdministratorImpl extends WrapperImpl implements ClassicAdministrator { private final AuthorizationManager manager; - ClassicAdministratorImpl(ClassicAdministratorInner inner, AuthorizationManager manager) { + + ClassicAdministratorImpl(ClassicAdministratorInner inner, AuthorizationManager manager) { super(inner); this.manager = manager; } @@ -24,6 +26,13 @@ public AuthorizationManager manager() { return this.manager; } + + + @Override + public String emailAddress() { + return this.inner().emailAddress(); + } + @Override public String id() { return this.inner().id(); @@ -35,8 +44,8 @@ public String name() { } @Override - public ClassicAdministratorProperties properties() { - return this.inner().properties(); + public String role() { + return this.inner().role(); } @Override diff --git a/authorization/resource-manager/v2015_07_01/src/main/java/com/microsoft/azure/management/authorization/v2015_07_01/implementation/ClassicAdministratorInner.java b/authorization/resource-manager/v2015_07_01/src/main/java/com/microsoft/azure/management/authorization/v2015_07_01/implementation/ClassicAdministratorInner.java index 7f18e6610235..c8260ea29b19 100644 --- a/authorization/resource-manager/v2015_07_01/src/main/java/com/microsoft/azure/management/authorization/v2015_07_01/implementation/ClassicAdministratorInner.java +++ b/authorization/resource-manager/v2015_07_01/src/main/java/com/microsoft/azure/management/authorization/v2015_07_01/implementation/ClassicAdministratorInner.java @@ -8,12 +8,13 @@ package com.microsoft.azure.management.authorization.v2015_07_01.implementation; -import com.microsoft.azure.management.authorization.v2015_07_01.ClassicAdministratorProperties; import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; /** * Classic Administrators. */ +@JsonFlatten public class ClassicAdministratorInner { /** * The ID of the administrator. @@ -34,10 +35,16 @@ public class ClassicAdministratorInner { private String type; /** - * Properties for the classic administrator. + * The email address of the administrator. */ - @JsonProperty(value = "properties") - private ClassicAdministratorProperties properties; + @JsonProperty(value = "properties.emailAddress") + private String emailAddress; + + /** + * The role of the administrator. + */ + @JsonProperty(value = "properties.role") + private String role; /** * Get the ID of the administrator. @@ -100,22 +107,42 @@ public ClassicAdministratorInner withType(String type) { } /** - * Get properties for the classic administrator. + * Get the email address of the administrator. + * + * @return the emailAddress value + */ + public String emailAddress() { + return this.emailAddress; + } + + /** + * Set the email address of the administrator. + * + * @param emailAddress the emailAddress value to set + * @return the ClassicAdministratorInner object itself. + */ + public ClassicAdministratorInner withEmailAddress(String emailAddress) { + this.emailAddress = emailAddress; + return this; + } + + /** + * Get the role of the administrator. * - * @return the properties value + * @return the role value */ - public ClassicAdministratorProperties properties() { - return this.properties; + public String role() { + return this.role; } /** - * Set properties for the classic administrator. + * Set the role of the administrator. * - * @param properties the properties value to set + * @param role the role value to set * @return the ClassicAdministratorInner object itself. */ - public ClassicAdministratorInner withProperties(ClassicAdministratorProperties properties) { - this.properties = properties; + public ClassicAdministratorInner withRole(String role) { + this.role = role; return this; } diff --git a/authorization/resource-manager/v2015_07_01/src/main/java/com/microsoft/azure/management/authorization/v2015_07_01/implementation/ClassicAdministratorsImpl.java b/authorization/resource-manager/v2015_07_01/src/main/java/com/microsoft/azure/management/authorization/v2015_07_01/implementation/ClassicAdministratorsImpl.java index 1875e44be030..e5c05e251263 100644 --- a/authorization/resource-manager/v2015_07_01/src/main/java/com/microsoft/azure/management/authorization/v2015_07_01/implementation/ClassicAdministratorsImpl.java +++ b/authorization/resource-manager/v2015_07_01/src/main/java/com/microsoft/azure/management/authorization/v2015_07_01/implementation/ClassicAdministratorsImpl.java @@ -4,34 +4,53 @@ * license information. * * Code generated by Microsoft (R) AutoRest Code Generator. - * abc + * jkl */ package com.microsoft.azure.management.authorization.v2015_07_01.implementation; import com.microsoft.azure.arm.model.implementation.WrapperImpl; import com.microsoft.azure.management.authorization.v2015_07_01.ClassicAdministrators; -import rx.functions.Func1; import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.PagedList; import com.microsoft.azure.Page; +import com.microsoft.azure.arm.utils.PagedListConverter; import com.microsoft.azure.management.authorization.v2015_07_01.ClassicAdministrator; class ClassicAdministratorsImpl extends WrapperImpl implements ClassicAdministrators { + private PagedListConverter converter; private final AuthorizationManager manager; ClassicAdministratorsImpl(AuthorizationManager manager) { super(manager.inner().classicAdministrators()); this.manager = manager; + this.converter = new PagedListConverter() { + @Override + public Observable typeConvertAsync(ClassicAdministratorInner inner) { + return Observable.just((ClassicAdministrator) wrapModel(inner)); + } + }; } public AuthorizationManager manager() { return this.manager; } + private ClassicAdministratorImpl wrapModel(ClassicAdministratorInner inner) { + return new ClassicAdministratorImpl(inner, manager()); + } + + @Override + public PagedList list() { + ClassicAdministratorsInner client = this.inner(); + return converter.convert(client.list()); + } + @Override - public Observable listAsync(final String apiVersion) { + public Observable listAsync() { ClassicAdministratorsInner client = this.inner(); - return client.listAsync(apiVersion) + return client.listAsync() .flatMapIterable(new Func1, Iterable>() { @Override public Iterable call(Page page) { @@ -41,7 +60,7 @@ public Iterable call(Page .map(new Func1() { @Override public ClassicAdministrator call(ClassicAdministratorInner inner) { - return new ClassicAdministratorImpl(inner, manager()); + return wrapModel(inner); } }); } diff --git a/authorization/resource-manager/v2015_07_01/src/main/java/com/microsoft/azure/management/authorization/v2015_07_01/implementation/ClassicAdministratorsInner.java b/authorization/resource-manager/v2015_07_01/src/main/java/com/microsoft/azure/management/authorization/v2015_07_01/implementation/ClassicAdministratorsInner.java index d6da92a201ac..52bd3b15b2bf 100644 --- a/authorization/resource-manager/v2015_07_01/src/main/java/com/microsoft/azure/management/authorization/v2015_07_01/implementation/ClassicAdministratorsInner.java +++ b/authorization/resource-manager/v2015_07_01/src/main/java/com/microsoft/azure/management/authorization/v2015_07_01/implementation/ClassicAdministratorsInner.java @@ -69,14 +69,13 @@ interface ClassicAdministratorsService { /** * Gets service administrator, account administrator, and co-administrators for the subscription. * - * @param apiVersion The API version to use for this 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<ClassicAdministratorInner> object if successful. */ - public PagedList list(final String apiVersion) { - ServiceResponse> response = listSinglePageAsync(apiVersion).toBlocking().single(); + public PagedList list() { + ServiceResponse> response = listSinglePageAsync().toBlocking().single(); return new PagedList(response.body()) { @Override public Page nextPage(String nextPageLink) { @@ -88,14 +87,13 @@ public Page nextPage(String nextPageLink) { /** * Gets service administrator, account administrator, and co-administrators for the subscription. * - * @param apiVersion The API version to use for this operation. * @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 String apiVersion, final ListOperationCallback serviceCallback) { + public ServiceFuture> listAsync(final ListOperationCallback serviceCallback) { return AzureServiceFuture.fromPageResponse( - listSinglePageAsync(apiVersion), + listSinglePageAsync(), new Func1>>>() { @Override public Observable>> call(String nextPageLink) { @@ -108,12 +106,11 @@ public Observable>> call(String /** * Gets service administrator, account administrator, and co-administrators for the subscription. * - * @param apiVersion The API version to use for this operation. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the PagedList<ClassicAdministratorInner> object */ - public Observable> listAsync(final String apiVersion) { - return listWithServiceResponseAsync(apiVersion) + public Observable> listAsync() { + return listWithServiceResponseAsync() .map(new Func1>, Page>() { @Override public Page call(ServiceResponse> response) { @@ -125,12 +122,11 @@ public Page call(ServiceResponse>> listWithServiceResponseAsync(final String apiVersion) { - return listSinglePageAsync(apiVersion) + public Observable>> listWithServiceResponseAsync() { + return listSinglePageAsync() .concatMap(new Func1>, Observable>>>() { @Override public Observable>> call(ServiceResponse> page) { @@ -146,18 +142,17 @@ public Observable>> call(Service /** * Gets service administrator, account administrator, and co-administrators for the subscription. * - ServiceResponse> * @param apiVersion The API version to use for this operation. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the PagedList<ClassicAdministratorInner> object wrapped in {@link ServiceResponse} if successful. */ - public Observable>> listSinglePageAsync(final String apiVersion) { + public Observable>> listSinglePageAsync() { if (this.client.subscriptionId() == null) { throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); } - if (apiVersion == null) { - throw new IllegalArgumentException("Parameter apiVersion 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(), apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + 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) { diff --git a/authorization/resource-manager/v2015_07_01/src/main/java/com/microsoft/azure/management/authorization/v2015_07_01/implementation/ElevateAccessImpl.java b/authorization/resource-manager/v2015_07_01/src/main/java/com/microsoft/azure/management/authorization/v2015_07_01/implementation/ElevateAccessImpl.java new file mode 100644 index 000000000000..4054feaa96ac --- /dev/null +++ b/authorization/resource-manager/v2015_07_01/src/main/java/com/microsoft/azure/management/authorization/v2015_07_01/implementation/ElevateAccessImpl.java @@ -0,0 +1,34 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * abc + */ + +package com.microsoft.azure.management.authorization.v2015_07_01.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.authorization.v2015_07_01.ElevateAccess; +import rx.Completable; + +class ElevateAccessImpl extends WrapperImpl 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/v2015_07_01/src/main/java/com/microsoft/azure/management/authorization/v2015_07_01/implementation/GlobalAdministratorsImpl.java b/authorization/resource-manager/v2015_07_01/src/main/java/com/microsoft/azure/management/authorization/v2015_07_01/implementation/GlobalAdministratorsImpl.java new file mode 100644 index 000000000000..0d13bd8584b5 --- /dev/null +++ b/authorization/resource-manager/v2015_07_01/src/main/java/com/microsoft/azure/management/authorization/v2015_07_01/implementation/GlobalAdministratorsImpl.java @@ -0,0 +1,34 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * abc + */ + +package com.microsoft.azure.management.authorization.v2015_07_01.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.authorization.v2015_07_01.GlobalAdministrators; +import rx.Completable; + +class GlobalAdministratorsImpl extends WrapperImpl implements GlobalAdministrators { + private final AuthorizationManager manager; + + GlobalAdministratorsImpl(AuthorizationManager manager) { + super(manager.inner().globalAdministrators()); + this.manager = manager; + } + + public AuthorizationManager manager() { + return this.manager; + } + + @Override + public Completable elevateAccessAsync() { + GlobalAdministratorsInner client = this.inner(); + return client.elevateAccessAsync().toCompletable(); + } + +} diff --git a/authorization/resource-manager/v2015_07_01/src/main/java/com/microsoft/azure/management/authorization/v2015_07_01/implementation/GlobalAdministratorsInner.java b/authorization/resource-manager/v2015_07_01/src/main/java/com/microsoft/azure/management/authorization/v2015_07_01/implementation/GlobalAdministratorsInner.java new file mode 100644 index 000000000000..298db8fb4bd6 --- /dev/null +++ b/authorization/resource-manager/v2015_07_01/src/main/java/com/microsoft/azure/management/authorization/v2015_07_01/implementation/GlobalAdministratorsInner.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 GlobalAdministrators. + */ +public class GlobalAdministratorsInner { + /** The Retrofit service to perform REST calls. */ + private GlobalAdministratorsService service; + /** The service client containing this operation class. */ + private AuthorizationManagementClientImpl client; + + /** + * Initializes an instance of GlobalAdministratorsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public GlobalAdministratorsInner(Retrofit retrofit, AuthorizationManagementClientImpl client) { + this.service = retrofit.create(GlobalAdministratorsService.class); + this.client = client; + } + + /** + * The interface defining all the services for GlobalAdministrators to be + * used by Retrofit to perform actually REST calls. + */ + interface GlobalAdministratorsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.authorization.v2015_07_01.GlobalAdministrators elevateAccess" }) + @POST("providers/Microsoft.Authorization/elevateAccess") + Observable> elevateAccess(@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 elevateAccess() { + elevateAccessWithServiceResponseAsync().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 elevateAccessAsync(final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(elevateAccessWithServiceResponseAsync(), serviceCallback); + } + + /** + * Elevates access for a Global Administrator. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable elevateAccessAsync() { + return elevateAccessWithServiceResponseAsync().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> elevateAccessWithServiceResponseAsync() { + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.elevateAccess(this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = elevateAccessDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse elevateAccessDelegate(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/v2015_07_01/src/main/java/com/microsoft/azure/management/authorization/v2015_07_01/implementation/RoleDefinitionImpl.java b/authorization/resource-manager/v2015_07_01/src/main/java/com/microsoft/azure/management/authorization/v2015_07_01/implementation/RoleDefinitionImpl.java index ac4f77c3aafc..78b99229dba5 100644 --- a/authorization/resource-manager/v2015_07_01/src/main/java/com/microsoft/azure/management/authorization/v2015_07_01/implementation/RoleDefinitionImpl.java +++ b/authorization/resource-manager/v2015_07_01/src/main/java/com/microsoft/azure/management/authorization/v2015_07_01/implementation/RoleDefinitionImpl.java @@ -12,15 +12,13 @@ import com.microsoft.azure.management.authorization.v2015_07_01.RoleDefinition; import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; import rx.Observable; -import com.microsoft.azure.management.authorization.v2015_07_01.RoleDefinitionProperties; import java.util.List; -import rx.functions.Func1; +import java.util.ArrayList; +import com.microsoft.azure.management.authorization.v2015_07_01.Permission; class RoleDefinitionImpl extends CreatableUpdatableImpl implements RoleDefinition, RoleDefinition.Definition, RoleDefinition.Update { private String scope; private String roleDefinitionId; - private RoleDefinitionProperties cproperties; - private RoleDefinitionProperties uproperties; private final AuthorizationManager manager; RoleDefinitionImpl(String name, AuthorizationManager manager) { @@ -29,8 +27,6 @@ class RoleDefinitionImpl extends CreatableUpdatableImpl createResourceAsync() { RoleDefinitionsInner client = this.manager().inner().roleDefinitions(); - return client.createOrUpdateAsync(this.scope, this.roleDefinitionId, this.cproperties) - .map(new Func1() { - @Override - public RoleDefinitionInner call(RoleDefinitionInner resource) { - resetCreateUpdateParameters(); - return resource; - } - }) + return client.createOrUpdateAsync(this.scope, this.roleDefinitionId, this.inner()) .map(innerToFluentMap(this)); } @Override public Observable updateResourceAsync() { RoleDefinitionsInner client = this.manager().inner().roleDefinitions(); - return client.createOrUpdateAsync(this.scope, this.roleDefinitionId, this.uproperties) - .map(new Func1() { - @Override - public RoleDefinitionInner call(RoleDefinitionInner resource) { - resetCreateUpdateParameters(); - return resource; - } - }) + return client.createOrUpdateAsync(this.scope, this.roleDefinitionId, this.inner()) .map(innerToFluentMap(this)); } @@ -90,9 +70,15 @@ public boolean isInCreateMode() { return this.inner().id() == null; } - private void resetCreateUpdateParameters() { - this.cproperties = new RoleDefinitionProperties(); - this.uproperties = new RoleDefinitionProperties(); + + @Override + public List assignableScopes() { + return this.inner().assignableScopes(); + } + + @Override + public String description() { + return this.inner().description(); } @Override @@ -106,8 +92,24 @@ public String name() { } @Override - public RoleDefinitionProperties properties() { - return this.inner().properties(); + public List permissions() { + List lst = new ArrayList(); + if (this.inner().permissions() != null) { + for (PermissionInner inner : this.inner().permissions()) { + lst.add( new PermissionImpl(inner, manager())); + } + } + return lst; + } + + @Override + public String roleName() { + return this.inner().roleName(); + } + + @Override + public String roleType() { + return this.inner().roleType(); } @Override @@ -122,12 +124,32 @@ public RoleDefinitionImpl withScope(String scope) { } @Override - public RoleDefinitionImpl withProperties(RoleDefinitionProperties properties) { - if (isInCreateMode()) { - this.cproperties = properties; - } else { - this.uproperties = properties; - } + public RoleDefinitionImpl withAssignableScopes(List assignableScopes) { + this.inner().withAssignableScopes(assignableScopes); + return this; + } + + @Override + public RoleDefinitionImpl withDescription(String description) { + this.inner().withDescription(description); + return this; + } + + @Override + public RoleDefinitionImpl withPermissions(List permissions) { + this.inner().withPermissions(permissions); + return this; + } + + @Override + public RoleDefinitionImpl withRoleName(String roleName) { + this.inner().withRoleName(roleName); + return this; + } + + @Override + public RoleDefinitionImpl withRoleType(String roleType) { + this.inner().withRoleType(roleType); return this; } diff --git a/authorization/resource-manager/v2015_07_01/src/main/java/com/microsoft/azure/management/authorization/v2015_07_01/implementation/RoleDefinitionInner.java b/authorization/resource-manager/v2015_07_01/src/main/java/com/microsoft/azure/management/authorization/v2015_07_01/implementation/RoleDefinitionInner.java index b9051b7e60a7..8241bb9f4baa 100644 --- a/authorization/resource-manager/v2015_07_01/src/main/java/com/microsoft/azure/management/authorization/v2015_07_01/implementation/RoleDefinitionInner.java +++ b/authorization/resource-manager/v2015_07_01/src/main/java/com/microsoft/azure/management/authorization/v2015_07_01/implementation/RoleDefinitionInner.java @@ -8,12 +8,14 @@ package com.microsoft.azure.management.authorization.v2015_07_01.implementation; -import com.microsoft.azure.management.authorization.v2015_07_01.RoleDefinitionProperties; +import java.util.List; import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; /** * Role definition. */ +@JsonFlatten public class RoleDefinitionInner { /** * The role definition ID. @@ -34,10 +36,34 @@ public class RoleDefinitionInner { private String type; /** - * Role definition properties. + * The role name. */ - @JsonProperty(value = "properties") - private RoleDefinitionProperties properties; + @JsonProperty(value = "properties.roleName") + private String roleName; + + /** + * The role definition description. + */ + @JsonProperty(value = "properties.description") + private String description; + + /** + * The role type. + */ + @JsonProperty(value = "properties.type") + private String roleType; + + /** + * Role definition permissions. + */ + @JsonProperty(value = "properties.permissions") + private List permissions; + + /** + * Role definition assignable scopes. + */ + @JsonProperty(value = "properties.assignableScopes") + private List assignableScopes; /** * Get the role definition ID. @@ -67,22 +93,102 @@ public String type() { } /** - * Get role definition properties. + * Get the role name. + * + * @return the roleName value + */ + public String roleName() { + return this.roleName; + } + + /** + * Set the role name. + * + * @param roleName the roleName value to set + * @return the RoleDefinitionInner object itself. + */ + public RoleDefinitionInner withRoleName(String roleName) { + this.roleName = roleName; + return this; + } + + /** + * Get the role definition description. + * + * @return the description value + */ + public String description() { + return this.description; + } + + /** + * Set the role definition description. + * + * @param description the description value to set + * @return the RoleDefinitionInner object itself. + */ + public RoleDefinitionInner withDescription(String description) { + this.description = description; + return this; + } + + /** + * Get the role type. + * + * @return the roleType value + */ + public String roleType() { + return this.roleType; + } + + /** + * Set the role type. + * + * @param roleType the roleType value to set + * @return the RoleDefinitionInner object itself. + */ + public RoleDefinitionInner withRoleType(String roleType) { + this.roleType = roleType; + return this; + } + + /** + * Get role definition permissions. + * + * @return the permissions value + */ + public List permissions() { + return this.permissions; + } + + /** + * Set role definition permissions. + * + * @param permissions the permissions value to set + * @return the RoleDefinitionInner object itself. + */ + public RoleDefinitionInner withPermissions(List permissions) { + this.permissions = permissions; + return this; + } + + /** + * Get role definition assignable scopes. * - * @return the properties value + * @return the assignableScopes value */ - public RoleDefinitionProperties properties() { - return this.properties; + public List assignableScopes() { + return this.assignableScopes; } /** - * Set role definition properties. + * Set role definition assignable scopes. * - * @param properties the properties value to set + * @param assignableScopes the assignableScopes value to set * @return the RoleDefinitionInner object itself. */ - public RoleDefinitionInner withProperties(RoleDefinitionProperties properties) { - this.properties = properties; + public RoleDefinitionInner withAssignableScopes(List assignableScopes) { + this.assignableScopes = assignableScopes; return this; } diff --git a/authorization/resource-manager/v2015_07_01/src/main/java/com/microsoft/azure/management/authorization/v2015_07_01/implementation/RoleDefinitionsInner.java b/authorization/resource-manager/v2015_07_01/src/main/java/com/microsoft/azure/management/authorization/v2015_07_01/implementation/RoleDefinitionsInner.java index e3cd36b4a3e8..108f7a2a77da 100644 --- a/authorization/resource-manager/v2015_07_01/src/main/java/com/microsoft/azure/management/authorization/v2015_07_01/implementation/RoleDefinitionsInner.java +++ b/authorization/resource-manager/v2015_07_01/src/main/java/com/microsoft/azure/management/authorization/v2015_07_01/implementation/RoleDefinitionsInner.java @@ -14,7 +14,6 @@ import com.microsoft.azure.AzureServiceFuture; import com.microsoft.azure.CloudException; import com.microsoft.azure.ListOperationCallback; -import com.microsoft.azure.management.authorization.v2015_07_01.RoleDefinitionProperties; import com.microsoft.azure.Page; import com.microsoft.azure.PagedList; import com.microsoft.rest.ServiceCallback; @@ -73,7 +72,7 @@ interface RoleDefinitionsService { @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.authorization.v2015_07_01.RoleDefinitions createOrUpdate" }) @PUT("{scope}/providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionId}") - Observable> createOrUpdate(@Path(value = "scope", encoded = true) String scope, @Path("roleDefinitionId") String roleDefinitionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body RoleDefinitionInner roleDefinition, @Header("User-Agent") String userAgent); + Observable> createOrUpdate(@Path(value = "scope", encoded = true) String scope, @Path("roleDefinitionId") String roleDefinitionId, @Body RoleDefinitionInner roleDefinition, @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.authorization.v2015_07_01.RoleDefinitions list" }) @GET("{scope}/providers/Microsoft.Authorization/roleDefinitions") @@ -260,13 +259,14 @@ private ServiceResponse getDelegate(Response * * @param scope The scope of the role definition. * @param roleDefinitionId The ID of the role definition. + * @param roleDefinition The values for the role definition. * @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 RoleDefinitionInner object if successful. */ - public RoleDefinitionInner createOrUpdate(String scope, String roleDefinitionId) { - return createOrUpdateWithServiceResponseAsync(scope, roleDefinitionId).toBlocking().single().body(); + public RoleDefinitionInner createOrUpdate(String scope, String roleDefinitionId, RoleDefinitionInner roleDefinition) { + return createOrUpdateWithServiceResponseAsync(scope, roleDefinitionId, roleDefinition).toBlocking().single().body(); } /** @@ -274,12 +274,13 @@ public RoleDefinitionInner createOrUpdate(String scope, String roleDefinitionId) * * @param scope The scope of the role definition. * @param roleDefinitionId The ID of the role definition. + * @param roleDefinition The values for the role definition. * @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 scope, String roleDefinitionId, final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(scope, roleDefinitionId), serviceCallback); + public ServiceFuture createOrUpdateAsync(String scope, String roleDefinitionId, RoleDefinitionInner roleDefinition, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(scope, roleDefinitionId, roleDefinition), serviceCallback); } /** @@ -287,11 +288,12 @@ public ServiceFuture createOrUpdateAsync(String scope, Stri * * @param scope The scope of the role definition. * @param roleDefinitionId The ID of the role definition. + * @param roleDefinition The values for the role definition. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the RoleDefinitionInner object */ - public Observable createOrUpdateAsync(String scope, String roleDefinitionId) { - return createOrUpdateWithServiceResponseAsync(scope, roleDefinitionId).map(new Func1, RoleDefinitionInner>() { + public Observable createOrUpdateAsync(String scope, String roleDefinitionId, RoleDefinitionInner roleDefinition) { + return createOrUpdateWithServiceResponseAsync(scope, roleDefinitionId, roleDefinition).map(new Func1, RoleDefinitionInner>() { @Override public RoleDefinitionInner call(ServiceResponse response) { return response.body(); @@ -304,106 +306,25 @@ public RoleDefinitionInner call(ServiceResponse response) { * * @param scope The scope of the role definition. * @param roleDefinitionId The ID of the role definition. + * @param roleDefinition The values for the role definition. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the RoleDefinitionInner object */ - public Observable> createOrUpdateWithServiceResponseAsync(String scope, String roleDefinitionId) { + public Observable> createOrUpdateWithServiceResponseAsync(String scope, String roleDefinitionId, RoleDefinitionInner roleDefinition) { if (scope == null) { throw new IllegalArgumentException("Parameter scope is required and cannot be null."); } if (roleDefinitionId == null) { throw new IllegalArgumentException("Parameter roleDefinitionId is required and cannot be null."); } - if (this.client.apiVersion() == null) { - throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); - } - final RoleDefinitionProperties properties = null; - RoleDefinitionInner roleDefinition = new RoleDefinitionInner(); - roleDefinition.withProperties(null); - return service.createOrUpdate(scope, roleDefinitionId, this.client.apiVersion(), this.client.acceptLanguage(), roleDefinition, 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); - } - } - }); - } - - /** - * Creates or updates a role definition. - * - * @param scope The scope of the role definition. - * @param roleDefinitionId The ID of the role definition. - * @param properties Role definition properties. - * @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 RoleDefinitionInner object if successful. - */ - public RoleDefinitionInner createOrUpdate(String scope, String roleDefinitionId, RoleDefinitionProperties properties) { - return createOrUpdateWithServiceResponseAsync(scope, roleDefinitionId, properties).toBlocking().single().body(); - } - - /** - * Creates or updates a role definition. - * - * @param scope The scope of the role definition. - * @param roleDefinitionId The ID of the role definition. - * @param properties Role definition properties. - * @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 scope, String roleDefinitionId, RoleDefinitionProperties properties, final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(scope, roleDefinitionId, properties), serviceCallback); - } - - /** - * Creates or updates a role definition. - * - * @param scope The scope of the role definition. - * @param roleDefinitionId The ID of the role definition. - * @param properties Role definition properties. - * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the RoleDefinitionInner object - */ - public Observable createOrUpdateAsync(String scope, String roleDefinitionId, RoleDefinitionProperties properties) { - return createOrUpdateWithServiceResponseAsync(scope, roleDefinitionId, properties).map(new Func1, RoleDefinitionInner>() { - @Override - public RoleDefinitionInner call(ServiceResponse response) { - return response.body(); - } - }); - } - - /** - * Creates or updates a role definition. - * - * @param scope The scope of the role definition. - * @param roleDefinitionId The ID of the role definition. - * @param properties Role definition properties. - * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the RoleDefinitionInner object - */ - public Observable> createOrUpdateWithServiceResponseAsync(String scope, String roleDefinitionId, RoleDefinitionProperties properties) { - if (scope == null) { - throw new IllegalArgumentException("Parameter scope is required and cannot be null."); - } - if (roleDefinitionId == null) { - throw new IllegalArgumentException("Parameter roleDefinitionId is required and cannot be null."); + if (roleDefinition == null) { + throw new IllegalArgumentException("Parameter roleDefinition is required and cannot be null."); } if (this.client.apiVersion() == null) { throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); } - Validator.validate(properties); - RoleDefinitionInner roleDefinition = new RoleDefinitionInner(); - roleDefinition.withProperties(properties); - return service.createOrUpdate(scope, roleDefinitionId, this.client.apiVersion(), this.client.acceptLanguage(), roleDefinition, this.client.userAgent()) + Validator.validate(roleDefinition); + return service.createOrUpdate(scope, roleDefinitionId, roleDefinition, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1, Observable>>() { @Override public Observable> call(Response response) { diff --git a/authorization/resource-manager/v2018_07_01_preview/pom.xml b/authorization/resource-manager/v2018_07_01_preview/pom.xml new file mode 100644 index 000000000000..c882ebec8a22 --- /dev/null +++ b/authorization/resource-manager/v2018_07_01_preview/pom.xml @@ -0,0 +1,133 @@ + + + 4.0.0 + com.microsoft.azure.authorization.v2018_07_01_preview + + com.microsoft.azure + azure-arm-parent + 0.0.3-beta + ../../../pom.xml + + azure-mgmt-authorization + 1.0.0-beta + jar + Microsoft Azure SDK for Authorization Management + This package contains Microsoft Authorization 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 + + + + + + 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/authorization/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/authorization/v2018_07_01_preview/DenyAssignment.java b/authorization/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/authorization/v2018_07_01_preview/DenyAssignment.java new file mode 100644 index 000000000000..0bf07b0c704f --- /dev/null +++ b/authorization/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/authorization/v2018_07_01_preview/DenyAssignment.java @@ -0,0 +1,76 @@ +/** + * 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.v2018_07_01_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.authorization.v2018_07_01_preview.implementation.AuthorizationManager; +import com.microsoft.azure.management.authorization.v2018_07_01_preview.implementation.DenyAssignmentInner; +import java.util.List; + +/** + * Type representing DenyAssignment. + */ +public interface DenyAssignment extends HasInner, HasManager { + /** + * @return the denyAssignmentName value. + */ + String denyAssignmentName(); + + /** + * @return the description value. + */ + String description(); + + /** + * @return the doNotApplyToChildScopes value. + */ + Boolean doNotApplyToChildScopes(); + + /** + * @return the excludePrincipals value. + */ + List excludePrincipals(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the isSystemProtected value. + */ + Boolean isSystemProtected(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the permissions value. + */ + List permissions(); + + /** + * @return the principals value. + */ + List principals(); + + /** + * @return the scope value. + */ + String scope(); + + /** + * @return the type value. + */ + String type(); + +} diff --git a/authorization/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/authorization/v2018_07_01_preview/DenyAssignmentFilter.java b/authorization/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/authorization/v2018_07_01_preview/DenyAssignmentFilter.java new file mode 100644 index 000000000000..d940bbee9e06 --- /dev/null +++ b/authorization/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/authorization/v2018_07_01_preview/DenyAssignmentFilter.java @@ -0,0 +1,98 @@ +/** + * 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.v2018_07_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Deny Assignments filter. + */ +public class DenyAssignmentFilter { + /** + * Return deny assignment with specified name. + */ + @JsonProperty(value = "denyAssignmentName") + private String denyAssignmentName; + + /** + * Return all deny assignments where the specified principal is listed in + * the principals list of deny assignments. + */ + @JsonProperty(value = "principalId") + private String principalId; + + /** + * Return all deny assignments where the specified principal is listed + * either in the principals list or exclude principals list of deny + * assignments. + */ + @JsonProperty(value = "gdprExportPrincipalId") + private String gdprExportPrincipalId; + + /** + * Get return deny assignment with specified name. + * + * @return the denyAssignmentName value + */ + public String denyAssignmentName() { + return this.denyAssignmentName; + } + + /** + * Set return deny assignment with specified name. + * + * @param denyAssignmentName the denyAssignmentName value to set + * @return the DenyAssignmentFilter object itself. + */ + public DenyAssignmentFilter withDenyAssignmentName(String denyAssignmentName) { + this.denyAssignmentName = denyAssignmentName; + return this; + } + + /** + * Get return all deny assignments where the specified principal is listed in the principals list of deny assignments. + * + * @return the principalId value + */ + public String principalId() { + return this.principalId; + } + + /** + * Set return all deny assignments where the specified principal is listed in the principals list of deny assignments. + * + * @param principalId the principalId value to set + * @return the DenyAssignmentFilter object itself. + */ + public DenyAssignmentFilter withPrincipalId(String principalId) { + this.principalId = principalId; + return this; + } + + /** + * Get return all deny assignments where the specified principal is listed either in the principals list or exclude principals list of deny assignments. + * + * @return the gdprExportPrincipalId value + */ + public String gdprExportPrincipalId() { + return this.gdprExportPrincipalId; + } + + /** + * Set return all deny assignments where the specified principal is listed either in the principals list or exclude principals list of deny assignments. + * + * @param gdprExportPrincipalId the gdprExportPrincipalId value to set + * @return the DenyAssignmentFilter object itself. + */ + public DenyAssignmentFilter withGdprExportPrincipalId(String gdprExportPrincipalId) { + this.gdprExportPrincipalId = gdprExportPrincipalId; + return this; + } + +} diff --git a/authorization/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/authorization/v2018_07_01_preview/DenyAssignmentPermission.java b/authorization/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/authorization/v2018_07_01_preview/DenyAssignmentPermission.java new file mode 100644 index 000000000000..43b7ccf3d3c4 --- /dev/null +++ b/authorization/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/authorization/v2018_07_01_preview/DenyAssignmentPermission.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.authorization.v2018_07_01_preview; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Deny assignment permissions. + */ +public class DenyAssignmentPermission { + /** + * Actions to which the deny assignment does not grant access. + */ + @JsonProperty(value = "actions") + private List actions; + + /** + * Actions to exclude from that the deny assignment does not grant access. + */ + @JsonProperty(value = "notActions") + private List notActions; + + /** + * Data actions to which the deny assignment does not grant access. + */ + @JsonProperty(value = "dataActions") + private List dataActions; + + /** + * Data actions to exclude from that the deny assignment does not grant + * access. + */ + @JsonProperty(value = "notDataActions") + private List notDataActions; + + /** + * Get actions to which the deny assignment does not grant access. + * + * @return the actions value + */ + public List actions() { + return this.actions; + } + + /** + * Set actions to which the deny assignment does not grant access. + * + * @param actions the actions value to set + * @return the DenyAssignmentPermission object itself. + */ + public DenyAssignmentPermission withActions(List actions) { + this.actions = actions; + return this; + } + + /** + * Get actions to exclude from that the deny assignment does not grant access. + * + * @return the notActions value + */ + public List notActions() { + return this.notActions; + } + + /** + * Set actions to exclude from that the deny assignment does not grant access. + * + * @param notActions the notActions value to set + * @return the DenyAssignmentPermission object itself. + */ + public DenyAssignmentPermission withNotActions(List notActions) { + this.notActions = notActions; + return this; + } + + /** + * Get data actions to which the deny assignment does not grant access. + * + * @return the dataActions value + */ + public List dataActions() { + return this.dataActions; + } + + /** + * Set data actions to which the deny assignment does not grant access. + * + * @param dataActions the dataActions value to set + * @return the DenyAssignmentPermission object itself. + */ + public DenyAssignmentPermission withDataActions(List dataActions) { + this.dataActions = dataActions; + return this; + } + + /** + * Get data actions to exclude from that the deny assignment does not grant access. + * + * @return the notDataActions value + */ + public List notDataActions() { + return this.notDataActions; + } + + /** + * Set data actions to exclude from that the deny assignment does not grant access. + * + * @param notDataActions the notDataActions value to set + * @return the DenyAssignmentPermission object itself. + */ + public DenyAssignmentPermission withNotDataActions(List notDataActions) { + this.notDataActions = notDataActions; + return this; + } + +} diff --git a/authorization/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/authorization/v2018_07_01_preview/DenyAssignments.java b/authorization/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/authorization/v2018_07_01_preview/DenyAssignments.java new file mode 100644 index 000000000000..2d14f4e87c40 --- /dev/null +++ b/authorization/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/authorization/v2018_07_01_preview/DenyAssignments.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.authorization.v2018_07_01_preview; + +import rx.Observable; + +/** + * Type representing DenyAssignments. + */ +public interface DenyAssignments { + /** + * Gets deny assignments for a resource. + * + * @param resourceGroupName The name of the resource group. + * @param resourceProviderNamespace The namespace of the resource provider. + * @param parentResourcePath The parent resource identity. + * @param resourceType The resource type of the resource. + * @param resourceName The name of the resource to get deny assignments for. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listForResourceAsync(final String resourceGroupName, final String resourceProviderNamespace, final String parentResourcePath, final String resourceType, final String resourceName); + + /** + * Get the specified deny assignment. + * + * @param scope The scope of the deny assignment. + * @param denyAssignmentId The ID of the deny assignment to get. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String scope, String denyAssignmentId); + + /** + * Gets a deny assignment by ID. + * + * @param denyAssignmentId The fully qualified deny assignment ID. For example, use the format, /subscriptions/{guid}/providers/Microsoft.Authorization/denyAssignments/{denyAssignmentId} for subscription level deny assignments, or /providers/Microsoft.Authorization/denyAssignments/{denyAssignmentId} for tenant level deny assignments. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getByIdAsync(String denyAssignmentId); + + /** + * Gets deny assignments for a resource group. + * + * @param resourceGroupName The name of the resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByResourceGroupAsync(final String resourceGroupName); + + /** + * Gets all deny assignments for the subscription. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listAsync(); + + /** + * Gets deny assignments for a scope. + * + * @param scope The scope of the deny assignments. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listForScopeAsync(final String scope); + +} diff --git a/authorization/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/authorization/v2018_07_01_preview/Principal.java b/authorization/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/authorization/v2018_07_01_preview/Principal.java new file mode 100644 index 000000000000..d95bf3720271 --- /dev/null +++ b/authorization/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/authorization/v2018_07_01_preview/Principal.java @@ -0,0 +1,53 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.authorization.v2018_07_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Deny assignment principal. + */ +public class Principal { + /** + * Object ID of the Azure AD principal (user, group, or service principal) + * to which the deny assignment applies. An empty guid + * '00000000-0000-0000-0000-000000000000' as principal id and principal + * type as 'Everyone' represents all users, groups and service principals. + */ + @JsonProperty(value = "id", access = JsonProperty.Access.WRITE_ONLY) + private String id; + + /** + * Type of object represented by principal id (user, group, or service + * principal). An empty guid '00000000-0000-0000-0000-000000000000' as + * principal id and principal type as 'Everyone' represents all users, + * groups and service principals. + */ + @JsonProperty(value = "type", access = JsonProperty.Access.WRITE_ONLY) + private String type; + + /** + * Get object ID of the Azure AD principal (user, group, or service principal) to which the deny assignment applies. An empty guid '00000000-0000-0000-0000-000000000000' as principal id and principal type as 'Everyone' represents all users, groups and service principals. + * + * @return the id value + */ + public String id() { + return this.id; + } + + /** + * Get type of object represented by principal id (user, group, or service principal). An empty guid '00000000-0000-0000-0000-000000000000' as principal id and principal type as 'Everyone' represents all users, groups and service principals. + * + * @return the type value + */ + public String type() { + return this.type; + } + +} diff --git a/authorization/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/authorization/v2018_07_01_preview/implementation/AuthorizationManagementClientImpl.java b/authorization/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/authorization/v2018_07_01_preview/implementation/AuthorizationManagementClientImpl.java new file mode 100644 index 000000000000..3fa2f0a37f64 --- /dev/null +++ b/authorization/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/authorization/v2018_07_01_preview/implementation/AuthorizationManagementClientImpl.java @@ -0,0 +1,196 @@ +/** + * 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.v2018_07_01_preview.implementation; + +import com.microsoft.azure.AzureClient; +import com.microsoft.azure.AzureServiceClient; +import com.microsoft.rest.credentials.ServiceClientCredentials; +import com.microsoft.rest.RestClient; + +/** + * Initializes a new instance of the AuthorizationManagementClientImpl class. + */ +public class AuthorizationManagementClientImpl 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 target subscription. */ + private String subscriptionId; + + /** + * Gets The ID of the target subscription. + * + * @return the subscriptionId value. + */ + public String subscriptionId() { + return this.subscriptionId; + } + + /** + * Sets The ID of the target subscription. + * + * @param subscriptionId the subscriptionId value. + * @return the service client itself + */ + public AuthorizationManagementClientImpl withSubscriptionId(String subscriptionId) { + this.subscriptionId = subscriptionId; + return this; + } + + /** The API version to use for this operation. */ + private String apiVersion; + + /** + * Gets The API version to use for this operation. + * + * @return the apiVersion value. + */ + public String apiVersion() { + return this.apiVersion; + } + + /** The 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 AuthorizationManagementClientImpl 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 AuthorizationManagementClientImpl 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 AuthorizationManagementClientImpl withGenerateClientRequestId(boolean generateClientRequestId) { + this.generateClientRequestId = generateClientRequestId; + return this; + } + + /** + * The DenyAssignmentsInner object to access its operations. + */ + private DenyAssignmentsInner denyAssignments; + + /** + * Gets the DenyAssignmentsInner object to access its operations. + * @return the DenyAssignmentsInner object. + */ + public DenyAssignmentsInner denyAssignments() { + return this.denyAssignments; + } + + /** + * Initializes an instance of AuthorizationManagementClient client. + * + * @param credentials the management credentials for Azure + */ + public AuthorizationManagementClientImpl(ServiceClientCredentials credentials) { + this("https://management.azure.com", credentials); + } + + /** + * Initializes an instance of AuthorizationManagementClient client. + * + * @param baseUrl the base URL of the host + * @param credentials the management credentials for Azure + */ + public AuthorizationManagementClientImpl(String baseUrl, ServiceClientCredentials credentials) { + super(baseUrl, credentials); + initialize(); + } + + /** + * Initializes an instance of AuthorizationManagementClient client. + * + * @param restClient the REST client to connect to Azure. + */ + public AuthorizationManagementClientImpl(RestClient restClient) { + super(restClient); + initialize(); + } + + protected void initialize() { + this.apiVersion = "2018-07-01-preview"; + this.acceptLanguage = "en-US"; + this.longRunningOperationRetryTimeout = 30; + this.generateClientRequestId = true; + this.denyAssignments = new DenyAssignmentsInner(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(), "AuthorizationManagementClient", "2018-07-01-preview"); + } +} diff --git a/authorization/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/authorization/v2018_07_01_preview/implementation/AuthorizationManager.java b/authorization/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/authorization/v2018_07_01_preview/implementation/AuthorizationManager.java new file mode 100644 index 000000000000..04c02da17121 --- /dev/null +++ b/authorization/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/authorization/v2018_07_01_preview/implementation/AuthorizationManager.java @@ -0,0 +1,99 @@ +/** + * 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.v2018_07_01_preview.implementation; + +import com.microsoft.azure.AzureEnvironment; +import com.microsoft.azure.AzureResponseBuilder; +import com.microsoft.azure.credentials.AzureTokenCredentials; +import com.microsoft.azure.management.apigeneration.Beta; +import com.microsoft.azure.management.apigeneration.Beta.SinceVersion; +import com.microsoft.azure.arm.resources.AzureConfigurable; +import com.microsoft.azure.serializer.AzureJacksonAdapter; +import com.microsoft.rest.RestClient; +import com.microsoft.azure.management.authorization.v2018_07_01_preview.DenyAssignments; +import com.microsoft.azure.arm.resources.implementation.AzureConfigurableCoreImpl; +import com.microsoft.azure.arm.resources.implementation.ManagerCore; + +/** + * Entry point to Azure Authorization resource management. + */ +public final class AuthorizationManager extends ManagerCore { + private DenyAssignments denyAssignments; + /** + * Get a Configurable instance that can be used to create AuthorizationManager with optional configuration. + * + * @return the instance allowing configurations + */ + public static Configurable configure() { + return new AuthorizationManager.ConfigurableImpl(); + } + /** + * Creates an instance of AuthorizationManager that exposes Authorization resource management API entry points. + * + * @param credentials the credentials to use + * @param subscriptionId the subscription UUID + * @return the AuthorizationManager + */ + public static AuthorizationManager authenticate(AzureTokenCredentials credentials, String subscriptionId) { + return new AuthorizationManager(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 AuthorizationManager that exposes Authorization resource management API entry points. + * + * @param restClient the RestClient to be used for API calls. + * @param subscriptionId the subscription UUID + * @return the AuthorizationManager + */ + public static AuthorizationManager authenticate(RestClient restClient, String subscriptionId) { + return new AuthorizationManager(restClient, subscriptionId); + } + /** + * The interface allowing configurations to be set. + */ + public interface Configurable extends AzureConfigurable { + /** + * Creates an instance of AuthorizationManager that exposes Authorization management API entry points. + * + * @param credentials the credentials to use + * @param subscriptionId the subscription UUID + * @return the interface exposing Authorization management API entry points that work across subscriptions + */ + AuthorizationManager authenticate(AzureTokenCredentials credentials, String subscriptionId); + } + + /** + * @return Entry point to manage DenyAssignments. + */ + public DenyAssignments denyAssignments() { + if (this.denyAssignments == null) { + this.denyAssignments = new DenyAssignmentsImpl(this); + } + return this.denyAssignments; + } + + /** + * The implementation for Configurable interface. + */ + private static final class ConfigurableImpl extends AzureConfigurableCoreImpl implements Configurable { + public AuthorizationManager authenticate(AzureTokenCredentials credentials, String subscriptionId) { + return AuthorizationManager.authenticate(buildRestClient(credentials), subscriptionId); + } + } + private AuthorizationManager(RestClient restClient, String subscriptionId) { + super( + restClient, + subscriptionId, + new AuthorizationManagementClientImpl(restClient).withSubscriptionId(subscriptionId)); + } +} diff --git a/authorization/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/authorization/v2018_07_01_preview/implementation/DenyAssignmentImpl.java b/authorization/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/authorization/v2018_07_01_preview/implementation/DenyAssignmentImpl.java new file mode 100644 index 000000000000..6dea8a7f7cc6 --- /dev/null +++ b/authorization/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/authorization/v2018_07_01_preview/implementation/DenyAssignmentImpl.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.authorization.v2018_07_01_preview.implementation; + +import com.microsoft.azure.management.authorization.v2018_07_01_preview.DenyAssignment; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import java.util.List; +import com.microsoft.azure.management.authorization.v2018_07_01_preview.Principal; +import com.microsoft.azure.management.authorization.v2018_07_01_preview.DenyAssignmentPermission; + +class DenyAssignmentImpl extends WrapperImpl implements DenyAssignment { + private final AuthorizationManager manager; + DenyAssignmentImpl(DenyAssignmentInner inner, AuthorizationManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public AuthorizationManager manager() { + return this.manager; + } + + @Override + public String denyAssignmentName() { + return this.inner().denyAssignmentName(); + } + + @Override + public String description() { + return this.inner().description(); + } + + @Override + public Boolean doNotApplyToChildScopes() { + return this.inner().doNotApplyToChildScopes(); + } + + @Override + public List excludePrincipals() { + return this.inner().excludePrincipals(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public Boolean isSystemProtected() { + return this.inner().isSystemProtected(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public List permissions() { + return this.inner().permissions(); + } + + @Override + public List principals() { + return this.inner().principals(); + } + + @Override + public String scope() { + return this.inner().scope(); + } + + @Override + public String type() { + return this.inner().type(); + } + +} diff --git a/authorization/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/authorization/v2018_07_01_preview/implementation/DenyAssignmentInner.java b/authorization/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/authorization/v2018_07_01_preview/implementation/DenyAssignmentInner.java new file mode 100644 index 000000000000..e0d46bcc2926 --- /dev/null +++ b/authorization/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/authorization/v2018_07_01_preview/implementation/DenyAssignmentInner.java @@ -0,0 +1,277 @@ +/** + * 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.v2018_07_01_preview.implementation; + +import java.util.List; +import com.microsoft.azure.management.authorization.v2018_07_01_preview.DenyAssignmentPermission; +import com.microsoft.azure.management.authorization.v2018_07_01_preview.Principal; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; + +/** + * Deny Assignment. + */ +@JsonFlatten +public class DenyAssignmentInner { + /** + * The deny assignment ID. + */ + @JsonProperty(value = "id", access = JsonProperty.Access.WRITE_ONLY) + private String id; + + /** + * The deny assignment name. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /** + * The deny assignment type. + */ + @JsonProperty(value = "type", access = JsonProperty.Access.WRITE_ONLY) + private String type; + + /** + * The display name of the deny assignment. + */ + @JsonProperty(value = "properties.denyAssignmentName") + private String denyAssignmentName; + + /** + * The description of the deny assignment. + */ + @JsonProperty(value = "properties.description") + private String description; + + /** + * An array of permissions that are denied by the deny assignment. + */ + @JsonProperty(value = "properties.permissions") + private List permissions; + + /** + * The deny assignment scope. + */ + @JsonProperty(value = "properties.scope") + private String scope; + + /** + * Determines if the deny assignment applies to child scopes. Default value + * is false. + */ + @JsonProperty(value = "properties.doNotApplyToChildScopes") + private Boolean doNotApplyToChildScopes; + + /** + * Array of principals to which the deny assignment applies. + */ + @JsonProperty(value = "properties.principals") + private List principals; + + /** + * Array of principals to which the deny assignment does not apply. + */ + @JsonProperty(value = "properties.excludePrincipals") + private List excludePrincipals; + + /** + * Specifies whether this deny assignment was created by Azure and cannot + * be edited or deleted. + */ + @JsonProperty(value = "properties.isSystemProtected") + private Boolean isSystemProtected; + + /** + * Get the deny assignment ID. + * + * @return the id value + */ + public String id() { + return this.id; + } + + /** + * Get the deny assignment name. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Get the deny assignment type. + * + * @return the type value + */ + public String type() { + return this.type; + } + + /** + * Get the display name of the deny assignment. + * + * @return the denyAssignmentName value + */ + public String denyAssignmentName() { + return this.denyAssignmentName; + } + + /** + * Set the display name of the deny assignment. + * + * @param denyAssignmentName the denyAssignmentName value to set + * @return the DenyAssignmentInner object itself. + */ + public DenyAssignmentInner withDenyAssignmentName(String denyAssignmentName) { + this.denyAssignmentName = denyAssignmentName; + return this; + } + + /** + * Get the description of the deny assignment. + * + * @return the description value + */ + public String description() { + return this.description; + } + + /** + * Set the description of the deny assignment. + * + * @param description the description value to set + * @return the DenyAssignmentInner object itself. + */ + public DenyAssignmentInner withDescription(String description) { + this.description = description; + return this; + } + + /** + * Get an array of permissions that are denied by the deny assignment. + * + * @return the permissions value + */ + public List permissions() { + return this.permissions; + } + + /** + * Set an array of permissions that are denied by the deny assignment. + * + * @param permissions the permissions value to set + * @return the DenyAssignmentInner object itself. + */ + public DenyAssignmentInner withPermissions(List permissions) { + this.permissions = permissions; + return this; + } + + /** + * Get the deny assignment scope. + * + * @return the scope value + */ + public String scope() { + return this.scope; + } + + /** + * Set the deny assignment scope. + * + * @param scope the scope value to set + * @return the DenyAssignmentInner object itself. + */ + public DenyAssignmentInner withScope(String scope) { + this.scope = scope; + return this; + } + + /** + * Get determines if the deny assignment applies to child scopes. Default value is false. + * + * @return the doNotApplyToChildScopes value + */ + public Boolean doNotApplyToChildScopes() { + return this.doNotApplyToChildScopes; + } + + /** + * Set determines if the deny assignment applies to child scopes. Default value is false. + * + * @param doNotApplyToChildScopes the doNotApplyToChildScopes value to set + * @return the DenyAssignmentInner object itself. + */ + public DenyAssignmentInner withDoNotApplyToChildScopes(Boolean doNotApplyToChildScopes) { + this.doNotApplyToChildScopes = doNotApplyToChildScopes; + return this; + } + + /** + * Get array of principals to which the deny assignment applies. + * + * @return the principals value + */ + public List principals() { + return this.principals; + } + + /** + * Set array of principals to which the deny assignment applies. + * + * @param principals the principals value to set + * @return the DenyAssignmentInner object itself. + */ + public DenyAssignmentInner withPrincipals(List principals) { + this.principals = principals; + return this; + } + + /** + * Get array of principals to which the deny assignment does not apply. + * + * @return the excludePrincipals value + */ + public List excludePrincipals() { + return this.excludePrincipals; + } + + /** + * Set array of principals to which the deny assignment does not apply. + * + * @param excludePrincipals the excludePrincipals value to set + * @return the DenyAssignmentInner object itself. + */ + public DenyAssignmentInner withExcludePrincipals(List excludePrincipals) { + this.excludePrincipals = excludePrincipals; + return this; + } + + /** + * Get specifies whether this deny assignment was created by Azure and cannot be edited or deleted. + * + * @return the isSystemProtected value + */ + public Boolean isSystemProtected() { + return this.isSystemProtected; + } + + /** + * Set specifies whether this deny assignment was created by Azure and cannot be edited or deleted. + * + * @param isSystemProtected the isSystemProtected value to set + * @return the DenyAssignmentInner object itself. + */ + public DenyAssignmentInner withIsSystemProtected(Boolean isSystemProtected) { + this.isSystemProtected = isSystemProtected; + return this; + } + +} diff --git a/authorization/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/authorization/v2018_07_01_preview/implementation/DenyAssignmentsImpl.java b/authorization/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/authorization/v2018_07_01_preview/implementation/DenyAssignmentsImpl.java new file mode 100644 index 000000000000..4e3623c70e54 --- /dev/null +++ b/authorization/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/authorization/v2018_07_01_preview/implementation/DenyAssignmentsImpl.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. + * abc + */ + +package com.microsoft.azure.management.authorization.v2018_07_01_preview.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.authorization.v2018_07_01_preview.DenyAssignments; +import rx.functions.Func1; +import rx.Observable; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.authorization.v2018_07_01_preview.DenyAssignment; + +class DenyAssignmentsImpl extends WrapperImpl implements DenyAssignments { + private final AuthorizationManager manager; + + DenyAssignmentsImpl(AuthorizationManager manager) { + super(manager.inner().denyAssignments()); + this.manager = manager; + } + + public AuthorizationManager manager() { + return this.manager; + } + + @Override + public Observable listForResourceAsync(final String resourceGroupName, final String resourceProviderNamespace, final String parentResourcePath, final String resourceType, final String resourceName) { + DenyAssignmentsInner client = this.inner(); + return client.listForResourceAsync(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public DenyAssignment call(DenyAssignmentInner inner) { + return new DenyAssignmentImpl(inner, manager()); + } + }); + } + + @Override + public Observable getAsync(String scope, String denyAssignmentId) { + DenyAssignmentsInner client = this.inner(); + return client.getAsync(scope, denyAssignmentId) + .map(new Func1() { + @Override + public DenyAssignment call(DenyAssignmentInner inner) { + return new DenyAssignmentImpl(inner, manager()); + } + }); + } + + @Override + public Observable getByIdAsync(String denyAssignmentId) { + DenyAssignmentsInner client = this.inner(); + return client.getByIdAsync(denyAssignmentId) + .map(new Func1() { + @Override + public DenyAssignment call(DenyAssignmentInner inner) { + return new DenyAssignmentImpl(inner, manager()); + } + }); + } + + @Override + public Observable listByResourceGroupAsync(final String resourceGroupName) { + DenyAssignmentsInner 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 DenyAssignment call(DenyAssignmentInner inner) { + return new DenyAssignmentImpl(inner, manager()); + } + }); + } + + @Override + public Observable listAsync() { + DenyAssignmentsInner client = this.inner(); + return client.listAsync() + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public DenyAssignment call(DenyAssignmentInner inner) { + return new DenyAssignmentImpl(inner, manager()); + } + }); + } + + @Override + public Observable listForScopeAsync(final String scope) { + DenyAssignmentsInner client = this.inner(); + return client.listForScopeAsync(scope) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public DenyAssignment call(DenyAssignmentInner inner) { + return new DenyAssignmentImpl(inner, manager()); + } + }); + } + +} diff --git a/authorization/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/authorization/v2018_07_01_preview/implementation/DenyAssignmentsInner.java b/authorization/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/authorization/v2018_07_01_preview/implementation/DenyAssignmentsInner.java new file mode 100644 index 000000000000..88200028e43d --- /dev/null +++ b/authorization/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/authorization/v2018_07_01_preview/implementation/DenyAssignmentsInner.java @@ -0,0 +1,1664 @@ +/** + * 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.v2018_07_01_preview.implementation; + +import com.microsoft.azure.arm.collection.InnerSupportsListing; +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.CloudException; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import 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.Path; +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 DenyAssignments. + */ +public class DenyAssignmentsInner implements InnerSupportsListing { + /** The Retrofit service to perform REST calls. */ + private DenyAssignmentsService service; + /** The service client containing this operation class. */ + private AuthorizationManagementClientImpl client; + + /** + * Initializes an instance of DenyAssignmentsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public DenyAssignmentsInner(Retrofit retrofit, AuthorizationManagementClientImpl client) { + this.service = retrofit.create(DenyAssignmentsService.class); + this.client = client; + } + + /** + * The interface defining all the services for DenyAssignments to be + * used by Retrofit to perform actually REST calls. + */ + interface DenyAssignmentsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.authorization.v2018_07_01_preview.DenyAssignments listForResource" }) + @GET("subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}/providers/Microsoft.Authorization/denyAssignments") + Observable> listForResource(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("resourceProviderNamespace") String resourceProviderNamespace, @Path(value = "parentResourcePath", encoded = true) String parentResourcePath, @Path(value = "resourceType", encoded = true) String resourceType, @Path("resourceName") String resourceName, @Query("api-version") String apiVersion, @Query("$filter") String filter, @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.authorization.v2018_07_01_preview.DenyAssignments listByResourceGroup" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Authorization/denyAssignments") + Observable> listByResourceGroup(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Query("api-version") String apiVersion, @Query("$filter") String filter, @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.authorization.v2018_07_01_preview.DenyAssignments list" }) + @GET("subscriptions/{subscriptionId}/providers/Microsoft.Authorization/denyAssignments") + Observable> list(@Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Query("$filter") String filter, @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.authorization.v2018_07_01_preview.DenyAssignments get" }) + @GET("{scope}/providers/Microsoft.Authorization/denyAssignments/{denyAssignmentId}") + Observable> get(@Path(value = "scope", encoded = true) String scope, @Path("denyAssignmentId") String denyAssignmentId, @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.authorization.v2018_07_01_preview.DenyAssignments getById" }) + @GET("{denyAssignmentId}") + Observable> getById(@Path(value = "denyAssignmentId", encoded = true) String denyAssignmentId, @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.authorization.v2018_07_01_preview.DenyAssignments listForScope" }) + @GET("{scope}/providers/Microsoft.Authorization/denyAssignments") + Observable> listForScope(@Path(value = "scope", encoded = true) String scope, @Query("api-version") String apiVersion, @Query("$filter") String filter, @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.authorization.v2018_07_01_preview.DenyAssignments listForResourceNext" }) + @GET + Observable> listForResourceNext(@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.authorization.v2018_07_01_preview.DenyAssignments listByResourceGroupNext" }) + @GET + Observable> listByResourceGroupNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.authorization.v2018_07_01_preview.DenyAssignments 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.authorization.v2018_07_01_preview.DenyAssignments listForScopeNext" }) + @GET + Observable> listForScopeNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Gets deny assignments for a resource. + * + * @param resourceGroupName The name of the resource group. + * @param resourceProviderNamespace The namespace of the resource provider. + * @param parentResourcePath The parent resource identity. + * @param resourceType The resource type of the resource. + * @param resourceName The name of the resource to get deny assignments for. + * @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<DenyAssignmentInner> object if successful. + */ + public PagedList listForResource(final String resourceGroupName, final String resourceProviderNamespace, final String parentResourcePath, final String resourceType, final String resourceName) { + ServiceResponse> response = listForResourceSinglePageAsync(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listForResourceNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets deny assignments for a resource. + * + * @param resourceGroupName The name of the resource group. + * @param resourceProviderNamespace The namespace of the resource provider. + * @param parentResourcePath The parent resource identity. + * @param resourceType The resource type of the resource. + * @param resourceName The name of the resource to get deny assignments for. + * @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> listForResourceAsync(final String resourceGroupName, final String resourceProviderNamespace, final String parentResourcePath, final String resourceType, final String resourceName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listForResourceSinglePageAsync(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listForResourceNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets deny assignments for a resource. + * + * @param resourceGroupName The name of the resource group. + * @param resourceProviderNamespace The namespace of the resource provider. + * @param parentResourcePath The parent resource identity. + * @param resourceType The resource type of the resource. + * @param resourceName The name of the resource to get deny assignments for. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<DenyAssignmentInner> object + */ + public Observable> listForResourceAsync(final String resourceGroupName, final String resourceProviderNamespace, final String parentResourcePath, final String resourceType, final String resourceName) { + return listForResourceWithServiceResponseAsync(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets deny assignments for a resource. + * + * @param resourceGroupName The name of the resource group. + * @param resourceProviderNamespace The namespace of the resource provider. + * @param parentResourcePath The parent resource identity. + * @param resourceType The resource type of the resource. + * @param resourceName The name of the resource to get deny assignments for. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<DenyAssignmentInner> object + */ + public Observable>> listForResourceWithServiceResponseAsync(final String resourceGroupName, final String resourceProviderNamespace, final String parentResourcePath, final String resourceType, final String resourceName) { + return listForResourceSinglePageAsync(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName) + .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(listForResourceNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets deny assignments for a resource. + * + * @param resourceGroupName The name of the resource group. + * @param resourceProviderNamespace The namespace of the resource provider. + * @param parentResourcePath The parent resource identity. + * @param resourceType The resource type of the resource. + * @param resourceName The name of the resource to get deny assignments for. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<DenyAssignmentInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listForResourceSinglePageAsync(final String resourceGroupName, final String resourceProviderNamespace, final String parentResourcePath, final String resourceType, final 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 (resourceProviderNamespace == null) { + throw new IllegalArgumentException("Parameter resourceProviderNamespace is required and cannot be null."); + } + if (parentResourcePath == null) { + throw new IllegalArgumentException("Parameter parentResourcePath is required and cannot be null."); + } + if (resourceType == null) { + throw new IllegalArgumentException("Parameter resourceType 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."); + } + final String filter = null; + return service.listForResource(this.client.subscriptionId(), resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, this.client.apiVersion(), filter, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listForResourceDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Gets deny assignments for a resource. + * + * @param resourceGroupName The name of the resource group. + * @param resourceProviderNamespace The namespace of the resource provider. + * @param parentResourcePath The parent resource identity. + * @param resourceType The resource type of the resource. + * @param resourceName The name of the resource to get deny assignments for. + * @param filter The filter to apply on the operation. Use $filter=atScope() to return all deny assignments at or above the scope. Use $filter=denyAssignmentName eq '{name}' to search deny assignments by name at specified scope. Use $filter=principalId eq '{id}' to return all deny assignments at, above and below the scope for the specified principal. Use $filter=gdprExportPrincipalId eq '{id}' to return all deny assignments at, above and below the scope for the specified principal. This filter is different from the principalId filter as it returns not only those deny assignments that contain the specified principal is the Principals list but also those deny assignments that contain the specified principal is the ExcludePrincipals list. Additionally, when gdprExportPrincipalId filter is used, only the deny assignment name and description properties are returned. + * @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<DenyAssignmentInner> object if successful. + */ + public PagedList listForResource(final String resourceGroupName, final String resourceProviderNamespace, final String parentResourcePath, final String resourceType, final String resourceName, final String filter) { + ServiceResponse> response = listForResourceSinglePageAsync(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, filter).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listForResourceNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets deny assignments for a resource. + * + * @param resourceGroupName The name of the resource group. + * @param resourceProviderNamespace The namespace of the resource provider. + * @param parentResourcePath The parent resource identity. + * @param resourceType The resource type of the resource. + * @param resourceName The name of the resource to get deny assignments for. + * @param filter The filter to apply on the operation. Use $filter=atScope() to return all deny assignments at or above the scope. Use $filter=denyAssignmentName eq '{name}' to search deny assignments by name at specified scope. Use $filter=principalId eq '{id}' to return all deny assignments at, above and below the scope for the specified principal. Use $filter=gdprExportPrincipalId eq '{id}' to return all deny assignments at, above and below the scope for the specified principal. This filter is different from the principalId filter as it returns not only those deny assignments that contain the specified principal is the Principals list but also those deny assignments that contain the specified principal is the ExcludePrincipals list. Additionally, when gdprExportPrincipalId filter is used, only the deny assignment name and description properties are returned. + * @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> listForResourceAsync(final String resourceGroupName, final String resourceProviderNamespace, final String parentResourcePath, final String resourceType, final String resourceName, final String filter, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listForResourceSinglePageAsync(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, filter), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listForResourceNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets deny assignments for a resource. + * + * @param resourceGroupName The name of the resource group. + * @param resourceProviderNamespace The namespace of the resource provider. + * @param parentResourcePath The parent resource identity. + * @param resourceType The resource type of the resource. + * @param resourceName The name of the resource to get deny assignments for. + * @param filter The filter to apply on the operation. Use $filter=atScope() to return all deny assignments at or above the scope. Use $filter=denyAssignmentName eq '{name}' to search deny assignments by name at specified scope. Use $filter=principalId eq '{id}' to return all deny assignments at, above and below the scope for the specified principal. Use $filter=gdprExportPrincipalId eq '{id}' to return all deny assignments at, above and below the scope for the specified principal. This filter is different from the principalId filter as it returns not only those deny assignments that contain the specified principal is the Principals list but also those deny assignments that contain the specified principal is the ExcludePrincipals list. Additionally, when gdprExportPrincipalId filter is used, only the deny assignment name and description properties are returned. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<DenyAssignmentInner> object + */ + public Observable> listForResourceAsync(final String resourceGroupName, final String resourceProviderNamespace, final String parentResourcePath, final String resourceType, final String resourceName, final String filter) { + return listForResourceWithServiceResponseAsync(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, filter) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets deny assignments for a resource. + * + * @param resourceGroupName The name of the resource group. + * @param resourceProviderNamespace The namespace of the resource provider. + * @param parentResourcePath The parent resource identity. + * @param resourceType The resource type of the resource. + * @param resourceName The name of the resource to get deny assignments for. + * @param filter The filter to apply on the operation. Use $filter=atScope() to return all deny assignments at or above the scope. Use $filter=denyAssignmentName eq '{name}' to search deny assignments by name at specified scope. Use $filter=principalId eq '{id}' to return all deny assignments at, above and below the scope for the specified principal. Use $filter=gdprExportPrincipalId eq '{id}' to return all deny assignments at, above and below the scope for the specified principal. This filter is different from the principalId filter as it returns not only those deny assignments that contain the specified principal is the Principals list but also those deny assignments that contain the specified principal is the ExcludePrincipals list. Additionally, when gdprExportPrincipalId filter is used, only the deny assignment name and description properties are returned. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<DenyAssignmentInner> object + */ + public Observable>> listForResourceWithServiceResponseAsync(final String resourceGroupName, final String resourceProviderNamespace, final String parentResourcePath, final String resourceType, final String resourceName, final String filter) { + return listForResourceSinglePageAsync(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, filter) + .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(listForResourceNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets deny assignments for a resource. + * + ServiceResponse> * @param resourceGroupName The name of the resource group. + ServiceResponse> * @param resourceProviderNamespace The namespace of the resource provider. + ServiceResponse> * @param parentResourcePath The parent resource identity. + ServiceResponse> * @param resourceType The resource type of the resource. + ServiceResponse> * @param resourceName The name of the resource to get deny assignments for. + ServiceResponse> * @param filter The filter to apply on the operation. Use $filter=atScope() to return all deny assignments at or above the scope. Use $filter=denyAssignmentName eq '{name}' to search deny assignments by name at specified scope. Use $filter=principalId eq '{id}' to return all deny assignments at, above and below the scope for the specified principal. Use $filter=gdprExportPrincipalId eq '{id}' to return all deny assignments at, above and below the scope for the specified principal. This filter is different from the principalId filter as it returns not only those deny assignments that contain the specified principal is the Principals list but also those deny assignments that contain the specified principal is the ExcludePrincipals list. Additionally, when gdprExportPrincipalId filter is used, only the deny assignment name and description properties are returned. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<DenyAssignmentInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listForResourceSinglePageAsync(final String resourceGroupName, final String resourceProviderNamespace, final String parentResourcePath, final String resourceType, final String resourceName, final String filter) { + 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 (resourceProviderNamespace == null) { + throw new IllegalArgumentException("Parameter resourceProviderNamespace is required and cannot be null."); + } + if (parentResourcePath == null) { + throw new IllegalArgumentException("Parameter parentResourcePath is required and cannot be null."); + } + if (resourceType == null) { + throw new IllegalArgumentException("Parameter resourceType 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.listForResource(this.client.subscriptionId(), resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, this.client.apiVersion(), filter, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listForResourceDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listForResourceDelegate(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); + } + + /** + * Gets deny assignments for a resource group. + * + * @param resourceGroupName The name of the resource group. + * @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<DenyAssignmentInner> 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(); + } + }; + } + + /** + * Gets deny assignments for a resource group. + * + * @param resourceGroupName The name of the resource group. + * @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); + } + + /** + * Gets deny assignments for a resource group. + * + * @param resourceGroupName The name of the resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<DenyAssignmentInner> object + */ + public Observable> listByResourceGroupAsync(final String resourceGroupName) { + return listByResourceGroupWithServiceResponseAsync(resourceGroupName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets deny assignments for a resource group. + * + * @param resourceGroupName The name of the resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<DenyAssignmentInner> 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)); + } + }); + } + + /** + * Gets deny assignments for a resource group. + * + * @param resourceGroupName The name of the resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<DenyAssignmentInner> 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."); + } + final String filter = null; + return service.listByResourceGroup(this.client.subscriptionId(), resourceGroupName, this.client.apiVersion(), filter, 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); + } + } + }); + } + + /** + * Gets deny assignments for a resource group. + * + * @param resourceGroupName The name of the resource group. + * @param filter The filter to apply on the operation. Use $filter=atScope() to return all deny assignments at or above the scope. Use $filter=denyAssignmentName eq '{name}' to search deny assignments by name at specified scope. Use $filter=principalId eq '{id}' to return all deny assignments at, above and below the scope for the specified principal. Use $filter=gdprExportPrincipalId eq '{id}' to return all deny assignments at, above and below the scope for the specified principal. This filter is different from the principalId filter as it returns not only those deny assignments that contain the specified principal is the Principals list but also those deny assignments that contain the specified principal is the ExcludePrincipals list. Additionally, when gdprExportPrincipalId filter is used, only the deny assignment name and description properties are returned. + * @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<DenyAssignmentInner> object if successful. + */ + public PagedList listByResourceGroup(final String resourceGroupName, final String filter) { + ServiceResponse> response = listByResourceGroupSinglePageAsync(resourceGroupName, filter).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByResourceGroupNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets deny assignments for a resource group. + * + * @param resourceGroupName The name of the resource group. + * @param filter The filter to apply on the operation. Use $filter=atScope() to return all deny assignments at or above the scope. Use $filter=denyAssignmentName eq '{name}' to search deny assignments by name at specified scope. Use $filter=principalId eq '{id}' to return all deny assignments at, above and below the scope for the specified principal. Use $filter=gdprExportPrincipalId eq '{id}' to return all deny assignments at, above and below the scope for the specified principal. This filter is different from the principalId filter as it returns not only those deny assignments that contain the specified principal is the Principals list but also those deny assignments that contain the specified principal is the ExcludePrincipals list. Additionally, when gdprExportPrincipalId filter is used, only the deny assignment name and description properties are returned. + * @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 String filter, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByResourceGroupSinglePageAsync(resourceGroupName, filter), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByResourceGroupNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets deny assignments for a resource group. + * + * @param resourceGroupName The name of the resource group. + * @param filter The filter to apply on the operation. Use $filter=atScope() to return all deny assignments at or above the scope. Use $filter=denyAssignmentName eq '{name}' to search deny assignments by name at specified scope. Use $filter=principalId eq '{id}' to return all deny assignments at, above and below the scope for the specified principal. Use $filter=gdprExportPrincipalId eq '{id}' to return all deny assignments at, above and below the scope for the specified principal. This filter is different from the principalId filter as it returns not only those deny assignments that contain the specified principal is the Principals list but also those deny assignments that contain the specified principal is the ExcludePrincipals list. Additionally, when gdprExportPrincipalId filter is used, only the deny assignment name and description properties are returned. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<DenyAssignmentInner> object + */ + public Observable> listByResourceGroupAsync(final String resourceGroupName, final String filter) { + return listByResourceGroupWithServiceResponseAsync(resourceGroupName, filter) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets deny assignments for a resource group. + * + * @param resourceGroupName The name of the resource group. + * @param filter The filter to apply on the operation. Use $filter=atScope() to return all deny assignments at or above the scope. Use $filter=denyAssignmentName eq '{name}' to search deny assignments by name at specified scope. Use $filter=principalId eq '{id}' to return all deny assignments at, above and below the scope for the specified principal. Use $filter=gdprExportPrincipalId eq '{id}' to return all deny assignments at, above and below the scope for the specified principal. This filter is different from the principalId filter as it returns not only those deny assignments that contain the specified principal is the Principals list but also those deny assignments that contain the specified principal is the ExcludePrincipals list. Additionally, when gdprExportPrincipalId filter is used, only the deny assignment name and description properties are returned. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<DenyAssignmentInner> object + */ + public Observable>> listByResourceGroupWithServiceResponseAsync(final String resourceGroupName, final String filter) { + return listByResourceGroupSinglePageAsync(resourceGroupName, filter) + .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)); + } + }); + } + + /** + * Gets deny assignments for a resource group. + * + ServiceResponse> * @param resourceGroupName The name of the resource group. + ServiceResponse> * @param filter The filter to apply on the operation. Use $filter=atScope() to return all deny assignments at or above the scope. Use $filter=denyAssignmentName eq '{name}' to search deny assignments by name at specified scope. Use $filter=principalId eq '{id}' to return all deny assignments at, above and below the scope for the specified principal. Use $filter=gdprExportPrincipalId eq '{id}' to return all deny assignments at, above and below the scope for the specified principal. This filter is different from the principalId filter as it returns not only those deny assignments that contain the specified principal is the Principals list but also those deny assignments that contain the specified principal is the ExcludePrincipals list. Additionally, when gdprExportPrincipalId filter is used, only the deny assignment name and description properties are returned. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<DenyAssignmentInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByResourceGroupSinglePageAsync(final String resourceGroupName, final String filter) { + 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(), filter, 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); + } + + /** + * Gets all deny assignments for the 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<DenyAssignmentInner> 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(); + } + }; + } + + /** + * Gets all deny assignments for the 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); + } + + /** + * Gets all deny assignments for the subscription. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<DenyAssignmentInner> object + */ + public Observable> listAsync() { + return listWithServiceResponseAsync() + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets all deny assignments for the subscription. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<DenyAssignmentInner> 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)); + } + }); + } + + /** + * Gets all deny assignments for the subscription. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<DenyAssignmentInner> 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."); + } + final String filter = null; + return service.list(this.client.subscriptionId(), this.client.apiVersion(), filter, 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); + } + } + }); + } + + /** + * Gets all deny assignments for the subscription. + * + * @param filter The filter to apply on the operation. Use $filter=atScope() to return all deny assignments at or above the scope. Use $filter=denyAssignmentName eq '{name}' to search deny assignments by name at specified scope. Use $filter=principalId eq '{id}' to return all deny assignments at, above and below the scope for the specified principal. Use $filter=gdprExportPrincipalId eq '{id}' to return all deny assignments at, above and below the scope for the specified principal. This filter is different from the principalId filter as it returns not only those deny assignments that contain the specified principal is the Principals list but also those deny assignments that contain the specified principal is the ExcludePrincipals list. Additionally, when gdprExportPrincipalId filter is used, only the deny assignment name and description properties are returned. + * @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<DenyAssignmentInner> object if successful. + */ + public PagedList list(final String filter) { + ServiceResponse> response = listSinglePageAsync(filter).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets all deny assignments for the subscription. + * + * @param filter The filter to apply on the operation. Use $filter=atScope() to return all deny assignments at or above the scope. Use $filter=denyAssignmentName eq '{name}' to search deny assignments by name at specified scope. Use $filter=principalId eq '{id}' to return all deny assignments at, above and below the scope for the specified principal. Use $filter=gdprExportPrincipalId eq '{id}' to return all deny assignments at, above and below the scope for the specified principal. This filter is different from the principalId filter as it returns not only those deny assignments that contain the specified principal is the Principals list but also those deny assignments that contain the specified principal is the ExcludePrincipals list. Additionally, when gdprExportPrincipalId filter is used, only the deny assignment name and description properties are returned. + * @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 String filter, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(filter), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets all deny assignments for the subscription. + * + * @param filter The filter to apply on the operation. Use $filter=atScope() to return all deny assignments at or above the scope. Use $filter=denyAssignmentName eq '{name}' to search deny assignments by name at specified scope. Use $filter=principalId eq '{id}' to return all deny assignments at, above and below the scope for the specified principal. Use $filter=gdprExportPrincipalId eq '{id}' to return all deny assignments at, above and below the scope for the specified principal. This filter is different from the principalId filter as it returns not only those deny assignments that contain the specified principal is the Principals list but also those deny assignments that contain the specified principal is the ExcludePrincipals list. Additionally, when gdprExportPrincipalId filter is used, only the deny assignment name and description properties are returned. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<DenyAssignmentInner> object + */ + public Observable> listAsync(final String filter) { + return listWithServiceResponseAsync(filter) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets all deny assignments for the subscription. + * + * @param filter The filter to apply on the operation. Use $filter=atScope() to return all deny assignments at or above the scope. Use $filter=denyAssignmentName eq '{name}' to search deny assignments by name at specified scope. Use $filter=principalId eq '{id}' to return all deny assignments at, above and below the scope for the specified principal. Use $filter=gdprExportPrincipalId eq '{id}' to return all deny assignments at, above and below the scope for the specified principal. This filter is different from the principalId filter as it returns not only those deny assignments that contain the specified principal is the Principals list but also those deny assignments that contain the specified principal is the ExcludePrincipals list. Additionally, when gdprExportPrincipalId filter is used, only the deny assignment name and description properties are returned. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<DenyAssignmentInner> object + */ + public Observable>> listWithServiceResponseAsync(final String filter) { + return listSinglePageAsync(filter) + .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)); + } + }); + } + + /** + * Gets all deny assignments for the subscription. + * + ServiceResponse> * @param filter The filter to apply on the operation. Use $filter=atScope() to return all deny assignments at or above the scope. Use $filter=denyAssignmentName eq '{name}' to search deny assignments by name at specified scope. Use $filter=principalId eq '{id}' to return all deny assignments at, above and below the scope for the specified principal. Use $filter=gdprExportPrincipalId eq '{id}' to return all deny assignments at, above and below the scope for the specified principal. This filter is different from the principalId filter as it returns not only those deny assignments that contain the specified principal is the Principals list but also those deny assignments that contain the specified principal is the ExcludePrincipals list. Additionally, when gdprExportPrincipalId filter is used, only the deny assignment name and description properties are returned. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<DenyAssignmentInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync(final String filter) { + 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(), filter, 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); + } + + /** + * Get the specified deny assignment. + * + * @param scope The scope of the deny assignment. + * @param denyAssignmentId The ID of the deny assignment to get. + * @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 DenyAssignmentInner object if successful. + */ + public DenyAssignmentInner get(String scope, String denyAssignmentId) { + return getWithServiceResponseAsync(scope, denyAssignmentId).toBlocking().single().body(); + } + + /** + * Get the specified deny assignment. + * + * @param scope The scope of the deny assignment. + * @param denyAssignmentId The ID of the deny assignment to get. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getAsync(String scope, String denyAssignmentId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(scope, denyAssignmentId), serviceCallback); + } + + /** + * Get the specified deny assignment. + * + * @param scope The scope of the deny assignment. + * @param denyAssignmentId The ID of the deny assignment to get. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DenyAssignmentInner object + */ + public Observable getAsync(String scope, String denyAssignmentId) { + return getWithServiceResponseAsync(scope, denyAssignmentId).map(new Func1, DenyAssignmentInner>() { + @Override + public DenyAssignmentInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Get the specified deny assignment. + * + * @param scope The scope of the deny assignment. + * @param denyAssignmentId The ID of the deny assignment to get. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DenyAssignmentInner object + */ + public Observable> getWithServiceResponseAsync(String scope, String denyAssignmentId) { + if (scope == null) { + throw new IllegalArgumentException("Parameter scope is required and cannot be null."); + } + if (denyAssignmentId == null) { + throw new IllegalArgumentException("Parameter denyAssignmentId 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.get(scope, denyAssignmentId, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getDelegate(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 a deny assignment by ID. + * + * @param denyAssignmentId The fully qualified deny assignment ID. For example, use the format, /subscriptions/{guid}/providers/Microsoft.Authorization/denyAssignments/{denyAssignmentId} for subscription level deny assignments, or /providers/Microsoft.Authorization/denyAssignments/{denyAssignmentId} for tenant level deny assignments. + * @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 DenyAssignmentInner object if successful. + */ + public DenyAssignmentInner getById(String denyAssignmentId) { + return getByIdWithServiceResponseAsync(denyAssignmentId).toBlocking().single().body(); + } + + /** + * Gets a deny assignment by ID. + * + * @param denyAssignmentId The fully qualified deny assignment ID. For example, use the format, /subscriptions/{guid}/providers/Microsoft.Authorization/denyAssignments/{denyAssignmentId} for subscription level deny assignments, or /providers/Microsoft.Authorization/denyAssignments/{denyAssignmentId} for tenant level deny assignments. + * @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 getByIdAsync(String denyAssignmentId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getByIdWithServiceResponseAsync(denyAssignmentId), serviceCallback); + } + + /** + * Gets a deny assignment by ID. + * + * @param denyAssignmentId The fully qualified deny assignment ID. For example, use the format, /subscriptions/{guid}/providers/Microsoft.Authorization/denyAssignments/{denyAssignmentId} for subscription level deny assignments, or /providers/Microsoft.Authorization/denyAssignments/{denyAssignmentId} for tenant level deny assignments. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DenyAssignmentInner object + */ + public Observable getByIdAsync(String denyAssignmentId) { + return getByIdWithServiceResponseAsync(denyAssignmentId).map(new Func1, DenyAssignmentInner>() { + @Override + public DenyAssignmentInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets a deny assignment by ID. + * + * @param denyAssignmentId The fully qualified deny assignment ID. For example, use the format, /subscriptions/{guid}/providers/Microsoft.Authorization/denyAssignments/{denyAssignmentId} for subscription level deny assignments, or /providers/Microsoft.Authorization/denyAssignments/{denyAssignmentId} for tenant level deny assignments. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DenyAssignmentInner object + */ + public Observable> getByIdWithServiceResponseAsync(String denyAssignmentId) { + if (denyAssignmentId == null) { + throw new IllegalArgumentException("Parameter denyAssignmentId 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.getById(denyAssignmentId, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getByIdDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getByIdDelegate(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 deny assignments for a scope. + * + * @param scope The scope of the deny assignments. + * @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<DenyAssignmentInner> object if successful. + */ + public PagedList listForScope(final String scope) { + ServiceResponse> response = listForScopeSinglePageAsync(scope).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listForScopeNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets deny assignments for a scope. + * + * @param scope The scope of the deny assignments. + * @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> listForScopeAsync(final String scope, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listForScopeSinglePageAsync(scope), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listForScopeNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets deny assignments for a scope. + * + * @param scope The scope of the deny assignments. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<DenyAssignmentInner> object + */ + public Observable> listForScopeAsync(final String scope) { + return listForScopeWithServiceResponseAsync(scope) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets deny assignments for a scope. + * + * @param scope The scope of the deny assignments. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<DenyAssignmentInner> object + */ + public Observable>> listForScopeWithServiceResponseAsync(final String scope) { + return listForScopeSinglePageAsync(scope) + .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(listForScopeNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets deny assignments for a scope. + * + * @param scope The scope of the deny assignments. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<DenyAssignmentInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listForScopeSinglePageAsync(final 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."); + } + final String filter = null; + return service.listForScope(scope, this.client.apiVersion(), filter, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listForScopeDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Gets deny assignments for a scope. + * + * @param scope The scope of the deny assignments. + * @param filter The filter to apply on the operation. Use $filter=atScope() to return all deny assignments at or above the scope. Use $filter=denyAssignmentName eq '{name}' to search deny assignments by name at specified scope. Use $filter=principalId eq '{id}' to return all deny assignments at, above and below the scope for the specified principal. Use $filter=gdprExportPrincipalId eq '{id}' to return all deny assignments at, above and below the scope for the specified principal. This filter is different from the principalId filter as it returns not only those deny assignments that contain the specified principal is the Principals list but also those deny assignments that contain the specified principal is the ExcludePrincipals list. Additionally, when gdprExportPrincipalId filter is used, only the deny assignment name and description properties are returned. + * @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<DenyAssignmentInner> object if successful. + */ + public PagedList listForScope(final String scope, final String filter) { + ServiceResponse> response = listForScopeSinglePageAsync(scope, filter).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listForScopeNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets deny assignments for a scope. + * + * @param scope The scope of the deny assignments. + * @param filter The filter to apply on the operation. Use $filter=atScope() to return all deny assignments at or above the scope. Use $filter=denyAssignmentName eq '{name}' to search deny assignments by name at specified scope. Use $filter=principalId eq '{id}' to return all deny assignments at, above and below the scope for the specified principal. Use $filter=gdprExportPrincipalId eq '{id}' to return all deny assignments at, above and below the scope for the specified principal. This filter is different from the principalId filter as it returns not only those deny assignments that contain the specified principal is the Principals list but also those deny assignments that contain the specified principal is the ExcludePrincipals list. Additionally, when gdprExportPrincipalId filter is used, only the deny assignment name and description properties are returned. + * @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> listForScopeAsync(final String scope, final String filter, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listForScopeSinglePageAsync(scope, filter), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listForScopeNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets deny assignments for a scope. + * + * @param scope The scope of the deny assignments. + * @param filter The filter to apply on the operation. Use $filter=atScope() to return all deny assignments at or above the scope. Use $filter=denyAssignmentName eq '{name}' to search deny assignments by name at specified scope. Use $filter=principalId eq '{id}' to return all deny assignments at, above and below the scope for the specified principal. Use $filter=gdprExportPrincipalId eq '{id}' to return all deny assignments at, above and below the scope for the specified principal. This filter is different from the principalId filter as it returns not only those deny assignments that contain the specified principal is the Principals list but also those deny assignments that contain the specified principal is the ExcludePrincipals list. Additionally, when gdprExportPrincipalId filter is used, only the deny assignment name and description properties are returned. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<DenyAssignmentInner> object + */ + public Observable> listForScopeAsync(final String scope, final String filter) { + return listForScopeWithServiceResponseAsync(scope, filter) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets deny assignments for a scope. + * + * @param scope The scope of the deny assignments. + * @param filter The filter to apply on the operation. Use $filter=atScope() to return all deny assignments at or above the scope. Use $filter=denyAssignmentName eq '{name}' to search deny assignments by name at specified scope. Use $filter=principalId eq '{id}' to return all deny assignments at, above and below the scope for the specified principal. Use $filter=gdprExportPrincipalId eq '{id}' to return all deny assignments at, above and below the scope for the specified principal. This filter is different from the principalId filter as it returns not only those deny assignments that contain the specified principal is the Principals list but also those deny assignments that contain the specified principal is the ExcludePrincipals list. Additionally, when gdprExportPrincipalId filter is used, only the deny assignment name and description properties are returned. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<DenyAssignmentInner> object + */ + public Observable>> listForScopeWithServiceResponseAsync(final String scope, final String filter) { + return listForScopeSinglePageAsync(scope, filter) + .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(listForScopeNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets deny assignments for a scope. + * + ServiceResponse> * @param scope The scope of the deny assignments. + ServiceResponse> * @param filter The filter to apply on the operation. Use $filter=atScope() to return all deny assignments at or above the scope. Use $filter=denyAssignmentName eq '{name}' to search deny assignments by name at specified scope. Use $filter=principalId eq '{id}' to return all deny assignments at, above and below the scope for the specified principal. Use $filter=gdprExportPrincipalId eq '{id}' to return all deny assignments at, above and below the scope for the specified principal. This filter is different from the principalId filter as it returns not only those deny assignments that contain the specified principal is the Principals list but also those deny assignments that contain the specified principal is the ExcludePrincipals list. Additionally, when gdprExportPrincipalId filter is used, only the deny assignment name and description properties are returned. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<DenyAssignmentInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listForScopeSinglePageAsync(final String scope, final String filter) { + 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.listForScope(scope, this.client.apiVersion(), filter, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listForScopeDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listForScopeDelegate(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); + } + + /** + * Gets deny assignments for a resource. + * + * @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<DenyAssignmentInner> object if successful. + */ + public PagedList listForResourceNext(final String nextPageLink) { + ServiceResponse> response = listForResourceNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listForResourceNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets deny assignments for a resource. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listForResourceNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listForResourceNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listForResourceNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets deny assignments for a resource. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<DenyAssignmentInner> object + */ + public Observable> listForResourceNextAsync(final String nextPageLink) { + return listForResourceNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets deny assignments for a resource. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<DenyAssignmentInner> object + */ + public Observable>> listForResourceNextWithServiceResponseAsync(final String nextPageLink) { + return listForResourceNextSinglePageAsync(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(listForResourceNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets deny assignments for a resource. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<DenyAssignmentInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listForResourceNextSinglePageAsync(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.listForResourceNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listForResourceNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listForResourceNextDelegate(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); + } + + /** + * Gets deny assignments for a resource group. + * + * @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<DenyAssignmentInner> 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(); + } + }; + } + + /** + * Gets deny assignments for a resource group. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByResourceGroupNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByResourceGroupNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByResourceGroupNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets deny assignments for a resource group. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<DenyAssignmentInner> object + */ + public Observable> listByResourceGroupNextAsync(final String nextPageLink) { + return listByResourceGroupNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets deny assignments for a resource group. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<DenyAssignmentInner> 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)); + } + }); + } + + /** + * Gets deny assignments for a resource group. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<DenyAssignmentInner> 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); + } + + /** + * Gets all deny assignments for the 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<DenyAssignmentInner> 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(); + } + }; + } + + /** + * Gets all deny assignments for the 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); + } + + /** + * Gets all deny assignments for the 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<DenyAssignmentInner> object + */ + public Observable> listNextAsync(final String nextPageLink) { + return listNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets all deny assignments for the 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<DenyAssignmentInner> 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)); + } + }); + } + + /** + * Gets all deny assignments for the 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<DenyAssignmentInner> 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); + } + + /** + * Gets deny assignments for a scope. + * + * @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<DenyAssignmentInner> object if successful. + */ + public PagedList listForScopeNext(final String nextPageLink) { + ServiceResponse> response = listForScopeNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listForScopeNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets deny assignments for a scope. + * + * @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> listForScopeNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listForScopeNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listForScopeNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets deny assignments for a scope. + * + * @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<DenyAssignmentInner> object + */ + public Observable> listForScopeNextAsync(final String nextPageLink) { + return listForScopeNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets deny assignments for a scope. + * + * @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<DenyAssignmentInner> object + */ + public Observable>> listForScopeNextWithServiceResponseAsync(final String nextPageLink) { + return listForScopeNextSinglePageAsync(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(listForScopeNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets deny assignments for a scope. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<DenyAssignmentInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listForScopeNextSinglePageAsync(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.listForScopeNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listForScopeNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listForScopeNextDelegate(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/authorization/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/authorization/v2018_07_01_preview/implementation/IdParsingUtils.java b/authorization/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/authorization/v2018_07_01_preview/implementation/IdParsingUtils.java new file mode 100644 index 000000000000..d71729be7a7d --- /dev/null +++ b/authorization/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/authorization/v2018_07_01_preview/implementation/IdParsingUtils.java @@ -0,0 +1,57 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.authorization.v2018_07_01_preview.implementation; +import java.util.Arrays; +import java.util.Iterator; + +class IdParsingUtils { + public static String getValueFromIdByName(String id, String name) { + if (id == null) { + return null; + } + Iterable iterable = Arrays.asList(id.split("/")); + Iterator itr = iterable.iterator(); + while (itr.hasNext()) { + String part = itr.next(); + if (part != null && part.trim() != "") { + if (part.equalsIgnoreCase(name)) { + if (itr.hasNext()) { + return itr.next(); + } else { + return null; + } + } + } + } + return null; + } + + public static String getValueFromIdByPosition(String id, int pos) { + if (id == null) { + return null; + } + Iterable iterable = Arrays.asList(id.split("/")); + Iterator itr = iterable.iterator(); + int index = 0; + while (itr.hasNext()) { + String part = itr.next(); + if (part != null && part.trim() != "") { + if (index == pos) { + if (itr.hasNext()) { + return itr.next(); + } else { + return null; + } + } + } + index++; + } + return null; + } +} diff --git a/authorization/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/authorization/v2018_07_01_preview/implementation/PageImpl.java b/authorization/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/authorization/v2018_07_01_preview/implementation/PageImpl.java new file mode 100644 index 000000000000..e0e3d1ee124e --- /dev/null +++ b/authorization/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/authorization/v2018_07_01_preview/implementation/PageImpl.java @@ -0,0 +1,75 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.authorization.v2018_07_01_preview.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.azure.Page; +import java.util.List; + +/** + * An instance of this class defines a page of Azure resources and a link to + * get the next page of resources, if any. + * + * @param type of Azure resource + */ +public class PageImpl implements Page { + /** + * The link to the next page. + */ + @JsonProperty("nextLink") + private String nextPageLink; + + /** + * The list of items. + */ + @JsonProperty("value") + private List items; + + /** + * Gets the link to the next page. + * + * @return the link to the next page. + */ + @Override + public String nextPageLink() { + return this.nextPageLink; + } + + /** + * Gets the list of items. + * + * @return the list of items in {@link List}. + */ + @Override + public List items() { + return items; + } + + /** + * Sets the link to the next page. + * + * @param nextPageLink the link to the next page. + * @return this Page object itself. + */ + public PageImpl setNextPageLink(String nextPageLink) { + this.nextPageLink = nextPageLink; + return this; + } + + /** + * Sets the list of items. + * + * @param items the list of items in {@link List}. + * @return this Page object itself. + */ + public PageImpl setItems(List items) { + this.items = items; + return this; + } +} diff --git a/authorization/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/authorization/v2018_07_01_preview/implementation/package-info.java b/authorization/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/authorization/v2018_07_01_preview/implementation/package-info.java new file mode 100644 index 000000000000..27836831664e --- /dev/null +++ b/authorization/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/authorization/v2018_07_01_preview/implementation/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * This package contains the implementation classes for AuthorizationManagementClient. + * Role based access control provides you a way to apply granular level policy administration down to individual resources or resource groups. These operations enable you to get deny assignments. A deny assignment describes the set of actions on resources that are denied for Azure Active Directory users. + */ +package com.microsoft.azure.management.authorization.v2018_07_01_preview.implementation; diff --git a/authorization/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/authorization/v2018_07_01_preview/package-info.java b/authorization/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/authorization/v2018_07_01_preview/package-info.java new file mode 100644 index 000000000000..defb43dccddd --- /dev/null +++ b/authorization/resource-manager/v2018_07_01_preview/src/main/java/com/microsoft/azure/management/authorization/v2018_07_01_preview/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * This package contains the classes for AuthorizationManagementClient. + * Role based access control provides you a way to apply granular level policy administration down to individual resources or resource groups. These operations enable you to get deny assignments. A deny assignment describes the set of actions on resources that are denied for Azure Active Directory users. + */ +package com.microsoft.azure.management.authorization.v2018_07_01_preview; diff --git a/authorization/resource-manager/v2018_09_01_preview/pom.xml b/authorization/resource-manager/v2018_09_01_preview/pom.xml index 5eaac785ccca..eead0045b627 100644 --- a/authorization/resource-manager/v2018_09_01_preview/pom.xml +++ b/authorization/resource-manager/v2018_09_01_preview/pom.xml @@ -11,7 +11,7 @@ com.microsoft.azure azure-arm-parent - 1.0.0 + 0.0.3-beta ../../../pom.xml azure-mgmt-authorization diff --git a/authorization/resource-manager/v2018_09_01_preview/src/main/java/com/microsoft/azure/management/authorization/v2018_09_01_preview/GlobalAdministrators.java b/authorization/resource-manager/v2018_09_01_preview/src/main/java/com/microsoft/azure/management/authorization/v2018_09_01_preview/GlobalAdministrators.java new file mode 100644 index 000000000000..4bf1fe25f1ff --- /dev/null +++ b/authorization/resource-manager/v2018_09_01_preview/src/main/java/com/microsoft/azure/management/authorization/v2018_09_01_preview/GlobalAdministrators.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.v2018_09_01_preview; + +import rx.Completable; +import com.microsoft.azure.management.authorization.v2018_09_01_preview.implementation.GlobalAdministratorsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing GlobalAdministrators. + */ +public interface GlobalAdministrators extends HasInner { + /** + * Elevates access for a Global Administrator. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable elevateAccessAsync(); + +} 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/AuthorizationManagementClientImpl.java b/authorization/resource-manager/v2018_09_01_preview/src/main/java/com/microsoft/azure/management/authorization/v2018_09_01_preview/implementation/AuthorizationManagementClientImpl.java index 77a355297867..5887eabc2fce 100644 --- a/authorization/resource-manager/v2018_09_01_preview/src/main/java/com/microsoft/azure/management/authorization/v2018_09_01_preview/implementation/AuthorizationManagementClientImpl.java +++ b/authorization/resource-manager/v2018_09_01_preview/src/main/java/com/microsoft/azure/management/authorization/v2018_09_01_preview/implementation/AuthorizationManagementClientImpl.java @@ -133,6 +133,19 @@ public ClassicAdministratorsInner classicAdministrators() { return this.classicAdministrators; } + /** + * The GlobalAdministratorsInner object to access its operations. + */ + private GlobalAdministratorsInner globalAdministrators; + + /** + * Gets the GlobalAdministratorsInner object to access its operations. + * @return the GlobalAdministratorsInner object. + */ + public GlobalAdministratorsInner globalAdministrators() { + return this.globalAdministrators; + } + /** * The ProviderOperationsMetadatasInner object to access its operations. */ @@ -233,6 +246,7 @@ protected void initialize() { this.longRunningOperationRetryTimeout = 30; this.generateClientRequestId = true; this.classicAdministrators = new ClassicAdministratorsInner(restClient().retrofit(), this); + this.globalAdministrators = new GlobalAdministratorsInner(restClient().retrofit(), this); this.providerOperationsMetadatas = new ProviderOperationsMetadatasInner(restClient().retrofit(), this); this.roleAssignments = new RoleAssignmentsInner(restClient().retrofit(), this); this.permissions = new PermissionsInner(restClient().retrofit(), this); diff --git a/authorization/resource-manager/v2018_09_01_preview/src/main/java/com/microsoft/azure/management/authorization/v2018_09_01_preview/implementation/AuthorizationManager.java b/authorization/resource-manager/v2018_09_01_preview/src/main/java/com/microsoft/azure/management/authorization/v2018_09_01_preview/implementation/AuthorizationManager.java index cdf0e699de2b..0d8807f177e9 100644 --- a/authorization/resource-manager/v2018_09_01_preview/src/main/java/com/microsoft/azure/management/authorization/v2018_09_01_preview/implementation/AuthorizationManager.java +++ b/authorization/resource-manager/v2018_09_01_preview/src/main/java/com/microsoft/azure/management/authorization/v2018_09_01_preview/implementation/AuthorizationManager.java @@ -17,6 +17,7 @@ import com.microsoft.azure.serializer.AzureJacksonAdapter; import com.microsoft.rest.RestClient; import com.microsoft.azure.management.authorization.v2018_09_01_preview.ClassicAdministrators; +import com.microsoft.azure.management.authorization.v2018_09_01_preview.GlobalAdministrators; import com.microsoft.azure.management.authorization.v2018_09_01_preview.ProviderOperationsMetadatas; import com.microsoft.azure.management.authorization.v2018_09_01_preview.RoleAssignments; import com.microsoft.azure.management.authorization.v2018_09_01_preview.Permissions; @@ -30,6 +31,7 @@ */ public final class AuthorizationManager extends ManagerCore { private ClassicAdministrators classicAdministrators; + private GlobalAdministrators globalAdministrators; private ProviderOperationsMetadatas providerOperationsMetadatas; private RoleAssignments roleAssignments; private Permissions permissions; @@ -92,6 +94,16 @@ public ClassicAdministrators classicAdministrators() { return this.classicAdministrators; } + /** + * @return Entry point to manage GlobalAdministrators. + */ + public GlobalAdministrators globalAdministrators() { + if (this.globalAdministrators == null) { + this.globalAdministrators = new GlobalAdministratorsImpl(this); + } + return this.globalAdministrators; + } + /** * @return Entry point to manage ProviderOperationsMetadatas. */ diff --git a/authorization/resource-manager/v2018_09_01_preview/src/main/java/com/microsoft/azure/management/authorization/v2018_09_01_preview/implementation/GlobalAdministratorsImpl.java b/authorization/resource-manager/v2018_09_01_preview/src/main/java/com/microsoft/azure/management/authorization/v2018_09_01_preview/implementation/GlobalAdministratorsImpl.java new file mode 100644 index 000000000000..7ab0f1d7bb08 --- /dev/null +++ b/authorization/resource-manager/v2018_09_01_preview/src/main/java/com/microsoft/azure/management/authorization/v2018_09_01_preview/implementation/GlobalAdministratorsImpl.java @@ -0,0 +1,34 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * abc + */ + +package com.microsoft.azure.management.authorization.v2018_09_01_preview.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.authorization.v2018_09_01_preview.GlobalAdministrators; +import rx.Completable; + +class GlobalAdministratorsImpl extends WrapperImpl implements GlobalAdministrators { + private final AuthorizationManager manager; + + GlobalAdministratorsImpl(AuthorizationManager manager) { + super(manager.inner().globalAdministrators()); + this.manager = manager; + } + + public AuthorizationManager manager() { + return this.manager; + } + + @Override + public Completable elevateAccessAsync() { + GlobalAdministratorsInner client = this.inner(); + return client.elevateAccessAsync().toCompletable(); + } + +} diff --git a/authorization/resource-manager/v2018_09_01_preview/src/main/java/com/microsoft/azure/management/authorization/v2018_09_01_preview/implementation/GlobalAdministratorsInner.java b/authorization/resource-manager/v2018_09_01_preview/src/main/java/com/microsoft/azure/management/authorization/v2018_09_01_preview/implementation/GlobalAdministratorsInner.java new file mode 100644 index 000000000000..8f7e0fbbf71d --- /dev/null +++ b/authorization/resource-manager/v2018_09_01_preview/src/main/java/com/microsoft/azure/management/authorization/v2018_09_01_preview/implementation/GlobalAdministratorsInner.java @@ -0,0 +1,125 @@ +/** + * 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.v2018_09_01_preview.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 GlobalAdministrators. + */ +public class GlobalAdministratorsInner { + /** The Retrofit service to perform REST calls. */ + private GlobalAdministratorsService service; + /** The service client containing this operation class. */ + private AuthorizationManagementClientImpl client; + + /** + * Initializes an instance of GlobalAdministratorsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public GlobalAdministratorsInner(Retrofit retrofit, AuthorizationManagementClientImpl client) { + this.service = retrofit.create(GlobalAdministratorsService.class); + this.client = client; + } + + /** + * The interface defining all the services for GlobalAdministrators to be + * used by Retrofit to perform actually REST calls. + */ + interface GlobalAdministratorsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.authorization.v2018_09_01_preview.GlobalAdministrators elevateAccess" }) + @POST("providers/Microsoft.Authorization/elevateAccess") + Observable> elevateAccess(@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 elevateAccess() { + elevateAccessWithServiceResponseAsync().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 elevateAccessAsync(final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(elevateAccessWithServiceResponseAsync(), serviceCallback); + } + + /** + * Elevates access for a Global Administrator. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable elevateAccessAsync() { + return elevateAccessWithServiceResponseAsync().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> elevateAccessWithServiceResponseAsync() { + final String apiVersion = "2015-07-01"; + return service.elevateAccess(apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = elevateAccessDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse elevateAccessDelegate(Response response) throws CloudException, IOException { + 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/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.