diff --git a/authorization/resource-manager/v2015_07_01/pom.xml b/authorization/resource-manager/v2015_07_01/pom.xml index 76d72a8b1c959..34e3ed9029030 100644 --- a/authorization/resource-manager/v2015_07_01/pom.xml +++ b/authorization/resource-manager/v2015_07_01/pom.xml @@ -1,133 +1,133 @@ - - - 4.0.0 - com.microsoft.azure.authorization.v2015_07_01 - - com.microsoft.azure - azure-arm-parent - 0.0.3-beta - ../../../pom.xml - - azure-mgmt-authorization - 1.0.0-beta-1 - jar - Microsoft Azure SDK for Authorization Management - This package contains Microsoft Authorization Management SDK. - https://github.com/Azure/azure-libraries-for-java - - - The MIT License (MIT) - http://opensource.org/licenses/MIT - repo - - - - scm:git:https://github.com/Azure/azure-libraries-for-java - scm:git:git@github.com:Azure/azure-libraries-for-java.git - HEAD - - - UTF-8 - - - - - microsoft - Microsoft - - - - - com.microsoft.azure - azure-client-runtime - - - com.microsoft.azure - azure-arm-client-runtime - - - junit - junit - test - - - com.microsoft.azure - azure-client-authentication - test - - - com.microsoft.azure - azure-mgmt-resources - test - - - com.microsoft.azure - azure-arm-client-runtime - test-jar - test - - - - - - org.apache.maven.plugins - maven-jar-plugin - - - - true - true - - - - - - org.codehaus.mojo - build-helper-maven-plugin - - - org.apache.maven.plugins - maven-compiler-plugin - 3.1 - - 1.7 - 1.7 - - - com.microsoft.azure.management.apigeneration.LangDefinitionProcessor - - - true - true - - true - true - - - - - org.apache.maven.plugins - maven-javadoc-plugin - 2.8 - - *.implementation.*;*.utils.*;com.microsoft.schemas._2003._10.serialization;*.blob.core.search - - - /** -
* Copyright (c) Microsoft Corporation. All rights reserved. -
* Licensed under the MIT License. See License.txt in the project root for -
* license information. -
*/ - ]]> -
-
-
-
-
-
+ + + 4.0.0 + com.microsoft.azure.authorization.v2015_07_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_07_01/src/main/java/com/microsoft/azure/management/authorization/v2015_07_01/ClassicAdministratorProperties.java b/authorization/resource-manager/v2015_07_01/src/main/java/com/microsoft/azure/management/authorization/v2015_07_01/ClassicAdministratorProperties.java index e3eb75781eceb..bff2c9f529d6b 100644 --- a/authorization/resource-manager/v2015_07_01/src/main/java/com/microsoft/azure/management/authorization/v2015_07_01/ClassicAdministratorProperties.java +++ b/authorization/resource-manager/v2015_07_01/src/main/java/com/microsoft/azure/management/authorization/v2015_07_01/ClassicAdministratorProperties.java @@ -27,7 +27,7 @@ public class ClassicAdministratorProperties { private String role; /** - * Get the emailAddress value. + * Get the email address of the administrator. * * @return the emailAddress value */ @@ -36,7 +36,7 @@ public String emailAddress() { } /** - * Set the emailAddress value. + * Set the email address of the administrator. * * @param emailAddress the emailAddress value to set * @return the ClassicAdministratorProperties object itself. @@ -47,7 +47,7 @@ public ClassicAdministratorProperties withEmailAddress(String emailAddress) { } /** - * Get the role value. + * Get the role of the administrator. * * @return the role value */ @@ -56,7 +56,7 @@ public String role() { } /** - * Set the role value. + * Set the role of the administrator. * * @param role the role value to set * @return the ClassicAdministratorProperties object itself. diff --git a/authorization/resource-manager/v2015_07_01/src/main/java/com/microsoft/azure/management/authorization/v2015_07_01/ProviderOperation.java b/authorization/resource-manager/v2015_07_01/src/main/java/com/microsoft/azure/management/authorization/v2015_07_01/ProviderOperation.java index 516e35ad30eb3..2dcf21d9d89ae 100644 --- a/authorization/resource-manager/v2015_07_01/src/main/java/com/microsoft/azure/management/authorization/v2015_07_01/ProviderOperation.java +++ b/authorization/resource-manager/v2015_07_01/src/main/java/com/microsoft/azure/management/authorization/v2015_07_01/ProviderOperation.java @@ -45,7 +45,7 @@ public class ProviderOperation { private Object properties; /** - * Get the name value. + * Get the operation name. * * @return the name value */ @@ -54,7 +54,7 @@ public String name() { } /** - * Set the name value. + * Set the operation name. * * @param name the name value to set * @return the ProviderOperation object itself. @@ -65,7 +65,7 @@ public ProviderOperation withName(String name) { } /** - * Get the displayName value. + * Get the operation display name. * * @return the displayName value */ @@ -74,7 +74,7 @@ public String displayName() { } /** - * Set the displayName value. + * Set the operation display name. * * @param displayName the displayName value to set * @return the ProviderOperation object itself. @@ -85,7 +85,7 @@ public ProviderOperation withDisplayName(String displayName) { } /** - * Get the description value. + * Get the operation description. * * @return the description value */ @@ -94,7 +94,7 @@ public String description() { } /** - * Set the description value. + * Set the operation description. * * @param description the description value to set * @return the ProviderOperation object itself. @@ -105,7 +105,7 @@ public ProviderOperation withDescription(String description) { } /** - * Get the origin value. + * Get the operation origin. * * @return the origin value */ @@ -114,7 +114,7 @@ public String origin() { } /** - * Set the origin value. + * Set the operation origin. * * @param origin the origin value to set * @return the ProviderOperation object itself. @@ -125,7 +125,7 @@ public ProviderOperation withOrigin(String origin) { } /** - * Get the properties value. + * Get the operation properties. * * @return the properties value */ @@ -134,7 +134,7 @@ public Object properties() { } /** - * Set the properties value. + * Set the operation properties. * * @param properties the properties value to set * @return the ProviderOperation object itself. diff --git a/authorization/resource-manager/v2015_07_01/src/main/java/com/microsoft/azure/management/authorization/v2015_07_01/ResourceType.java b/authorization/resource-manager/v2015_07_01/src/main/java/com/microsoft/azure/management/authorization/v2015_07_01/ResourceType.java index 43058913c697f..53a0bfa0a1698 100644 --- a/authorization/resource-manager/v2015_07_01/src/main/java/com/microsoft/azure/management/authorization/v2015_07_01/ResourceType.java +++ b/authorization/resource-manager/v2015_07_01/src/main/java/com/microsoft/azure/management/authorization/v2015_07_01/ResourceType.java @@ -34,7 +34,7 @@ public class ResourceType { private List operations; /** - * Get the name value. + * Get the resource type name. * * @return the name value */ @@ -43,7 +43,7 @@ public String name() { } /** - * Set the name value. + * Set the resource type name. * * @param name the name value to set * @return the ResourceType object itself. @@ -54,7 +54,7 @@ public ResourceType withName(String name) { } /** - * Get the displayName value. + * Get the resource type display name. * * @return the displayName value */ @@ -63,7 +63,7 @@ public String displayName() { } /** - * Set the displayName value. + * Set the resource type display name. * * @param displayName the displayName value to set * @return the ResourceType object itself. @@ -74,7 +74,7 @@ public ResourceType withDisplayName(String displayName) { } /** - * Get the operations value. + * Get the resource type operations. * * @return the operations value */ @@ -83,7 +83,7 @@ public List operations() { } /** - * Set the operations value. + * Set the resource type operations. * * @param operations the operations value to set * @return the ResourceType object itself. diff --git a/authorization/resource-manager/v2015_07_01/src/main/java/com/microsoft/azure/management/authorization/v2015_07_01/RoleAssignment.java b/authorization/resource-manager/v2015_07_01/src/main/java/com/microsoft/azure/management/authorization/v2015_07_01/RoleAssignment.java index 54b1220aa7745..266a33ff66b8a 100644 --- a/authorization/resource-manager/v2015_07_01/src/main/java/com/microsoft/azure/management/authorization/v2015_07_01/RoleAssignment.java +++ b/authorization/resource-manager/v2015_07_01/src/main/java/com/microsoft/azure/management/authorization/v2015_07_01/RoleAssignment.java @@ -44,7 +44,7 @@ public interface RoleAssignment extends HasInner, Indexable /** * The entirety of the RoleAssignment definition. */ - interface Definition extends DefinitionStages.Blank, DefinitionStages.WithProvider, DefinitionStages.WithScope, DefinitionStages.WithCreate { + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithProvider, DefinitionStages.WithScope, DefinitionStages.WithProperties, DefinitionStages.WithCreate { } /** @@ -63,6 +63,7 @@ interface Blank extends WithProvider { interface WithProvider { /** * Specifies . + * @return the next definition stage */ WithScope withExistingProvider(); } @@ -73,8 +74,22 @@ interface WithProvider { interface WithScope { /** * Specifies scope. + * @param scope The scope of the role assignment to create. The scope can be any REST resource instance. For example, use '/subscriptions/{subscription-id}/' for a subscription, '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}' for a resource group, and '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/providers/{resource-provider}/{resource-type}/{resource-name}' for a resource + * @return the next definition stage */ - WithCreate withScope(String scope); + WithProperties withScope(String scope); + } + + /** + * The stage of the roleassignment definition allowing to specify Properties. + */ + interface WithProperties { + /** + * Specifies properties. + * @param properties Role assignment properties + * @return the next definition stage + */ + WithCreate withProperties(RoleAssignmentProperties properties); } /** @@ -88,12 +103,24 @@ interface WithCreate extends Creatable { /** * The template for a RoleAssignment update operation, containing all the settings that can be modified. */ - interface Update extends Appliable { + interface Update extends Appliable, UpdateStages.WithProperties { } /** * Grouping of RoleAssignment update stages. */ interface UpdateStages { + /** + * The stage of the roleassignment update allowing to specify Properties. + */ + interface WithProperties { + /** + * Specifies properties. + * @param properties Role assignment properties + * @return the next update stage + */ + Update withProperties(RoleAssignmentProperties properties); + } + } } diff --git a/authorization/resource-manager/v2015_07_01/src/main/java/com/microsoft/azure/management/authorization/v2015_07_01/RoleAssignmentCreateParameters.java b/authorization/resource-manager/v2015_07_01/src/main/java/com/microsoft/azure/management/authorization/v2015_07_01/RoleAssignmentCreateParameters.java index 8b441f76a52f2..94292f6ee6a82 100644 --- a/authorization/resource-manager/v2015_07_01/src/main/java/com/microsoft/azure/management/authorization/v2015_07_01/RoleAssignmentCreateParameters.java +++ b/authorization/resource-manager/v2015_07_01/src/main/java/com/microsoft/azure/management/authorization/v2015_07_01/RoleAssignmentCreateParameters.java @@ -17,11 +17,11 @@ public class RoleAssignmentCreateParameters { /** * Role assignment properties. */ - @JsonProperty(value = "properties") + @JsonProperty(value = "properties", required = true) private RoleAssignmentProperties properties; /** - * Get the properties value. + * Get role assignment properties. * * @return the properties value */ @@ -30,7 +30,7 @@ public RoleAssignmentProperties properties() { } /** - * Set the properties value. + * Set role assignment properties. * * @param properties the properties value to set * @return the RoleAssignmentCreateParameters object itself. diff --git a/authorization/resource-manager/v2015_07_01/src/main/java/com/microsoft/azure/management/authorization/v2015_07_01/RoleAssignmentFilter.java b/authorization/resource-manager/v2015_07_01/src/main/java/com/microsoft/azure/management/authorization/v2015_07_01/RoleAssignmentFilter.java index 84b49ad13e852..e8ea9b579c18c 100644 --- a/authorization/resource-manager/v2015_07_01/src/main/java/com/microsoft/azure/management/authorization/v2015_07_01/RoleAssignmentFilter.java +++ b/authorization/resource-manager/v2015_07_01/src/main/java/com/microsoft/azure/management/authorization/v2015_07_01/RoleAssignmentFilter.java @@ -21,7 +21,7 @@ public class RoleAssignmentFilter { private String principalId; /** - * Get the principalId value. + * Get returns role assignment of the specific principal. * * @return the principalId value */ @@ -30,7 +30,7 @@ public String principalId() { } /** - * Set the principalId value. + * Set returns role assignment of the specific principal. * * @param principalId the principalId value to set * @return the RoleAssignmentFilter object itself. diff --git a/authorization/resource-manager/v2015_07_01/src/main/java/com/microsoft/azure/management/authorization/v2015_07_01/RoleAssignmentProperties.java b/authorization/resource-manager/v2015_07_01/src/main/java/com/microsoft/azure/management/authorization/v2015_07_01/RoleAssignmentProperties.java index 914f72e423569..da7d7c7c8b190 100644 --- a/authorization/resource-manager/v2015_07_01/src/main/java/com/microsoft/azure/management/authorization/v2015_07_01/RoleAssignmentProperties.java +++ b/authorization/resource-manager/v2015_07_01/src/main/java/com/microsoft/azure/management/authorization/v2015_07_01/RoleAssignmentProperties.java @@ -17,7 +17,7 @@ public class RoleAssignmentProperties { /** * The role definition ID used in the role assignment. */ - @JsonProperty(value = "roleDefinitionId") + @JsonProperty(value = "roleDefinitionId", required = true) private String roleDefinitionId; /** @@ -25,11 +25,11 @@ public class RoleAssignmentProperties { * Active Directory. It can point to a user, service principal, or security * group. */ - @JsonProperty(value = "principalId") + @JsonProperty(value = "principalId", required = true) private String principalId; /** - * Get the roleDefinitionId value. + * Get the role definition ID used in the role assignment. * * @return the roleDefinitionId value */ @@ -38,7 +38,7 @@ public String roleDefinitionId() { } /** - * Set the roleDefinitionId value. + * Set the role definition ID used in the role assignment. * * @param roleDefinitionId the roleDefinitionId value to set * @return the RoleAssignmentProperties object itself. @@ -49,7 +49,7 @@ public RoleAssignmentProperties withRoleDefinitionId(String roleDefinitionId) { } /** - * Get the principalId value. + * Get the principal ID assigned to the role. This maps to the ID inside the Active Directory. It can point to a user, service principal, or security group. * * @return the principalId value */ @@ -58,7 +58,7 @@ public String principalId() { } /** - * Set the principalId value. + * Set the principal ID assigned to the role. This maps to the ID inside the Active Directory. It can point to a user, service principal, or security group. * * @param principalId the principalId value to set * @return the RoleAssignmentProperties object itself. diff --git a/authorization/resource-manager/v2015_07_01/src/main/java/com/microsoft/azure/management/authorization/v2015_07_01/RoleAssignmentPropertiesWithScope.java b/authorization/resource-manager/v2015_07_01/src/main/java/com/microsoft/azure/management/authorization/v2015_07_01/RoleAssignmentPropertiesWithScope.java index b8ae30c87e006..451a9ed2d3f7f 100644 --- a/authorization/resource-manager/v2015_07_01/src/main/java/com/microsoft/azure/management/authorization/v2015_07_01/RoleAssignmentPropertiesWithScope.java +++ b/authorization/resource-manager/v2015_07_01/src/main/java/com/microsoft/azure/management/authorization/v2015_07_01/RoleAssignmentPropertiesWithScope.java @@ -33,7 +33,7 @@ public class RoleAssignmentPropertiesWithScope { private String principalId; /** - * Get the scope value. + * Get the role assignment scope. * * @return the scope value */ @@ -42,7 +42,7 @@ public String scope() { } /** - * Set the scope value. + * Set the role assignment scope. * * @param scope the scope value to set * @return the RoleAssignmentPropertiesWithScope object itself. @@ -53,7 +53,7 @@ public RoleAssignmentPropertiesWithScope withScope(String scope) { } /** - * Get the roleDefinitionId value. + * Get the role definition ID. * * @return the roleDefinitionId value */ @@ -62,7 +62,7 @@ public String roleDefinitionId() { } /** - * Set the roleDefinitionId value. + * Set the role definition ID. * * @param roleDefinitionId the roleDefinitionId value to set * @return the RoleAssignmentPropertiesWithScope object itself. @@ -73,7 +73,7 @@ public RoleAssignmentPropertiesWithScope withRoleDefinitionId(String roleDefinit } /** - * Get the principalId value. + * Get the principal ID. * * @return the principalId value */ @@ -82,7 +82,7 @@ public String principalId() { } /** - * Set the principalId value. + * Set the principal ID. * * @param principalId the principalId value to set * @return the RoleAssignmentPropertiesWithScope object itself. diff --git a/authorization/resource-manager/v2015_07_01/src/main/java/com/microsoft/azure/management/authorization/v2015_07_01/RoleAssignments.java b/authorization/resource-manager/v2015_07_01/src/main/java/com/microsoft/azure/management/authorization/v2015_07_01/RoleAssignments.java index 5cfd88b2899e9..33509fae2d68f 100644 --- a/authorization/resource-manager/v2015_07_01/src/main/java/com/microsoft/azure/management/authorization/v2015_07_01/RoleAssignments.java +++ b/authorization/resource-manager/v2015_07_01/src/main/java/com/microsoft/azure/management/authorization/v2015_07_01/RoleAssignments.java @@ -39,7 +39,7 @@ public interface RoleAssignments extends SupportsCreating deleteAsync(String scope, String roleAssignmentName); /** * Get the specified role assignment. @@ -58,16 +58,17 @@ public interface RoleAssignments extends SupportsCreating deleteByIdAsync(String roleAssignmentId); /** * Creates a role assignment by ID. * * @param roleAssignmentId The fully qualified ID of the role assignment, including the scope, resource name and resource type. Use the format, /{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}. Example: /subscriptions/{subId}/resourcegroups/{rgname}//providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}. + * @param properties Role assignment properties. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable for the request */ - Observable createByIdAsync(String roleAssignmentId); + Observable createByIdAsync(String roleAssignmentId, RoleAssignmentProperties properties); /** * Gets a role assignment by ID. 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 aa2307a08a40f..05c3456f5f3d7 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 @@ -17,6 +17,8 @@ import com.microsoft.azure.arm.model.Refreshable; import com.microsoft.azure.arm.resources.models.HasManager; import com.microsoft.azure.management.authorization.v2015_07_01.implementation.AuthorizationManager; +import java.util.List; +import com.microsoft.azure.management.authorization.v2015_07_01.implementation.PermissionInner; /** * Type representing RoleDefinition. @@ -45,7 +47,7 @@ public interface RoleDefinition extends HasInner, Indexable /** * The entirety of the RoleDefinition definition. */ - interface Definition extends DefinitionStages.Blank, DefinitionStages.WithScope, DefinitionStages.WithCreate { + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithScope, DefinitionStages.WithProperties, DefinitionStages.WithCreate { } /** @@ -64,8 +66,22 @@ interface Blank extends WithScope { interface WithScope { /** * Specifies scope. + * @param scope The scope of the role definition + * @return the next definition stage */ - WithCreate withScope(String scope); + WithProperties withScope(String scope); + } + + /** + * The stage of the roledefinition definition allowing to specify Properties. + */ + interface WithProperties { + /** + * Specifies properties. + * @param properties Role definition properties + * @return the next definition stage + */ + WithCreate withProperties(RoleDefinitionProperties properties); } /** @@ -79,12 +95,24 @@ interface WithCreate extends Creatable { /** * The template for a RoleDefinition update operation, containing all the settings that can be modified. */ - interface Update extends Appliable { + interface Update extends Appliable, UpdateStages.WithProperties { } /** * Grouping of RoleDefinition update stages. */ interface UpdateStages { + /** + * The stage of the roledefinition update allowing to specify Properties. + */ + interface WithProperties { + /** + * Specifies properties. + * @param properties Role definition properties + * @return the next update stage + */ + Update withProperties(RoleDefinitionProperties properties); + } + } } diff --git a/authorization/resource-manager/v2015_07_01/src/main/java/com/microsoft/azure/management/authorization/v2015_07_01/RoleDefinitionFilter.java b/authorization/resource-manager/v2015_07_01/src/main/java/com/microsoft/azure/management/authorization/v2015_07_01/RoleDefinitionFilter.java index 41c7b5672f683..05ecf284bb63e 100644 --- a/authorization/resource-manager/v2015_07_01/src/main/java/com/microsoft/azure/management/authorization/v2015_07_01/RoleDefinitionFilter.java +++ b/authorization/resource-manager/v2015_07_01/src/main/java/com/microsoft/azure/management/authorization/v2015_07_01/RoleDefinitionFilter.java @@ -21,7 +21,7 @@ public class RoleDefinitionFilter { private String roleName; /** - * Get the roleName value. + * Get returns role definition with the specific name. * * @return the roleName value */ @@ -30,7 +30,7 @@ public String roleName() { } /** - * Set the roleName value. + * Set returns role definition with the specific name. * * @param roleName the roleName value to set * @return the RoleDefinitionFilter object itself. diff --git a/authorization/resource-manager/v2015_07_01/src/main/java/com/microsoft/azure/management/authorization/v2015_07_01/RoleDefinitionProperties.java b/authorization/resource-manager/v2015_07_01/src/main/java/com/microsoft/azure/management/authorization/v2015_07_01/RoleDefinitionProperties.java index 6b27aa0a56839..9035cdf86e746 100644 --- a/authorization/resource-manager/v2015_07_01/src/main/java/com/microsoft/azure/management/authorization/v2015_07_01/RoleDefinitionProperties.java +++ b/authorization/resource-manager/v2015_07_01/src/main/java/com/microsoft/azure/management/authorization/v2015_07_01/RoleDefinitionProperties.java @@ -47,7 +47,7 @@ public class RoleDefinitionProperties { private List assignableScopes; /** - * Get the roleName value. + * Get the role name. * * @return the roleName value */ @@ -56,7 +56,7 @@ public String roleName() { } /** - * Set the roleName value. + * Set the role name. * * @param roleName the roleName value to set * @return the RoleDefinitionProperties object itself. @@ -67,7 +67,7 @@ public RoleDefinitionProperties withRoleName(String roleName) { } /** - * Get the description value. + * Get the role definition description. * * @return the description value */ @@ -76,7 +76,7 @@ public String description() { } /** - * Set the description value. + * Set the role definition description. * * @param description the description value to set * @return the RoleDefinitionProperties object itself. @@ -87,7 +87,7 @@ public RoleDefinitionProperties withDescription(String description) { } /** - * Get the type value. + * Get the role type. * * @return the type value */ @@ -96,7 +96,7 @@ public String type() { } /** - * Set the type value. + * Set the role type. * * @param type the type value to set * @return the RoleDefinitionProperties object itself. @@ -107,7 +107,7 @@ public RoleDefinitionProperties withType(String type) { } /** - * Get the permissions value. + * Get role definition permissions. * * @return the permissions value */ @@ -116,7 +116,7 @@ public List permissions() { } /** - * Set the permissions value. + * Set role definition permissions. * * @param permissions the permissions value to set * @return the RoleDefinitionProperties object itself. @@ -127,7 +127,7 @@ public RoleDefinitionProperties withPermissions(List permission } /** - * Get the assignableScopes value. + * Get role definition assignable scopes. * * @return the assignableScopes value */ @@ -136,7 +136,7 @@ public List assignableScopes() { } /** - * Set the assignableScopes value. + * Set role definition assignable scopes. * * @param assignableScopes the assignableScopes value to set * @return the RoleDefinitionProperties object itself. diff --git a/authorization/resource-manager/v2015_07_01/src/main/java/com/microsoft/azure/management/authorization/v2015_07_01/RoleDefinitions.java b/authorization/resource-manager/v2015_07_01/src/main/java/com/microsoft/azure/management/authorization/v2015_07_01/RoleDefinitions.java index 166743c2b597b..dea84accf81af 100644 --- a/authorization/resource-manager/v2015_07_01/src/main/java/com/microsoft/azure/management/authorization/v2015_07_01/RoleDefinitions.java +++ b/authorization/resource-manager/v2015_07_01/src/main/java/com/microsoft/azure/management/authorization/v2015_07_01/RoleDefinitions.java @@ -26,7 +26,7 @@ public interface RoleDefinitions extends SupportsCreating deleteAsync(String scope, String roleDefinitionId); /** * Get role definition by name (GUID). 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 242aee21eeb90..de1757b192e51 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 @@ -51,11 +51,11 @@ public AuthorizationManagementClientImpl withSubscriptionId(String subscriptionI return this; } - /** The API version to use for the operation. */ + /** The API version to use for this operation. */ private String apiVersion; /** - * Gets The API version to use for the operation. + * Gets The API version to use for this operation. * * @return the apiVersion value. */ @@ -63,11 +63,11 @@ public String apiVersion() { return this.apiVersion; } - /** Gets or sets the preferred language for the response. */ + /** The preferred language for the response. */ private String acceptLanguage; /** - * Gets Gets or sets the preferred language for the response. + * Gets The preferred language for the response. * * @return the acceptLanguage value. */ @@ -76,7 +76,7 @@ public String acceptLanguage() { } /** - * Sets Gets or sets the preferred language for the response. + * Sets The preferred language for the response. * * @param acceptLanguage the acceptLanguage value. * @return the service client itself @@ -86,11 +86,11 @@ public AuthorizationManagementClientImpl withAcceptLanguage(String acceptLanguag return this; } - /** Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30. */ + /** The retry timeout in seconds for Long Running Operations. Default value is 30. */ private int longRunningOperationRetryTimeout; /** - * Gets Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30. + * Gets The retry timeout in seconds for Long Running Operations. Default value is 30. * * @return the longRunningOperationRetryTimeout value. */ @@ -99,7 +99,7 @@ public int longRunningOperationRetryTimeout() { } /** - * Sets Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30. + * Sets The retry timeout in seconds for Long Running Operations. Default value is 30. * * @param longRunningOperationRetryTimeout the longRunningOperationRetryTimeout value. * @return the service client itself @@ -109,11 +109,11 @@ public AuthorizationManagementClientImpl withLongRunningOperationRetryTimeout(in return this; } - /** When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. */ + /** 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 When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. + * 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. */ @@ -122,7 +122,7 @@ public boolean generateClientRequestId() { } /** - * Sets When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. + * 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 @@ -132,19 +132,6 @@ public AuthorizationManagementClientImpl withGenerateClientRequestId(boolean gen 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; - } - /** * The PermissionsInner object to access its operations. */ @@ -197,6 +184,19 @@ public RoleDefinitionsInner roleDefinitions() { return this.roleDefinitions; } + /** + * 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. * @@ -232,11 +232,11 @@ protected void initialize() { this.acceptLanguage = "en-US"; this.longRunningOperationRetryTimeout = 30; this.generateClientRequestId = true; - this.classicAdministrators = new ClassicAdministratorsInner(restClient().retrofit(), this); this.permissions = new PermissionsInner(restClient().retrofit(), this); this.providerOperationsMetadatas = new ProviderOperationsMetadatasInner(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); } @@ -247,6 +247,6 @@ protected void initialize() { */ @Override public String userAgent() { - return String.format("%s (%s, %s)", super.userAgent(), "AuthorizationManagementClient", "2015-07-01"); + return String.format("%s (%s, %s, auto-generated)", super.userAgent(), "AuthorizationManagementClient", "2015-07-01"); } } 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 7db8bddf7dfd9..2f96613e2d2de 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 @@ -16,11 +16,11 @@ 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_07_01.ClassicAdministrators; import com.microsoft.azure.management.authorization.v2015_07_01.Permissions; import com.microsoft.azure.management.authorization.v2015_07_01.ProviderOperationsMetadatas; import com.microsoft.azure.management.authorization.v2015_07_01.RoleAssignments; import com.microsoft.azure.management.authorization.v2015_07_01.RoleDefinitions; +import com.microsoft.azure.management.authorization.v2015_07_01.ClassicAdministrators; import com.microsoft.azure.arm.resources.implementation.AzureConfigurableCoreImpl; import com.microsoft.azure.arm.resources.implementation.ManagerCore; @@ -28,11 +28,11 @@ * Entry point to Azure Authorization resource management. */ public final class AuthorizationManager extends ManagerCore { - private ClassicAdministrators classicAdministrators; private Permissions permissions; private ProviderOperationsMetadatas providerOperationsMetadatas; private RoleAssignments roleAssignments; private RoleDefinitions roleDefinitions; + private ClassicAdministrators classicAdministrators; /** * Get a Configurable instance that can be used to create AuthorizationManager with optional configuration. * @@ -80,16 +80,6 @@ public interface Configurable extends AzureConfigurable { 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; - } - /** * @return Entry point to manage Permissions. */ @@ -130,6 +120,16 @@ public RoleDefinitions roleDefinitions() { return this.roleDefinitions; } + /** + * @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. */ 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 960ce37b97c2a..7f18e66102350 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 @@ -40,7 +40,7 @@ public class ClassicAdministratorInner { private ClassicAdministratorProperties properties; /** - * Get the id value. + * Get the ID of the administrator. * * @return the id value */ @@ -49,7 +49,7 @@ public String id() { } /** - * Set the id value. + * Set the ID of the administrator. * * @param id the id value to set * @return the ClassicAdministratorInner object itself. @@ -60,7 +60,7 @@ public ClassicAdministratorInner withId(String id) { } /** - * Get the name value. + * Get the name of the administrator. * * @return the name value */ @@ -69,7 +69,7 @@ public String name() { } /** - * Set the name value. + * Set the name of the administrator. * * @param name the name value to set * @return the ClassicAdministratorInner object itself. @@ -80,7 +80,7 @@ public ClassicAdministratorInner withName(String name) { } /** - * Get the type value. + * Get the type of the administrator. * * @return the type value */ @@ -89,7 +89,7 @@ public String type() { } /** - * Set the type value. + * Set the type of the administrator. * * @param type the type value to set * @return the ClassicAdministratorInner object itself. @@ -100,7 +100,7 @@ public ClassicAdministratorInner withType(String type) { } /** - * Get the properties value. + * Get properties for the classic administrator. * * @return the properties value */ @@ -109,7 +109,7 @@ public ClassicAdministratorProperties properties() { } /** - * Set the properties value. + * Set properties for the classic administrator. * * @param properties the properties value to set * @return the ClassicAdministratorInner object itself. 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 a5b62e090fead..1875e44be030e 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 @@ -37,7 +37,8 @@ public Observable listAsync(final String apiVersion) { public Iterable call(Page page) { return page.items(); } - }) .map(new Func1() { + }) + .map(new Func1() { @Override public ClassicAdministrator call(ClassicAdministratorInner inner) { return new ClassicAdministratorImpl(inner, manager()); diff --git a/authorization/resource-manager/v2015_07_01/src/main/java/com/microsoft/azure/management/authorization/v2015_07_01/implementation/PermissionInner.java b/authorization/resource-manager/v2015_07_01/src/main/java/com/microsoft/azure/management/authorization/v2015_07_01/implementation/PermissionInner.java index e926a88761182..70d897f38dc6a 100644 --- a/authorization/resource-manager/v2015_07_01/src/main/java/com/microsoft/azure/management/authorization/v2015_07_01/implementation/PermissionInner.java +++ b/authorization/resource-manager/v2015_07_01/src/main/java/com/microsoft/azure/management/authorization/v2015_07_01/implementation/PermissionInner.java @@ -28,7 +28,7 @@ public class PermissionInner { private List notActions; /** - * Get the actions value. + * Get allowed actions. * * @return the actions value */ @@ -37,7 +37,7 @@ public List actions() { } /** - * Set the actions value. + * Set allowed actions. * * @param actions the actions value to set * @return the PermissionInner object itself. @@ -48,7 +48,7 @@ public PermissionInner withActions(List actions) { } /** - * Get the notActions value. + * Get denied actions. * * @return the notActions value */ @@ -57,7 +57,7 @@ public List notActions() { } /** - * Set the notActions value. + * Set denied actions. * * @param notActions the notActions value to set * @return the PermissionInner object itself. diff --git a/authorization/resource-manager/v2015_07_01/src/main/java/com/microsoft/azure/management/authorization/v2015_07_01/implementation/PermissionsImpl.java b/authorization/resource-manager/v2015_07_01/src/main/java/com/microsoft/azure/management/authorization/v2015_07_01/implementation/PermissionsImpl.java index af0f288fac5c6..99ca623ba0979 100644 --- a/authorization/resource-manager/v2015_07_01/src/main/java/com/microsoft/azure/management/authorization/v2015_07_01/implementation/PermissionsImpl.java +++ b/authorization/resource-manager/v2015_07_01/src/main/java/com/microsoft/azure/management/authorization/v2015_07_01/implementation/PermissionsImpl.java @@ -37,7 +37,8 @@ public Observable listForResourceAsync(final String resourceGroupNam public Iterable call(Page page) { return page.items(); } - }) .map(new Func1() { + }) + .map(new Func1() { @Override public Permission call(PermissionInner inner) { return new PermissionImpl(inner, manager()); @@ -54,7 +55,8 @@ public Observable listByResourceGroupAsync(final String resourceGrou public Iterable call(Page page) { return page.items(); } - }) .map(new Func1() { + }) + .map(new Func1() { @Override public Permission call(PermissionInner inner) { return new PermissionImpl(inner, manager()); diff --git a/authorization/resource-manager/v2015_07_01/src/main/java/com/microsoft/azure/management/authorization/v2015_07_01/implementation/ProviderOperationsMetadataInner.java b/authorization/resource-manager/v2015_07_01/src/main/java/com/microsoft/azure/management/authorization/v2015_07_01/implementation/ProviderOperationsMetadataInner.java index 30e3110e6115e..bcf0a7c91218e 100644 --- a/authorization/resource-manager/v2015_07_01/src/main/java/com/microsoft/azure/management/authorization/v2015_07_01/implementation/ProviderOperationsMetadataInner.java +++ b/authorization/resource-manager/v2015_07_01/src/main/java/com/microsoft/azure/management/authorization/v2015_07_01/implementation/ProviderOperationsMetadataInner.java @@ -54,7 +54,7 @@ public class ProviderOperationsMetadataInner { private List operations; /** - * Get the id value. + * Get the provider id. * * @return the id value */ @@ -63,7 +63,7 @@ public String id() { } /** - * Set the id value. + * Set the provider id. * * @param id the id value to set * @return the ProviderOperationsMetadataInner object itself. @@ -74,7 +74,7 @@ public ProviderOperationsMetadataInner withId(String id) { } /** - * Get the name value. + * Get the provider name. * * @return the name value */ @@ -83,7 +83,7 @@ public String name() { } /** - * Set the name value. + * Set the provider name. * * @param name the name value to set * @return the ProviderOperationsMetadataInner object itself. @@ -94,7 +94,7 @@ public ProviderOperationsMetadataInner withName(String name) { } /** - * Get the type value. + * Get the provider type. * * @return the type value */ @@ -103,7 +103,7 @@ public String type() { } /** - * Set the type value. + * Set the provider type. * * @param type the type value to set * @return the ProviderOperationsMetadataInner object itself. @@ -114,7 +114,7 @@ public ProviderOperationsMetadataInner withType(String type) { } /** - * Get the displayName value. + * Get the provider display name. * * @return the displayName value */ @@ -123,7 +123,7 @@ public String displayName() { } /** - * Set the displayName value. + * Set the provider display name. * * @param displayName the displayName value to set * @return the ProviderOperationsMetadataInner object itself. @@ -134,7 +134,7 @@ public ProviderOperationsMetadataInner withDisplayName(String displayName) { } /** - * Get the resourceTypes value. + * Get the provider resource types. * * @return the resourceTypes value */ @@ -143,7 +143,7 @@ public List resourceTypes() { } /** - * Set the resourceTypes value. + * Set the provider resource types. * * @param resourceTypes the resourceTypes value to set * @return the ProviderOperationsMetadataInner object itself. @@ -154,7 +154,7 @@ public ProviderOperationsMetadataInner withResourceTypes(List reso } /** - * Get the operations value. + * Get the provider operations. * * @return the operations value */ @@ -163,7 +163,7 @@ public List operations() { } /** - * Set the operations value. + * Set the provider operations. * * @param operations the operations value to set * @return the ProviderOperationsMetadataInner object itself. diff --git a/authorization/resource-manager/v2015_07_01/src/main/java/com/microsoft/azure/management/authorization/v2015_07_01/implementation/ProviderOperationsMetadatasImpl.java b/authorization/resource-manager/v2015_07_01/src/main/java/com/microsoft/azure/management/authorization/v2015_07_01/implementation/ProviderOperationsMetadatasImpl.java index 9ef4374e93263..6a5123cf61e0f 100644 --- a/authorization/resource-manager/v2015_07_01/src/main/java/com/microsoft/azure/management/authorization/v2015_07_01/implementation/ProviderOperationsMetadatasImpl.java +++ b/authorization/resource-manager/v2015_07_01/src/main/java/com/microsoft/azure/management/authorization/v2015_07_01/implementation/ProviderOperationsMetadatasImpl.java @@ -49,7 +49,8 @@ public Observable listAsync(final String apiVersion) public Iterable call(Page page) { return page.items(); } - }) .map(new Func1() { + }) + .map(new Func1() { @Override public ProviderOperationsMetadata call(ProviderOperationsMetadataInner inner) { return new ProviderOperationsMetadataImpl(inner, manager()); diff --git a/authorization/resource-manager/v2015_07_01/src/main/java/com/microsoft/azure/management/authorization/v2015_07_01/implementation/RoleAssignmentImpl.java b/authorization/resource-manager/v2015_07_01/src/main/java/com/microsoft/azure/management/authorization/v2015_07_01/implementation/RoleAssignmentImpl.java index 5054ca743196d..1732a7c3279c8 100644 --- a/authorization/resource-manager/v2015_07_01/src/main/java/com/microsoft/azure/management/authorization/v2015_07_01/implementation/RoleAssignmentImpl.java +++ b/authorization/resource-manager/v2015_07_01/src/main/java/com/microsoft/azure/management/authorization/v2015_07_01/implementation/RoleAssignmentImpl.java @@ -11,12 +11,16 @@ import com.microsoft.azure.management.authorization.v2015_07_01.RoleAssignment; import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; import rx.Observable; +import com.microsoft.azure.management.authorization.v2015_07_01.RoleAssignmentProperties; import com.microsoft.azure.management.authorization.v2015_07_01.RoleAssignmentPropertiesWithScope; +import rx.functions.Func1; class RoleAssignmentImpl extends CreatableUpdatableImpl implements RoleAssignment, RoleAssignment.Definition, RoleAssignment.Update { private final AuthorizationManager manager; private String scope; private String roleAssignmentName; + private RoleAssignmentProperties cproperties; + private RoleAssignmentProperties uproperties; RoleAssignmentImpl(String name, AuthorizationManager manager) { super(name, new RoleAssignmentInner()); @@ -24,6 +28,8 @@ class RoleAssignmentImpl extends CreatableUpdatableImpl createResourceAsync() { RoleAssignmentsInner client = this.manager().inner().roleAssignments(); - return client.createAsync(this.scope, this.roleAssignmentName) + return client.createAsync(this.scope, this.roleAssignmentName, this.cproperties) + .map(new Func1() { + @Override + public RoleAssignmentInner call(RoleAssignmentInner resource) { + resetCreateUpdateParameters(); + return resource; + } + }) .map(innerToFluentMap(this)); } @Override public Observable updateResourceAsync() { RoleAssignmentsInner client = this.manager().inner().roleAssignments(); - return client.createAsync(this.scope, this.roleAssignmentName) + return client.createAsync(this.scope, this.roleAssignmentName, this.uproperties) + .map(new Func1() { + @Override + public RoleAssignmentInner call(RoleAssignmentInner resource) { + resetCreateUpdateParameters(); + return resource; + } + }) .map(innerToFluentMap(this)); } @@ -67,6 +89,10 @@ public boolean isInCreateMode() { return this.inner().id() == null; } + private void resetCreateUpdateParameters() { + this.cproperties = new RoleAssignmentProperties(); + this.uproperties = new RoleAssignmentProperties(); + } @Override public String id() { @@ -99,4 +125,14 @@ public RoleAssignmentImpl withScope(String scope) { return this; } + @Override + public RoleAssignmentImpl withProperties(RoleAssignmentProperties properties) { + if (isInCreateMode()) { + this.cproperties = properties; + } else { + this.uproperties = properties; + } + return this; + } + } diff --git a/authorization/resource-manager/v2015_07_01/src/main/java/com/microsoft/azure/management/authorization/v2015_07_01/implementation/RoleAssignmentInner.java b/authorization/resource-manager/v2015_07_01/src/main/java/com/microsoft/azure/management/authorization/v2015_07_01/implementation/RoleAssignmentInner.java index 0785899f77b81..d712b7c215110 100644 --- a/authorization/resource-manager/v2015_07_01/src/main/java/com/microsoft/azure/management/authorization/v2015_07_01/implementation/RoleAssignmentInner.java +++ b/authorization/resource-manager/v2015_07_01/src/main/java/com/microsoft/azure/management/authorization/v2015_07_01/implementation/RoleAssignmentInner.java @@ -40,7 +40,7 @@ public class RoleAssignmentInner { private RoleAssignmentPropertiesWithScope properties; /** - * Get the id value. + * Get the role assignment ID. * * @return the id value */ @@ -49,7 +49,7 @@ public String id() { } /** - * Get the name value. + * Get the role assignment name. * * @return the name value */ @@ -58,7 +58,7 @@ public String name() { } /** - * Get the type value. + * Get the role assignment type. * * @return the type value */ @@ -67,7 +67,7 @@ public String type() { } /** - * Get the properties value. + * Get role assignment properties. * * @return the properties value */ @@ -76,7 +76,7 @@ public RoleAssignmentPropertiesWithScope properties() { } /** - * Set the properties value. + * Set role assignment properties. * * @param properties the properties value to set * @return the RoleAssignmentInner object itself. diff --git a/authorization/resource-manager/v2015_07_01/src/main/java/com/microsoft/azure/management/authorization/v2015_07_01/implementation/RoleAssignmentsImpl.java b/authorization/resource-manager/v2015_07_01/src/main/java/com/microsoft/azure/management/authorization/v2015_07_01/implementation/RoleAssignmentsImpl.java index 5594ab890264f..3542de7f8bb2c 100644 --- a/authorization/resource-manager/v2015_07_01/src/main/java/com/microsoft/azure/management/authorization/v2015_07_01/implementation/RoleAssignmentsImpl.java +++ b/authorization/resource-manager/v2015_07_01/src/main/java/com/microsoft/azure/management/authorization/v2015_07_01/implementation/RoleAssignmentsImpl.java @@ -11,11 +11,11 @@ import com.microsoft.azure.arm.model.implementation.WrapperImpl; import com.microsoft.azure.management.authorization.v2015_07_01.RoleAssignments; -import rx.Completable; import rx.functions.Func1; import rx.Observable; import com.microsoft.azure.Page; import com.microsoft.azure.management.authorization.v2015_07_01.RoleAssignment; +import com.microsoft.azure.management.authorization.v2015_07_01.RoleAssignmentProperties; class RoleAssignmentsImpl extends WrapperImpl implements RoleAssignments { private final AuthorizationManager manager; @@ -51,7 +51,8 @@ public Observable listForResourceAsync(final String resourceGrou public Iterable call(Page page) { return page.items(); } - }) .map(new Func1() { + }) + .map(new Func1() { @Override public RoleAssignment call(RoleAssignmentInner inner) { return new RoleAssignmentImpl(inner, manager()); @@ -60,9 +61,15 @@ public RoleAssignment call(RoleAssignmentInner inner) { } @Override - public Completable deleteAsync(String scope, String roleAssignmentName) { + public Observable deleteAsync(String scope, String roleAssignmentName) { RoleAssignmentsInner client = this.inner(); - return client.deleteAsync(scope, roleAssignmentName).toCompletable(); + return client.deleteAsync(scope, roleAssignmentName) + .map(new Func1() { + @Override + public RoleAssignment call(RoleAssignmentInner inner) { + return new RoleAssignmentImpl(inner, manager()); + } + }); } @Override @@ -78,15 +85,21 @@ public RoleAssignment call(RoleAssignmentInner inner) { } @Override - public Completable deleteByIdAsync(String roleAssignmentId) { + public Observable deleteByIdAsync(String roleAssignmentId) { RoleAssignmentsInner client = this.inner(); - return client.deleteByIdAsync(roleAssignmentId).toCompletable(); + return client.deleteByIdAsync(roleAssignmentId) + .map(new Func1() { + @Override + public RoleAssignment call(RoleAssignmentInner inner) { + return new RoleAssignmentImpl(inner, manager()); + } + }); } @Override - public Observable createByIdAsync(String roleAssignmentId) { + public Observable createByIdAsync(String roleAssignmentId, RoleAssignmentProperties properties) { RoleAssignmentsInner client = this.inner(); - return client.createByIdAsync(roleAssignmentId) + return client.createByIdAsync(roleAssignmentId, properties) .map(new Func1() { @Override public RoleAssignment call(RoleAssignmentInner inner) { @@ -116,7 +129,8 @@ public Observable listByResourceGroupAsync(final String resource public Iterable call(Page page) { return page.items(); } - }) .map(new Func1() { + }) + .map(new Func1() { @Override public RoleAssignment call(RoleAssignmentInner inner) { return new RoleAssignmentImpl(inner, manager()); @@ -133,7 +147,8 @@ public Observable listAsync() { public Iterable call(Page page) { return page.items(); } - }) .map(new Func1() { + }) + .map(new Func1() { @Override public RoleAssignment call(RoleAssignmentInner inner) { return new RoleAssignmentImpl(inner, manager()); @@ -150,7 +165,8 @@ public Observable listForScopeAsync(final String scope) { public Iterable call(Page page) { return page.items(); } - }) .map(new Func1() { + }) + .map(new Func1() { @Override public RoleAssignment call(RoleAssignmentInner inner) { return new RoleAssignmentImpl(inner, manager()); diff --git a/authorization/resource-manager/v2015_07_01/src/main/java/com/microsoft/azure/management/authorization/v2015_07_01/implementation/RoleAssignmentsInner.java b/authorization/resource-manager/v2015_07_01/src/main/java/com/microsoft/azure/management/authorization/v2015_07_01/implementation/RoleAssignmentsInner.java index 5262b3a53cfc6..67a00ca66d688 100644 --- a/authorization/resource-manager/v2015_07_01/src/main/java/com/microsoft/azure/management/authorization/v2015_07_01/implementation/RoleAssignmentsInner.java +++ b/authorization/resource-manager/v2015_07_01/src/main/java/com/microsoft/azure/management/authorization/v2015_07_01/implementation/RoleAssignmentsInner.java @@ -728,85 +728,6 @@ private ServiceResponse deleteDelegate(Response createAsync(String scope, String roleAssignmentName, final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(createWithServiceResponseAsync(scope, roleAssignmentName), serviceCallback); - } - - /** - * Creates a role assignment. - * - * @param scope The scope of the role assignment to create. The scope can be any REST resource instance. For example, use '/subscriptions/{subscription-id}/' for a subscription, '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}' for a resource group, and '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/providers/{resource-provider}/{resource-type}/{resource-name}' for a resource. - * @param roleAssignmentName The name of the role assignment to create. It can be any valid GUID. - * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the RoleAssignmentInner object - */ - public Observable createAsync(String scope, String roleAssignmentName) { - return createWithServiceResponseAsync(scope, roleAssignmentName).map(new Func1, RoleAssignmentInner>() { - @Override - public RoleAssignmentInner call(ServiceResponse response) { - return response.body(); - } - }); - } - - /** - * Creates a role assignment. - * - * @param scope The scope of the role assignment to create. The scope can be any REST resource instance. For example, use '/subscriptions/{subscription-id}/' for a subscription, '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}' for a resource group, and '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/providers/{resource-provider}/{resource-type}/{resource-name}' for a resource. - * @param roleAssignmentName The name of the role assignment to create. It can be any valid GUID. - * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the RoleAssignmentInner object - */ - public Observable> createWithServiceResponseAsync(String scope, String roleAssignmentName) { - if (scope == null) { - throw new IllegalArgumentException("Parameter scope is required and cannot be null."); - } - if (roleAssignmentName == null) { - throw new IllegalArgumentException("Parameter roleAssignmentName 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 RoleAssignmentProperties properties = null; - RoleAssignmentCreateParameters parameters = new RoleAssignmentCreateParameters(); - parameters.withProperties(null); - return service.create(scope, roleAssignmentName, this.client.apiVersion(), this.client.acceptLanguage(), parameters, this.client.userAgent()) - .flatMap(new Func1, Observable>>() { - @Override - public Observable> call(Response response) { - try { - ServiceResponse clientResponse = createDelegate(response); - return Observable.just(clientResponse); - } catch (Throwable t) { - return Observable.error(t); - } - } - }); - } - /** * Creates a role assignment. * @@ -873,6 +794,9 @@ public Observable> createWithServiceRespons if (this.client.apiVersion() == null) { throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); } + if (properties == null) { + throw new IllegalArgumentException("Parameter properties is required and cannot be null."); + } Validator.validate(properties); RoleAssignmentCreateParameters parameters = new RoleAssignmentCreateParameters(); parameters.withProperties(properties); @@ -1056,78 +980,6 @@ private ServiceResponse deleteByIdDelegate(Response createByIdAsync(String roleAssignmentId, final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(createByIdWithServiceResponseAsync(roleAssignmentId), serviceCallback); - } - - /** - * Creates a role assignment by ID. - * - * @param roleAssignmentId The fully qualified ID of the role assignment, including the scope, resource name and resource type. Use the format, /{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}. Example: /subscriptions/{subId}/resourcegroups/{rgname}//providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}. - * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the RoleAssignmentInner object - */ - public Observable createByIdAsync(String roleAssignmentId) { - return createByIdWithServiceResponseAsync(roleAssignmentId).map(new Func1, RoleAssignmentInner>() { - @Override - public RoleAssignmentInner call(ServiceResponse response) { - return response.body(); - } - }); - } - - /** - * Creates a role assignment by ID. - * - * @param roleAssignmentId The fully qualified ID of the role assignment, including the scope, resource name and resource type. Use the format, /{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}. Example: /subscriptions/{subId}/resourcegroups/{rgname}//providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}. - * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the RoleAssignmentInner object - */ - public Observable> createByIdWithServiceResponseAsync(String roleAssignmentId) { - if (roleAssignmentId == null) { - throw new IllegalArgumentException("Parameter roleAssignmentId 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 RoleAssignmentProperties properties = null; - RoleAssignmentCreateParameters parameters = new RoleAssignmentCreateParameters(); - parameters.withProperties(null); - return service.createById(roleAssignmentId, this.client.apiVersion(), this.client.acceptLanguage(), parameters, this.client.userAgent()) - .flatMap(new Func1, Observable>>() { - @Override - public Observable> call(Response response) { - try { - ServiceResponse clientResponse = createByIdDelegate(response); - return Observable.just(clientResponse); - } catch (Throwable t) { - return Observable.error(t); - } - } - }); - } - /** * Creates a role assignment by ID. * @@ -1187,6 +1039,9 @@ public Observable> createByIdWithServiceRes if (this.client.apiVersion() == null) { throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); } + if (properties == null) { + throw new IllegalArgumentException("Parameter properties is required and cannot be null."); + } Validator.validate(properties); RoleAssignmentCreateParameters parameters = new RoleAssignmentCreateParameters(); parameters.withProperties(properties); 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 8ccbb48b121eb..ac4f77c3aafc6 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 @@ -13,10 +13,14 @@ 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; 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) { @@ -25,6 +29,8 @@ class RoleDefinitionImpl extends CreatableUpdatableImpl createResourceAsync() { RoleDefinitionsInner client = this.manager().inner().roleDefinitions(); - return client.createOrUpdateAsync(this.scope, this.roleDefinitionId) + return client.createOrUpdateAsync(this.scope, this.roleDefinitionId, this.cproperties) + .map(new Func1() { + @Override + public RoleDefinitionInner call(RoleDefinitionInner resource) { + resetCreateUpdateParameters(); + return resource; + } + }) .map(innerToFluentMap(this)); } @Override public Observable updateResourceAsync() { RoleDefinitionsInner client = this.manager().inner().roleDefinitions(); - return client.createOrUpdateAsync(this.scope, this.roleDefinitionId) + return client.createOrUpdateAsync(this.scope, this.roleDefinitionId, this.uproperties) + .map(new Func1() { + @Override + public RoleDefinitionInner call(RoleDefinitionInner resource) { + resetCreateUpdateParameters(); + return resource; + } + }) .map(innerToFluentMap(this)); } @@ -68,6 +90,10 @@ public boolean isInCreateMode() { return this.inner().id() == null; } + private void resetCreateUpdateParameters() { + this.cproperties = new RoleDefinitionProperties(); + this.uproperties = new RoleDefinitionProperties(); + } @Override public String id() { @@ -95,4 +121,14 @@ public RoleDefinitionImpl withScope(String scope) { return this; } + @Override + public RoleDefinitionImpl withProperties(RoleDefinitionProperties properties) { + if (isInCreateMode()) { + this.cproperties = properties; + } else { + this.uproperties = properties; + } + 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 9e9ebbd70bff7..b9051b7e60a70 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 @@ -40,7 +40,7 @@ public class RoleDefinitionInner { private RoleDefinitionProperties properties; /** - * Get the id value. + * Get the role definition ID. * * @return the id value */ @@ -49,7 +49,7 @@ public String id() { } /** - * Get the name value. + * Get the role definition name. * * @return the name value */ @@ -58,7 +58,7 @@ public String name() { } /** - * Get the type value. + * Get the role definition type. * * @return the type value */ @@ -67,7 +67,7 @@ public String type() { } /** - * Get the properties value. + * Get role definition properties. * * @return the properties value */ @@ -76,7 +76,7 @@ public RoleDefinitionProperties properties() { } /** - * Set the properties value. + * Set role definition properties. * * @param properties the properties value to set * @return the RoleDefinitionInner object itself. diff --git a/authorization/resource-manager/v2015_07_01/src/main/java/com/microsoft/azure/management/authorization/v2015_07_01/implementation/RoleDefinitionsImpl.java b/authorization/resource-manager/v2015_07_01/src/main/java/com/microsoft/azure/management/authorization/v2015_07_01/implementation/RoleDefinitionsImpl.java index 3e209b725f8db..9f870bb615ab4 100644 --- a/authorization/resource-manager/v2015_07_01/src/main/java/com/microsoft/azure/management/authorization/v2015_07_01/implementation/RoleDefinitionsImpl.java +++ b/authorization/resource-manager/v2015_07_01/src/main/java/com/microsoft/azure/management/authorization/v2015_07_01/implementation/RoleDefinitionsImpl.java @@ -11,7 +11,6 @@ import com.microsoft.azure.arm.model.implementation.WrapperImpl; import com.microsoft.azure.management.authorization.v2015_07_01.RoleDefinitions; -import rx.Completable; import rx.functions.Func1; import rx.Observable; import com.microsoft.azure.Page; @@ -43,9 +42,15 @@ private RoleDefinitionImpl wrapModel(String name) { } @Override - public Completable deleteAsync(String scope, String roleDefinitionId) { + public Observable deleteAsync(String scope, String roleDefinitionId) { RoleDefinitionsInner client = this.inner(); - return client.deleteAsync(scope, roleDefinitionId).toCompletable(); + return client.deleteAsync(scope, roleDefinitionId) + .map(new Func1() { + @Override + public RoleDefinition call(RoleDefinitionInner inner) { + return new RoleDefinitionImpl(inner, manager()); + } + }); } @Override @@ -81,7 +86,8 @@ public Observable listAsync(final String scope) { public Iterable call(Page page) { return page.items(); } - }) .map(new Func1() { + }) + .map(new Func1() { @Override public RoleDefinition call(RoleDefinitionInner inner) { return new RoleDefinitionImpl(inner, manager()); diff --git a/authorization/resource-manager/v2015_07_01/src/test/java/com/microsoft/azure/management/authorization/v2015_07_01/AuthorizationTest.java b/authorization/resource-manager/v2015_07_01/src/test/java/com/microsoft/azure/management/authorization/v2015_07_01/AuthorizationTest.java deleted file mode 100644 index 2fa25dc769bb4..0000000000000 --- a/authorization/resource-manager/v2015_07_01/src/test/java/com/microsoft/azure/management/authorization/v2015_07_01/AuthorizationTest.java +++ /dev/null @@ -1,45 +0,0 @@ -/** - * 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 com.microsoft.azure.arm.core.TestBase; -import com.microsoft.azure.management.authorization.v2015_07_01.implementation.AuthorizationManager; -import com.microsoft.azure.management.resources.implementation.ResourceManager; -import com.microsoft.rest.RestClient; -import com.microsoft.azure.arm.utils.SdkContext; -import org.junit.Test; -import org.junit.Assert; -import com.microsoft.azure.arm.resources.Region; -import com.microsoft.azure.management.resources.ResourceGroup; - -public class AuthorizationTest extends TestBase { - protected static ResourceManager resourceManager; - protected static AuthorizationManager authorizationManager; - private static String rgName; - @Override - protected void initializeClients(RestClient restClient, String defaultSubscription, String domain) { - resourceManager = ResourceManager - .authenticate(restClient) - .withSubscription(defaultSubscription); - authorizationManager = AuthorizationManager - .authenticate(restClient, defaultSubscription); - } - @Override - protected void cleanUpResources() { - resourceManager.resourceGroups().deleteByName(rgName); - } - @Test - public void firstTest() { - rgName = SdkContext.randomResourceName("rg", 20); - ResourceGroup group = resourceManager.resourceGroups() - .define(rgName) - .withRegion(Region.US_WEST.toString()) - .create(); - Assert.assertNotNull(group); - } -} diff --git a/authorization/resource-manager/v2018_09_01_preview/pom.xml b/authorization/resource-manager/v2018_09_01_preview/pom.xml new file mode 100644 index 0000000000000..38dd550f1ea5c --- /dev/null +++ b/authorization/resource-manager/v2018_09_01_preview/pom.xml @@ -0,0 +1,133 @@ + + + 4.0.0 + com.microsoft.azure.authorization.v2018_09_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_09_01_preview/src/main/java/com/microsoft/azure/management/authorization/v2018_09_01_preview/ClassicAdministrator.java b/authorization/resource-manager/v2018_09_01_preview/src/main/java/com/microsoft/azure/management/authorization/v2018_09_01_preview/ClassicAdministrator.java new file mode 100644 index 0000000000000..a6b0bc42b7ac0 --- /dev/null +++ b/authorization/resource-manager/v2018_09_01_preview/src/main/java/com/microsoft/azure/management/authorization/v2018_09_01_preview/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.v2018_09_01_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.authorization.v2018_09_01_preview.implementation.ClassicAdministratorInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.authorization.v2018_09_01_preview.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/v2018_09_01_preview/src/main/java/com/microsoft/azure/management/authorization/v2018_09_01_preview/ClassicAdministrators.java b/authorization/resource-manager/v2018_09_01_preview/src/main/java/com/microsoft/azure/management/authorization/v2018_09_01_preview/ClassicAdministrators.java new file mode 100644 index 0000000000000..1e44a421cb617 --- /dev/null +++ b/authorization/resource-manager/v2018_09_01_preview/src/main/java/com/microsoft/azure/management/authorization/v2018_09_01_preview/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.v2018_09_01_preview; + +import com.microsoft.azure.arm.collection.SupportsListing; +import com.microsoft.azure.management.authorization.v2018_09_01_preview.implementation.ClassicAdministratorsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing ClassicAdministrators. + */ +public interface ClassicAdministrators extends SupportsListing, HasInner { +} diff --git a/authorization/resource-manager/v2018_09_01_preview/src/main/java/com/microsoft/azure/management/authorization/v2018_09_01_preview/DenyAssignment.java b/authorization/resource-manager/v2018_09_01_preview/src/main/java/com/microsoft/azure/management/authorization/v2018_09_01_preview/DenyAssignment.java new file mode 100644 index 0000000000000..7dea987f17149 --- /dev/null +++ b/authorization/resource-manager/v2018_09_01_preview/src/main/java/com/microsoft/azure/management/authorization/v2018_09_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_09_01_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.authorization.v2018_09_01_preview.implementation.AuthorizationManager; +import com.microsoft.azure.management.authorization.v2018_09_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_09_01_preview/src/main/java/com/microsoft/azure/management/authorization/v2018_09_01_preview/DenyAssignmentFilter.java b/authorization/resource-manager/v2018_09_01_preview/src/main/java/com/microsoft/azure/management/authorization/v2018_09_01_preview/DenyAssignmentFilter.java new file mode 100644 index 0000000000000..327bdd687668d --- /dev/null +++ b/authorization/resource-manager/v2018_09_01_preview/src/main/java/com/microsoft/azure/management/authorization/v2018_09_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_09_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_09_01_preview/src/main/java/com/microsoft/azure/management/authorization/v2018_09_01_preview/DenyAssignmentPermission.java b/authorization/resource-manager/v2018_09_01_preview/src/main/java/com/microsoft/azure/management/authorization/v2018_09_01_preview/DenyAssignmentPermission.java new file mode 100644 index 0000000000000..03154686f2167 --- /dev/null +++ b/authorization/resource-manager/v2018_09_01_preview/src/main/java/com/microsoft/azure/management/authorization/v2018_09_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_09_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_09_01_preview/src/main/java/com/microsoft/azure/management/authorization/v2018_09_01_preview/DenyAssignments.java b/authorization/resource-manager/v2018_09_01_preview/src/main/java/com/microsoft/azure/management/authorization/v2018_09_01_preview/DenyAssignments.java new file mode 100644 index 0000000000000..ba68b8c0fb9cb --- /dev/null +++ b/authorization/resource-manager/v2018_09_01_preview/src/main/java/com/microsoft/azure/management/authorization/v2018_09_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_09_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_09_01_preview/src/main/java/com/microsoft/azure/management/authorization/v2018_09_01_preview/Permission.java b/authorization/resource-manager/v2018_09_01_preview/src/main/java/com/microsoft/azure/management/authorization/v2018_09_01_preview/Permission.java new file mode 100644 index 0000000000000..8db22450020d7 --- /dev/null +++ b/authorization/resource-manager/v2018_09_01_preview/src/main/java/com/microsoft/azure/management/authorization/v2018_09_01_preview/Permission.java @@ -0,0 +1,41 @@ +/** + * 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 com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.authorization.v2018_09_01_preview.implementation.AuthorizationManager; +import com.microsoft.azure.management.authorization.v2018_09_01_preview.implementation.PermissionInner; +import java.util.List; + +/** + * Type representing Permission. + */ +public interface Permission extends HasInner, HasManager { + /** + * @return the actions value. + */ + List actions(); + + /** + * @return the dataActions value. + */ + List dataActions(); + + /** + * @return the notActions value. + */ + List notActions(); + + /** + * @return the notDataActions value. + */ + List notDataActions(); + +} diff --git a/authorization/resource-manager/v2018_09_01_preview/src/main/java/com/microsoft/azure/management/authorization/v2018_09_01_preview/Permissions.java b/authorization/resource-manager/v2018_09_01_preview/src/main/java/com/microsoft/azure/management/authorization/v2018_09_01_preview/Permissions.java new file mode 100644 index 0000000000000..8d4f72d1f4427 --- /dev/null +++ b/authorization/resource-manager/v2018_09_01_preview/src/main/java/com/microsoft/azure/management/authorization/v2018_09_01_preview/Permissions.java @@ -0,0 +1,39 @@ +/** + * 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.Observable; + +/** + * Type representing Permissions. + */ +public interface Permissions { + /** + * Gets all permissions the caller has 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 the permissions 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); + + /** + * Gets all permissions the caller has 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); + +} diff --git a/authorization/resource-manager/v2018_09_01_preview/src/main/java/com/microsoft/azure/management/authorization/v2018_09_01_preview/Principal.java b/authorization/resource-manager/v2018_09_01_preview/src/main/java/com/microsoft/azure/management/authorization/v2018_09_01_preview/Principal.java new file mode 100644 index 0000000000000..5fe04225c7533 --- /dev/null +++ b/authorization/resource-manager/v2018_09_01_preview/src/main/java/com/microsoft/azure/management/authorization/v2018_09_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_09_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_09_01_preview/src/main/java/com/microsoft/azure/management/authorization/v2018_09_01_preview/PrincipalType.java b/authorization/resource-manager/v2018_09_01_preview/src/main/java/com/microsoft/azure/management/authorization/v2018_09_01_preview/PrincipalType.java new file mode 100644 index 0000000000000..9747a36c36c93 --- /dev/null +++ b/authorization/resource-manager/v2018_09_01_preview/src/main/java/com/microsoft/azure/management/authorization/v2018_09_01_preview/PrincipalType.java @@ -0,0 +1,65 @@ +/** + * 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 java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for PrincipalType. + */ +public final class PrincipalType extends ExpandableStringEnum { + /** Static value User for PrincipalType. */ + public static final PrincipalType USER = fromString("User"); + + /** Static value Group for PrincipalType. */ + public static final PrincipalType GROUP = fromString("Group"); + + /** Static value ServicePrincipal for PrincipalType. */ + public static final PrincipalType SERVICE_PRINCIPAL = fromString("ServicePrincipal"); + + /** Static value Unknown for PrincipalType. */ + public static final PrincipalType UNKNOWN = fromString("Unknown"); + + /** Static value DirectoryRoleTemplate for PrincipalType. */ + public static final PrincipalType DIRECTORY_ROLE_TEMPLATE = fromString("DirectoryRoleTemplate"); + + /** Static value ForeignGroup for PrincipalType. */ + public static final PrincipalType FOREIGN_GROUP = fromString("ForeignGroup"); + + /** Static value Application for PrincipalType. */ + public static final PrincipalType APPLICATION = fromString("Application"); + + /** Static value MSI for PrincipalType. */ + public static final PrincipalType MSI = fromString("MSI"); + + /** Static value DirectoryObjectOrGroup for PrincipalType. */ + public static final PrincipalType DIRECTORY_OBJECT_OR_GROUP = fromString("DirectoryObjectOrGroup"); + + /** Static value Everyone for PrincipalType. */ + public static final PrincipalType EVERYONE = fromString("Everyone"); + + /** + * Creates or finds a PrincipalType from its string representation. + * @param name a name to look for + * @return the corresponding PrincipalType + */ + @JsonCreator + public static PrincipalType fromString(String name) { + return fromString(name, PrincipalType.class); + } + + /** + * @return known PrincipalType values + */ + public static Collection values() { + return values(PrincipalType.class); + } +} diff --git a/authorization/resource-manager/v2018_09_01_preview/src/main/java/com/microsoft/azure/management/authorization/v2018_09_01_preview/ProviderOperation.java b/authorization/resource-manager/v2018_09_01_preview/src/main/java/com/microsoft/azure/management/authorization/v2018_09_01_preview/ProviderOperation.java new file mode 100644 index 0000000000000..3dea27c277c17 --- /dev/null +++ b/authorization/resource-manager/v2018_09_01_preview/src/main/java/com/microsoft/azure/management/authorization/v2018_09_01_preview/ProviderOperation.java @@ -0,0 +1,173 @@ +/** + * 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 com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Operation. + */ +public class ProviderOperation { + /** + * The operation name. + */ + @JsonProperty(value = "name") + private String name; + + /** + * The operation display name. + */ + @JsonProperty(value = "displayName") + private String displayName; + + /** + * The operation description. + */ + @JsonProperty(value = "description") + private String description; + + /** + * The operation origin. + */ + @JsonProperty(value = "origin") + private String origin; + + /** + * The operation properties. + */ + @JsonProperty(value = "properties") + private Object properties; + + /** + * The dataAction flag to specify the operation type. + */ + @JsonProperty(value = "isDataAction") + private Boolean isDataAction; + + /** + * Get the operation name. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set the operation name. + * + * @param name the name value to set + * @return the ProviderOperation object itself. + */ + public ProviderOperation withName(String name) { + this.name = name; + return this; + } + + /** + * Get the operation display name. + * + * @return the displayName value + */ + public String displayName() { + return this.displayName; + } + + /** + * Set the operation display name. + * + * @param displayName the displayName value to set + * @return the ProviderOperation object itself. + */ + public ProviderOperation withDisplayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Get the operation description. + * + * @return the description value + */ + public String description() { + return this.description; + } + + /** + * Set the operation description. + * + * @param description the description value to set + * @return the ProviderOperation object itself. + */ + public ProviderOperation withDescription(String description) { + this.description = description; + return this; + } + + /** + * Get the operation origin. + * + * @return the origin value + */ + public String origin() { + return this.origin; + } + + /** + * Set the operation origin. + * + * @param origin the origin value to set + * @return the ProviderOperation object itself. + */ + public ProviderOperation withOrigin(String origin) { + this.origin = origin; + return this; + } + + /** + * Get the operation properties. + * + * @return the properties value + */ + public Object properties() { + return this.properties; + } + + /** + * Set the operation properties. + * + * @param properties the properties value to set + * @return the ProviderOperation object itself. + */ + public ProviderOperation withProperties(Object properties) { + this.properties = properties; + return this; + } + + /** + * Get the dataAction flag to specify the operation type. + * + * @return the isDataAction value + */ + public Boolean isDataAction() { + return this.isDataAction; + } + + /** + * Set the dataAction flag to specify the operation type. + * + * @param isDataAction the isDataAction value to set + * @return the ProviderOperation object itself. + */ + public ProviderOperation withIsDataAction(Boolean isDataAction) { + this.isDataAction = isDataAction; + return this; + } + +} diff --git a/authorization/resource-manager/v2018_09_01_preview/src/main/java/com/microsoft/azure/management/authorization/v2018_09_01_preview/ProviderOperationsMetadata.java b/authorization/resource-manager/v2018_09_01_preview/src/main/java/com/microsoft/azure/management/authorization/v2018_09_01_preview/ProviderOperationsMetadata.java new file mode 100644 index 0000000000000..de4c7474f3c2c --- /dev/null +++ b/authorization/resource-manager/v2018_09_01_preview/src/main/java/com/microsoft/azure/management/authorization/v2018_09_01_preview/ProviderOperationsMetadata.java @@ -0,0 +1,51 @@ +/** + * 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 com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.authorization.v2018_09_01_preview.implementation.AuthorizationManager; +import com.microsoft.azure.management.authorization.v2018_09_01_preview.implementation.ProviderOperationsMetadataInner; +import java.util.List; + +/** + * Type representing ProviderOperationsMetadata. + */ +public interface ProviderOperationsMetadata extends HasInner, HasManager { + /** + * @return the displayName value. + */ + String displayName(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the operations value. + */ + List operations(); + + /** + * @return the resourceTypes value. + */ + List resourceTypes(); + + /** + * @return the type value. + */ + String type(); + +} diff --git a/authorization/resource-manager/v2018_09_01_preview/src/main/java/com/microsoft/azure/management/authorization/v2018_09_01_preview/ProviderOperationsMetadatas.java b/authorization/resource-manager/v2018_09_01_preview/src/main/java/com/microsoft/azure/management/authorization/v2018_09_01_preview/ProviderOperationsMetadatas.java new file mode 100644 index 0000000000000..54b77c14eed56 --- /dev/null +++ b/authorization/resource-manager/v2018_09_01_preview/src/main/java/com/microsoft/azure/management/authorization/v2018_09_01_preview/ProviderOperationsMetadatas.java @@ -0,0 +1,36 @@ +/** + * 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.Observable; +import com.microsoft.azure.management.authorization.v2018_09_01_preview.implementation.ProviderOperationsMetadatasInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing ProviderOperationsMetadatas. + */ +public interface ProviderOperationsMetadatas extends HasInner { + /** + * Gets provider operations metadata for the specified resource provider. + * + * @param resourceProviderNamespace The namespace of the resource provider. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String resourceProviderNamespace); + + /** + * Gets provider operations metadata for all resource providers. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listAsync(); + +} diff --git a/authorization/resource-manager/v2018_09_01_preview/src/main/java/com/microsoft/azure/management/authorization/v2018_09_01_preview/ResourceType.java b/authorization/resource-manager/v2018_09_01_preview/src/main/java/com/microsoft/azure/management/authorization/v2018_09_01_preview/ResourceType.java new file mode 100644 index 0000000000000..dbbf15cd3c5ea --- /dev/null +++ b/authorization/resource-manager/v2018_09_01_preview/src/main/java/com/microsoft/azure/management/authorization/v2018_09_01_preview/ResourceType.java @@ -0,0 +1,96 @@ +/** + * 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 java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Resource Type. + */ +public class ResourceType { + /** + * The resource type name. + */ + @JsonProperty(value = "name") + private String name; + + /** + * The resource type display name. + */ + @JsonProperty(value = "displayName") + private String displayName; + + /** + * The resource type operations. + */ + @JsonProperty(value = "operations") + private List operations; + + /** + * Get the resource type name. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set the resource type name. + * + * @param name the name value to set + * @return the ResourceType object itself. + */ + public ResourceType withName(String name) { + this.name = name; + return this; + } + + /** + * Get the resource type display name. + * + * @return the displayName value + */ + public String displayName() { + return this.displayName; + } + + /** + * Set the resource type display name. + * + * @param displayName the displayName value to set + * @return the ResourceType object itself. + */ + public ResourceType withDisplayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Get the resource type operations. + * + * @return the operations value + */ + public List operations() { + return this.operations; + } + + /** + * Set the resource type operations. + * + * @param operations the operations value to set + * @return the ResourceType object itself. + */ + public ResourceType withOperations(List operations) { + this.operations = operations; + return this; + } + +} 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 new file mode 100644 index 0000000000000..c94e33be441fb --- /dev/null +++ b/authorization/resource-manager/v2018_09_01_preview/src/main/java/com/microsoft/azure/management/authorization/v2018_09_01_preview/RoleAssignment.java @@ -0,0 +1,189 @@ +/** + * 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 com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.authorization.v2018_09_01_preview.implementation.RoleAssignmentInner; +import com.microsoft.azure.arm.model.Indexable; +import com.microsoft.azure.arm.model.Updatable; +import com.microsoft.azure.arm.model.Appliable; +import com.microsoft.azure.arm.model.Creatable; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.authorization.v2018_09_01_preview.implementation.AuthorizationManager; + +/** + * Type representing RoleAssignment. + */ +public interface RoleAssignment extends HasInner, Indexable, Updatable, HasManager { + /** + * @return the canDelegate value. + */ + Boolean canDelegate(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the principalId value. + */ + String principalId(); + + /** + * @return the roleDefinitionId value. + */ + String roleDefinitionId(); + + /** + * @return the scope value. + */ + String scope(); + + /** + * @return the type value. + */ + String type(); + + /** + * The entirety of the RoleAssignment definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithProvider, DefinitionStages.WithScope, DefinitionStages.WithPrincipalId, DefinitionStages.WithRoleDefinitionId, DefinitionStages.WithCreate { + } + + /** + * Grouping of RoleAssignment definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a RoleAssignment definition. + */ + interface Blank extends WithProvider { + } + + /** + * The stage of the roleassignment definition allowing to specify Provider. + */ + interface WithProvider { + /** + * Specifies . + * @return the next definition stage + */ + WithScope withExistingProvider(); + } + + /** + * The stage of the roleassignment definition allowing to specify Scope. + */ + interface WithScope { + /** + * Specifies scope. + * @param scope The scope of the role assignment to create. The scope can be any REST resource instance. For example, use '/subscriptions/{subscription-id}/' for a subscription, '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}' for a resource group, and '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/providers/{resource-provider}/{resource-type}/{resource-name}' for a resource + * @return the next definition stage + */ + WithPrincipalId withScope(String scope); + } + + /** + * The stage of the roleassignment definition allowing to specify PrincipalId. + */ + interface WithPrincipalId { + /** + * Specifies principalId. + * @param principalId The principal ID assigned to the role. This maps to the ID inside the Active Directory. It can point to a user, service principal, or security group + * @return the next definition stage + */ + WithRoleDefinitionId withPrincipalId(String principalId); + } + + /** + * The stage of the roleassignment definition allowing to specify RoleDefinitionId. + */ + interface WithRoleDefinitionId { + /** + * Specifies roleDefinitionId. + * @param roleDefinitionId The role definition ID used in the role assignment + * @return the next definition stage + */ + WithCreate withRoleDefinitionId(String roleDefinitionId); + } + + /** + * The stage of the roleassignment definition allowing to specify CanDelegate. + */ + interface WithCanDelegate { + /** + * Specifies canDelegate. + * @param canDelegate The delgation flag used for creating a role assignment + * @return the next definition stage + */ + WithCreate withCanDelegate(Boolean canDelegate); + } + + /** + * The stage of the roleassignment definition allowing to specify PrincipalType. + */ + interface WithPrincipalType { + /** + * Specifies principalType. + * @param principalType The principal type of the assigned principal ID. Possible values include: 'User', 'Group', 'ServicePrincipal', 'Unknown', 'DirectoryRoleTemplate', 'ForeignGroup', 'Application', 'MSI', 'DirectoryObjectOrGroup', 'Everyone' + * @return the next definition stage + */ + WithCreate withPrincipalType(PrincipalType principalType); + } + + /** + * The stage of the definition which contains all the minimum required inputs for + * the resource to be created (via {@link WithCreate#create()}), but also allows + * for any other optional settings to be specified. + */ + interface WithCreate extends Creatable, DefinitionStages.WithCanDelegate, DefinitionStages.WithPrincipalType { + } + } + /** + * The template for a RoleAssignment update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithCanDelegate, UpdateStages.WithPrincipalType { + } + + /** + * Grouping of RoleAssignment update stages. + */ + interface UpdateStages { + /** + * The stage of the roleassignment update allowing to specify CanDelegate. + */ + interface WithCanDelegate { + /** + * Specifies canDelegate. + * @param canDelegate The delgation flag used for creating a role assignment + * @return the next update stage + */ + Update withCanDelegate(Boolean canDelegate); + } + + /** + * The stage of the roleassignment update allowing to specify PrincipalType. + */ + interface WithPrincipalType { + /** + * Specifies principalType. + * @param principalType The principal type of the assigned principal ID. Possible values include: 'User', 'Group', 'ServicePrincipal', 'Unknown', 'DirectoryRoleTemplate', 'ForeignGroup', 'Application', 'MSI', 'DirectoryObjectOrGroup', 'Everyone' + * @return the next update stage + */ + Update withPrincipalType(PrincipalType principalType); + } + + } +} 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 new file mode 100644 index 0000000000000..1d03f6918fff5 --- /dev/null +++ b/authorization/resource-manager/v2018_09_01_preview/src/main/java/com/microsoft/azure/management/authorization/v2018_09_01_preview/RoleAssignmentCreateParameters.java @@ -0,0 +1,128 @@ +/** + * 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 com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; + +/** + * Role assignment create parameters. + */ +@JsonFlatten +public class RoleAssignmentCreateParameters { + /** + * The role definition ID used in the role assignment. + */ + @JsonProperty(value = "properties.roleDefinitionId", required = true) + private String roleDefinitionId; + + /** + * The principal ID assigned to the role. This maps to the ID inside the + * Active Directory. It can point to a user, service principal, or security + * group. + */ + @JsonProperty(value = "properties.principalId", required = true) + private String principalId; + + /** + * 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 delgation flag used for creating a role assignment. + */ + @JsonProperty(value = "properties.canDelegate") + private Boolean canDelegate; + + /** + * Get the role definition ID used in the role assignment. + * + * @return the roleDefinitionId value + */ + public String roleDefinitionId() { + return this.roleDefinitionId; + } + + /** + * Set the role definition ID used in the role assignment. + * + * @param roleDefinitionId the roleDefinitionId value to set + * @return the RoleAssignmentCreateParameters object itself. + */ + public RoleAssignmentCreateParameters withRoleDefinitionId(String roleDefinitionId) { + this.roleDefinitionId = roleDefinitionId; + return this; + } + + /** + * Get the principal ID assigned to the role. This maps to the ID inside the Active Directory. It can point to a user, service principal, or security group. + * + * @return the principalId value + */ + public String principalId() { + return this.principalId; + } + + /** + * Set the principal ID assigned to the role. This maps to the ID inside the Active Directory. It can point to a user, service principal, or security group. + * + * @param principalId the principalId value to set + * @return the RoleAssignmentCreateParameters object itself. + */ + public RoleAssignmentCreateParameters withPrincipalId(String principalId) { + this.principalId = principalId; + return this; + } + + /** + * 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 RoleAssignmentCreateParameters object itself. + */ + public RoleAssignmentCreateParameters withPrincipalType(PrincipalType principalType) { + this.principalType = principalType; + return this; + } + + /** + * Get the delgation flag used for creating a role assignment. + * + * @return the canDelegate value + */ + public Boolean canDelegate() { + return this.canDelegate; + } + + /** + * Set the delgation flag used for creating a role assignment. + * + * @param canDelegate the canDelegate value to set + * @return the RoleAssignmentCreateParameters object itself. + */ + public RoleAssignmentCreateParameters withCanDelegate(Boolean canDelegate) { + this.canDelegate = canDelegate; + return this; + } + +} 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 new file mode 100644 index 0000000000000..9c6dbc3123489 --- /dev/null +++ b/authorization/resource-manager/v2018_09_01_preview/src/main/java/com/microsoft/azure/management/authorization/v2018_09_01_preview/RoleAssignmentFilter.java @@ -0,0 +1,69 @@ +/** + * 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 com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Role Assignments filter. + */ +public class RoleAssignmentFilter { + /** + * Returns role assignment of the specific principal. + */ + @JsonProperty(value = "principalId") + private String principalId; + + /** + * The Delegation flag for the roleassignment. + */ + @JsonProperty(value = "canDelegate") + private Boolean canDelegate; + + /** + * Get returns role assignment of the specific principal. + * + * @return the principalId value + */ + public String principalId() { + return this.principalId; + } + + /** + * Set returns role assignment of the specific principal. + * + * @param principalId the principalId value to set + * @return the RoleAssignmentFilter object itself. + */ + public RoleAssignmentFilter withPrincipalId(String principalId) { + this.principalId = principalId; + return this; + } + + /** + * Get the Delegation flag for the roleassignment. + * + * @return the canDelegate value + */ + public Boolean canDelegate() { + return this.canDelegate; + } + + /** + * Set the Delegation flag for the roleassignment. + * + * @param canDelegate the canDelegate value to set + * @return the RoleAssignmentFilter object itself. + */ + public RoleAssignmentFilter withCanDelegate(Boolean canDelegate) { + this.canDelegate = canDelegate; + return this; + } + +} diff --git a/authorization/resource-manager/v2018_09_01_preview/src/main/java/com/microsoft/azure/management/authorization/v2018_09_01_preview/RoleAssignments.java b/authorization/resource-manager/v2018_09_01_preview/src/main/java/com/microsoft/azure/management/authorization/v2018_09_01_preview/RoleAssignments.java new file mode 100644 index 0000000000000..b2239fbf4be6a --- /dev/null +++ b/authorization/resource-manager/v2018_09_01_preview/src/main/java/com/microsoft/azure/management/authorization/v2018_09_01_preview/RoleAssignments.java @@ -0,0 +1,108 @@ +/** + * 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 com.microsoft.azure.arm.collection.SupportsCreating; +import rx.Completable; +import rx.Observable; +import com.microsoft.azure.management.authorization.v2018_09_01_preview.implementation.RoleAssignmentsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing RoleAssignments. + */ +public interface RoleAssignments extends SupportsCreating, HasInner { + /** + * Gets role 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 role 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); + + /** + * Deletes a role assignment. + * + * @param scope The scope of the role assignment to delete. + * @param roleAssignmentName The name of the role assignment to delete. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable deleteAsync(String scope, String roleAssignmentName); + + /** + * Get the specified role assignment. + * + * @param scope The scope of the role assignment. + * @param roleAssignmentName The name of the role assignment to get. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String scope, String roleAssignmentName); + + /** + * Deletes a role assignment. + * + * @param roleId The ID of the role assignment to delete. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable deleteByIdAsync(String roleId); + + /** + * Creates a role assignment by ID. + * + * @param roleId The ID of the role assignment to create. + * @param parameters Parameters for the role assignment. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable createByIdAsync(String roleId, RoleAssignmentCreateParameters parameters); + + /** + * Gets a role assignment by ID. + * + * @param roleId The ID of the role assignment to get. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getByIdAsync(String roleId); + + /** + * Gets role 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 role assignments for the subscription. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listAsync(); + + /** + * Gets role assignments for a scope. + * + * @param scope The scope of the role 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_09_01_preview/src/main/java/com/microsoft/azure/management/authorization/v2018_09_01_preview/RoleDefinition.java b/authorization/resource-manager/v2018_09_01_preview/src/main/java/com/microsoft/azure/management/authorization/v2018_09_01_preview/RoleDefinition.java new file mode 100644 index 0000000000000..f261e50aa074e --- /dev/null +++ b/authorization/resource-manager/v2018_09_01_preview/src/main/java/com/microsoft/azure/management/authorization/v2018_09_01_preview/RoleDefinition.java @@ -0,0 +1,234 @@ +/** + * 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 com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.authorization.v2018_09_01_preview.implementation.RoleDefinitionInner; +import com.microsoft.azure.arm.model.Indexable; +import com.microsoft.azure.arm.model.Creatable; +import com.microsoft.azure.arm.model.Updatable; +import com.microsoft.azure.arm.model.Appliable; +import com.microsoft.azure.arm.model.Refreshable; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.authorization.v2018_09_01_preview.implementation.AuthorizationManager; +import java.util.List; +import com.microsoft.azure.management.authorization.v2018_09_01_preview.implementation.PermissionInner; + +/** + * 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. + */ + String id(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the permissions value. + */ + List permissions(); + + /** + * @return the roleName value. + */ + String roleName(); + + /** + * @return the roleType value. + */ + String roleType(); + + /** + * @return the type value. + */ + String type(); + + /** + * The entirety of the RoleDefinition definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithScope, DefinitionStages.WithCreate { + } + + /** + * Grouping of RoleDefinition definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a RoleDefinition definition. + */ + interface Blank extends WithScope { + } + + /** + * The stage of the roledefinition definition allowing to specify Scope. + */ + interface WithScope { + /** + * Specifies scope. + * @param scope The scope of the role definition + * @return the next definition stage + */ + WithCreate withScope(String scope); + } + + /** + * The stage of the roledefinition definition allowing to specify AssignableScopes. + */ + 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); + } + + /** + * The stage of the definition which contains all the minimum required inputs for + * the resource to be created (via {@link WithCreate#create()}), but also allows + * for any other optional settings to be specified. + */ + interface WithCreate extends Creatable, 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.WithAssignableScopes, UpdateStages.WithDescription, UpdateStages.WithPermissions, UpdateStages.WithRoleName, UpdateStages.WithRoleType { + } + + /** + * Grouping of RoleDefinition update stages. + */ + interface UpdateStages { + /** + * 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 WithRoleType { + /** + * Specifies roleType. + * @param roleType The role type + * @return the next update stage + */ + Update withRoleType(String roleType); + } + + } +} diff --git a/authorization/resource-manager/v2018_09_01_preview/src/main/java/com/microsoft/azure/management/authorization/v2018_09_01_preview/RoleDefinitionFilter.java b/authorization/resource-manager/v2018_09_01_preview/src/main/java/com/microsoft/azure/management/authorization/v2018_09_01_preview/RoleDefinitionFilter.java new file mode 100644 index 0000000000000..568a8794e59ab --- /dev/null +++ b/authorization/resource-manager/v2018_09_01_preview/src/main/java/com/microsoft/azure/management/authorization/v2018_09_01_preview/RoleDefinitionFilter.java @@ -0,0 +1,69 @@ +/** + * 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 com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Role Definitions filter. + */ +public class RoleDefinitionFilter { + /** + * Returns role definition with the specific name. + */ + @JsonProperty(value = "roleName") + private String roleName; + + /** + * Returns role definition with the specific type. + */ + @JsonProperty(value = "type") + private String type; + + /** + * Get returns role definition with the specific name. + * + * @return the roleName value + */ + public String roleName() { + return this.roleName; + } + + /** + * Set returns role definition with the specific name. + * + * @param roleName the roleName value to set + * @return the RoleDefinitionFilter object itself. + */ + public RoleDefinitionFilter withRoleName(String roleName) { + this.roleName = roleName; + return this; + } + + /** + * Get returns role definition with the specific type. + * + * @return the type value + */ + public String type() { + return this.type; + } + + /** + * Set returns role definition with the specific type. + * + * @param type the type value to set + * @return the RoleDefinitionFilter object itself. + */ + public RoleDefinitionFilter withType(String type) { + this.type = type; + return this; + } + +} diff --git a/authorization/resource-manager/v2018_09_01_preview/src/main/java/com/microsoft/azure/management/authorization/v2018_09_01_preview/RoleDefinitions.java b/authorization/resource-manager/v2018_09_01_preview/src/main/java/com/microsoft/azure/management/authorization/v2018_09_01_preview/RoleDefinitions.java new file mode 100644 index 0000000000000..bf72c9bc914a0 --- /dev/null +++ b/authorization/resource-manager/v2018_09_01_preview/src/main/java/com/microsoft/azure/management/authorization/v2018_09_01_preview/RoleDefinitions.java @@ -0,0 +1,59 @@ +/** + * 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 com.microsoft.azure.arm.collection.SupportsCreating; +import rx.Completable; +import rx.Observable; +import com.microsoft.azure.management.authorization.v2018_09_01_preview.implementation.RoleDefinitionsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing RoleDefinitions. + */ +public interface RoleDefinitions extends SupportsCreating, HasInner { + /** + * Deletes a role definition. + * + * @param scope The scope of the role definition. + * @param roleDefinitionId The ID of the role definition to delete. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable deleteAsync(String scope, String roleDefinitionId); + + /** + * Get role definition by name (GUID). + * + * @param scope The scope of the role definition. + * @param roleDefinitionId The ID of the role definition. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String scope, String roleDefinitionId); + + /** + * Gets a role definition by ID. + * + * @param roleId The fully qualified role definition ID. Use the format, /subscriptions/{guid}/providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionId} for subscription level role definitions, or /providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionId} for tenant level role definitions. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getByIdAsync(String roleId); + + /** + * Get all role definitions that are applicable at scope and above. + * + * @param scope The scope of the role definition. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listAsync(final String scope); + +} 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 new file mode 100644 index 0000000000000..77a3552978671 --- /dev/null +++ b/authorization/resource-manager/v2018_09_01_preview/src/main/java/com/microsoft/azure/management/authorization/v2018_09_01_preview/implementation/AuthorizationManagementClientImpl.java @@ -0,0 +1,253 @@ +/** + * 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 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 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; + } + + /** + * The ProviderOperationsMetadatasInner object to access its operations. + */ + private ProviderOperationsMetadatasInner providerOperationsMetadatas; + + /** + * Gets the ProviderOperationsMetadatasInner object to access its operations. + * @return the ProviderOperationsMetadatasInner object. + */ + public ProviderOperationsMetadatasInner providerOperationsMetadatas() { + return this.providerOperationsMetadatas; + } + + /** + * The RoleAssignmentsInner object to access its operations. + */ + private RoleAssignmentsInner roleAssignments; + + /** + * Gets the RoleAssignmentsInner object to access its operations. + * @return the RoleAssignmentsInner object. + */ + public RoleAssignmentsInner roleAssignments() { + return this.roleAssignments; + } + + /** + * The PermissionsInner object to access its operations. + */ + private PermissionsInner permissions; + + /** + * Gets the PermissionsInner object to access its operations. + * @return the PermissionsInner object. + */ + 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 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.acceptLanguage = "en-US"; + this.longRunningOperationRetryTimeout = 30; + this.generateClientRequestId = true; + this.classicAdministrators = new ClassicAdministratorsInner(restClient().retrofit(), this); + this.providerOperationsMetadatas = new ProviderOperationsMetadatasInner(restClient().retrofit(), this); + this.roleAssignments = new RoleAssignmentsInner(restClient().retrofit(), this); + this.permissions = new PermissionsInner(restClient().retrofit(), this); + this.roleDefinitions = new RoleDefinitionsInner(restClient().retrofit(), this); + 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-09-01-preiew"); + } +} 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 new file mode 100644 index 0000000000000..cdf0e699de2b0 --- /dev/null +++ b/authorization/resource-manager/v2018_09_01_preview/src/main/java/com/microsoft/azure/management/authorization/v2018_09_01_preview/implementation/AuthorizationManager.java @@ -0,0 +1,159 @@ +/** + * 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 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_09_01_preview.ClassicAdministrators; +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; +import com.microsoft.azure.management.authorization.v2018_09_01_preview.RoleDefinitions; +import com.microsoft.azure.management.authorization.v2018_09_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 ClassicAdministrators classicAdministrators; + private ProviderOperationsMetadatas providerOperationsMetadatas; + private RoleAssignments roleAssignments; + private Permissions permissions; + private RoleDefinitions roleDefinitions; + 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 ClassicAdministrators. + */ + public ClassicAdministrators classicAdministrators() { + if (this.classicAdministrators == null) { + this.classicAdministrators = new ClassicAdministratorsImpl(this); + } + return this.classicAdministrators; + } + + /** + * @return Entry point to manage ProviderOperationsMetadatas. + */ + public ProviderOperationsMetadatas providerOperationsMetadatas() { + if (this.providerOperationsMetadatas == null) { + this.providerOperationsMetadatas = new ProviderOperationsMetadatasImpl(this); + } + return this.providerOperationsMetadatas; + } + + /** + * @return Entry point to manage RoleAssignments. + */ + public RoleAssignments roleAssignments() { + if (this.roleAssignments == null) { + this.roleAssignments = new RoleAssignmentsImpl(this); + } + return this.roleAssignments; + } + + /** + * @return Entry point to manage Permissions. + */ + public Permissions permissions() { + if (this.permissions == null) { + this.permissions = new PermissionsImpl(this); + } + 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 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_09_01_preview/src/main/java/com/microsoft/azure/management/authorization/v2018_09_01_preview/implementation/ClassicAdministratorImpl.java b/authorization/resource-manager/v2018_09_01_preview/src/main/java/com/microsoft/azure/management/authorization/v2018_09_01_preview/implementation/ClassicAdministratorImpl.java new file mode 100644 index 0000000000000..416a1234f1bef --- /dev/null +++ b/authorization/resource-manager/v2018_09_01_preview/src/main/java/com/microsoft/azure/management/authorization/v2018_09_01_preview/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.v2018_09_01_preview.implementation; + +import com.microsoft.azure.management.authorization.v2018_09_01_preview.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/v2018_09_01_preview/src/main/java/com/microsoft/azure/management/authorization/v2018_09_01_preview/implementation/ClassicAdministratorInner.java b/authorization/resource-manager/v2018_09_01_preview/src/main/java/com/microsoft/azure/management/authorization/v2018_09_01_preview/implementation/ClassicAdministratorInner.java new file mode 100644 index 0000000000000..037f212ed2cbf --- /dev/null +++ b/authorization/resource-manager/v2018_09_01_preview/src/main/java/com/microsoft/azure/management/authorization/v2018_09_01_preview/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.v2018_09_01_preview.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/v2018_09_01_preview/src/main/java/com/microsoft/azure/management/authorization/v2018_09_01_preview/implementation/ClassicAdministratorsImpl.java b/authorization/resource-manager/v2018_09_01_preview/src/main/java/com/microsoft/azure/management/authorization/v2018_09_01_preview/implementation/ClassicAdministratorsImpl.java new file mode 100644 index 0000000000000..8291c80fec832 --- /dev/null +++ b/authorization/resource-manager/v2018_09_01_preview/src/main/java/com/microsoft/azure/management/authorization/v2018_09_01_preview/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.v2018_09_01_preview.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.authorization.v2018_09_01_preview.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.v2018_09_01_preview.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/v2018_09_01_preview/src/main/java/com/microsoft/azure/management/authorization/v2018_09_01_preview/implementation/ClassicAdministratorsInner.java b/authorization/resource-manager/v2018_09_01_preview/src/main/java/com/microsoft/azure/management/authorization/v2018_09_01_preview/implementation/ClassicAdministratorsInner.java new file mode 100644 index 0000000000000..25e2b3886d873 --- /dev/null +++ b/authorization/resource-manager/v2018_09_01_preview/src/main/java/com/microsoft/azure/management/authorization/v2018_09_01_preview/implementation/ClassicAdministratorsInner.java @@ -0,0 +1,285 @@ +/** + * 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.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.v2018_09_01_preview.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.v2018_09_01_preview.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."); + } + final String apiVersion = "2015-06-01"; + return service.list(this.client.subscriptionId(), 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/v2018_09_01_preview/src/main/java/com/microsoft/azure/management/authorization/v2018_09_01_preview/implementation/DenyAssignmentImpl.java b/authorization/resource-manager/v2018_09_01_preview/src/main/java/com/microsoft/azure/management/authorization/v2018_09_01_preview/implementation/DenyAssignmentImpl.java new file mode 100644 index 0000000000000..efdc3105b5599 --- /dev/null +++ b/authorization/resource-manager/v2018_09_01_preview/src/main/java/com/microsoft/azure/management/authorization/v2018_09_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_09_01_preview.implementation; + +import com.microsoft.azure.management.authorization.v2018_09_01_preview.DenyAssignment; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import java.util.List; +import com.microsoft.azure.management.authorization.v2018_09_01_preview.Principal; +import com.microsoft.azure.management.authorization.v2018_09_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_09_01_preview/src/main/java/com/microsoft/azure/management/authorization/v2018_09_01_preview/implementation/DenyAssignmentInner.java b/authorization/resource-manager/v2018_09_01_preview/src/main/java/com/microsoft/azure/management/authorization/v2018_09_01_preview/implementation/DenyAssignmentInner.java new file mode 100644 index 0000000000000..71a29e51c5745 --- /dev/null +++ b/authorization/resource-manager/v2018_09_01_preview/src/main/java/com/microsoft/azure/management/authorization/v2018_09_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_09_01_preview.implementation; + +import java.util.List; +import com.microsoft.azure.management.authorization.v2018_09_01_preview.DenyAssignmentPermission; +import com.microsoft.azure.management.authorization.v2018_09_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_09_01_preview/src/main/java/com/microsoft/azure/management/authorization/v2018_09_01_preview/implementation/DenyAssignmentsImpl.java b/authorization/resource-manager/v2018_09_01_preview/src/main/java/com/microsoft/azure/management/authorization/v2018_09_01_preview/implementation/DenyAssignmentsImpl.java new file mode 100644 index 0000000000000..286574d2ea8c2 --- /dev/null +++ b/authorization/resource-manager/v2018_09_01_preview/src/main/java/com/microsoft/azure/management/authorization/v2018_09_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_09_01_preview.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.authorization.v2018_09_01_preview.DenyAssignments; +import rx.functions.Func1; +import rx.Observable; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.authorization.v2018_09_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_09_01_preview/src/main/java/com/microsoft/azure/management/authorization/v2018_09_01_preview/implementation/DenyAssignmentsInner.java b/authorization/resource-manager/v2018_09_01_preview/src/main/java/com/microsoft/azure/management/authorization/v2018_09_01_preview/implementation/DenyAssignmentsInner.java new file mode 100644 index 0000000000000..887bf27ef6655 --- /dev/null +++ b/authorization/resource-manager/v2018_09_01_preview/src/main/java/com/microsoft/azure/management/authorization/v2018_09_01_preview/implementation/DenyAssignmentsInner.java @@ -0,0 +1,1644 @@ +/** + * 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 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_09_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_09_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_09_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_09_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_09_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_09_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_09_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_09_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_09_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_09_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."); + } + final String apiVersion = "2018-07-01-preview"; + final String filter = null; + return service.listForResource(this.client.subscriptionId(), resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, 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."); + } + final String apiVersion = "2018-07-01-preview"; + return service.listForResource(this.client.subscriptionId(), resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, 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."); + } + final String apiVersion = "2018-07-01-preview"; + final String filter = null; + return service.listByResourceGroup(this.client.subscriptionId(), resourceGroupName, 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."); + } + final String apiVersion = "2018-07-01-preview"; + return service.listByResourceGroup(this.client.subscriptionId(), resourceGroupName, 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."); + } + final String apiVersion = "2018-07-01-preview"; + final String filter = null; + return service.list(this.client.subscriptionId(), 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."); + } + final String apiVersion = "2018-07-01-preview"; + return service.list(this.client.subscriptionId(), 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."); + } + final String apiVersion = "2018-07-01-preview"; + return service.get(scope, denyAssignmentId, 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."); + } + final String apiVersion = "2018-07-01-preview"; + return service.getById(denyAssignmentId, 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."); + } + final String apiVersion = "2018-07-01-preview"; + final String filter = null; + return service.listForScope(scope, 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."); + } + final String apiVersion = "2018-07-01-preview"; + return service.listForScope(scope, 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_09_01_preview/src/main/java/com/microsoft/azure/management/authorization/v2018_09_01_preview/implementation/IdParsingUtils.java b/authorization/resource-manager/v2018_09_01_preview/src/main/java/com/microsoft/azure/management/authorization/v2018_09_01_preview/implementation/IdParsingUtils.java new file mode 100644 index 0000000000000..09d80e98ebcf5 --- /dev/null +++ b/authorization/resource-manager/v2018_09_01_preview/src/main/java/com/microsoft/azure/management/authorization/v2018_09_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_09_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_09_01_preview/src/main/java/com/microsoft/azure/management/authorization/v2018_09_01_preview/implementation/PageImpl.java b/authorization/resource-manager/v2018_09_01_preview/src/main/java/com/microsoft/azure/management/authorization/v2018_09_01_preview/implementation/PageImpl.java new file mode 100644 index 0000000000000..f7c350095f400 --- /dev/null +++ b/authorization/resource-manager/v2018_09_01_preview/src/main/java/com/microsoft/azure/management/authorization/v2018_09_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_09_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_09_01_preview/src/main/java/com/microsoft/azure/management/authorization/v2018_09_01_preview/implementation/PermissionImpl.java b/authorization/resource-manager/v2018_09_01_preview/src/main/java/com/microsoft/azure/management/authorization/v2018_09_01_preview/implementation/PermissionImpl.java new file mode 100644 index 0000000000000..2fd2a9698a728 --- /dev/null +++ b/authorization/resource-manager/v2018_09_01_preview/src/main/java/com/microsoft/azure/management/authorization/v2018_09_01_preview/implementation/PermissionImpl.java @@ -0,0 +1,47 @@ +/** + * 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 com.microsoft.azure.management.authorization.v2018_09_01_preview.Permission; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import java.util.List; + +class PermissionImpl extends WrapperImpl implements Permission { + private final AuthorizationManager manager; + PermissionImpl(PermissionInner inner, AuthorizationManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public AuthorizationManager manager() { + return this.manager; + } + + @Override + public List actions() { + return this.inner().actions(); + } + + @Override + public List dataActions() { + return this.inner().dataActions(); + } + + @Override + public List notActions() { + return this.inner().notActions(); + } + + @Override + public List notDataActions() { + return this.inner().notDataActions(); + } + +} diff --git a/authorization/resource-manager/v2018_09_01_preview/src/main/java/com/microsoft/azure/management/authorization/v2018_09_01_preview/implementation/PermissionInner.java b/authorization/resource-manager/v2018_09_01_preview/src/main/java/com/microsoft/azure/management/authorization/v2018_09_01_preview/implementation/PermissionInner.java new file mode 100644 index 0000000000000..769e62f64ff79 --- /dev/null +++ b/authorization/resource-manager/v2018_09_01_preview/src/main/java/com/microsoft/azure/management/authorization/v2018_09_01_preview/implementation/PermissionInner.java @@ -0,0 +1,122 @@ +/** + * 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 java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Role definition permissions. + */ +public class PermissionInner { + /** + * Allowed actions. + */ + @JsonProperty(value = "actions") + private List actions; + + /** + * Denied actions. + */ + @JsonProperty(value = "notActions") + private List notActions; + + /** + * Allowed Data actions. + */ + @JsonProperty(value = "dataActions") + private List dataActions; + + /** + * Denied Data actions. + */ + @JsonProperty(value = "notDataActions") + private List notDataActions; + + /** + * Get allowed actions. + * + * @return the actions value + */ + public List actions() { + return this.actions; + } + + /** + * Set allowed actions. + * + * @param actions the actions value to set + * @return the PermissionInner object itself. + */ + public PermissionInner withActions(List actions) { + this.actions = actions; + return this; + } + + /** + * Get denied actions. + * + * @return the notActions value + */ + public List notActions() { + return this.notActions; + } + + /** + * Set denied actions. + * + * @param notActions the notActions value to set + * @return the PermissionInner object itself. + */ + public PermissionInner withNotActions(List notActions) { + this.notActions = notActions; + return this; + } + + /** + * Get allowed Data actions. + * + * @return the dataActions value + */ + public List dataActions() { + return this.dataActions; + } + + /** + * Set allowed Data actions. + * + * @param dataActions the dataActions value to set + * @return the PermissionInner object itself. + */ + public PermissionInner withDataActions(List dataActions) { + this.dataActions = dataActions; + return this; + } + + /** + * Get denied Data actions. + * + * @return the notDataActions value + */ + public List notDataActions() { + return this.notDataActions; + } + + /** + * Set denied Data actions. + * + * @param notDataActions the notDataActions value to set + * @return the PermissionInner object itself. + */ + public PermissionInner withNotDataActions(List notDataActions) { + this.notDataActions = notDataActions; + return this; + } + +} diff --git a/authorization/resource-manager/v2018_09_01_preview/src/main/java/com/microsoft/azure/management/authorization/v2018_09_01_preview/implementation/PermissionsImpl.java b/authorization/resource-manager/v2018_09_01_preview/src/main/java/com/microsoft/azure/management/authorization/v2018_09_01_preview/implementation/PermissionsImpl.java new file mode 100644 index 0000000000000..c46e07fa13efd --- /dev/null +++ b/authorization/resource-manager/v2018_09_01_preview/src/main/java/com/microsoft/azure/management/authorization/v2018_09_01_preview/implementation/PermissionsImpl.java @@ -0,0 +1,67 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * 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.Permissions; +import rx.functions.Func1; +import rx.Observable; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.authorization.v2018_09_01_preview.Permission; + +class PermissionsImpl extends WrapperImpl implements Permissions { + private final AuthorizationManager manager; + + PermissionsImpl(AuthorizationManager manager) { + super(manager.inner().permissions()); + 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) { + PermissionsInner 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 Permission call(PermissionInner inner) { + return new PermissionImpl(inner, manager()); + } + }); + } + + @Override + public Observable listByResourceGroupAsync(final String resourceGroupName) { + PermissionsInner 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 Permission call(PermissionInner inner) { + return new PermissionImpl(inner, manager()); + } + }); + } + +} diff --git a/authorization/resource-manager/v2018_09_01_preview/src/main/java/com/microsoft/azure/management/authorization/v2018_09_01_preview/implementation/PermissionsInner.java b/authorization/resource-manager/v2018_09_01_preview/src/main/java/com/microsoft/azure/management/authorization/v2018_09_01_preview/implementation/PermissionsInner.java new file mode 100644 index 0000000000000..babe3db4f91e7 --- /dev/null +++ b/authorization/resource-manager/v2018_09_01_preview/src/main/java/com/microsoft/azure/management/authorization/v2018_09_01_preview/implementation/PermissionsInner.java @@ -0,0 +1,557 @@ +/** + * 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.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 Permissions. + */ +public class PermissionsInner { + /** The Retrofit service to perform REST calls. */ + private PermissionsService service; + /** The service client containing this operation class. */ + private AuthorizationManagementClientImpl client; + + /** + * Initializes an instance of PermissionsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public PermissionsInner(Retrofit retrofit, AuthorizationManagementClientImpl client) { + this.service = retrofit.create(PermissionsService.class); + this.client = client; + } + + /** + * The interface defining all the services for Permissions to be + * used by Retrofit to perform actually REST calls. + */ + interface PermissionsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.authorization.v2018_09_01_preview.Permissions listByResourceGroup" }) + @GET("subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Authorization/permissions") + Observable> listByResourceGroup(@Path("resourceGroupName") String resourceGroupName, @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.v2018_09_01_preview.Permissions listForResource" }) + @GET("subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}/providers/Microsoft.Authorization/permissions") + Observable> listForResource(@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, @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.v2018_09_01_preview.Permissions 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_09_01_preview.Permissions listForResourceNext" }) + @GET + Observable> listForResourceNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Gets all permissions the caller has 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<PermissionInner> 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 all permissions the caller has 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 all permissions the caller has 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<PermissionInner> object + */ + public Observable> listByResourceGroupAsync(final String resourceGroupName) { + return listByResourceGroupWithServiceResponseAsync(resourceGroupName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets all permissions the caller has 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<PermissionInner> 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 all permissions the caller has for a resource group. + * + ServiceResponse> * @param resourceGroupName The name of the resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<PermissionInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByResourceGroupSinglePageAsync(final String resourceGroupName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + final String apiVersion = "2018-01-01-preview"; + return service.listByResourceGroup(resourceGroupName, this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByResourceGroupDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByResourceGroupDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Gets all permissions the caller has 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 the permissions 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<PermissionInner> 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 all permissions the caller has 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 the permissions 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 all permissions the caller has 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 the permissions for. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PermissionInner> 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 all permissions the caller has 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 the permissions for. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PermissionInner> 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 all permissions the caller has 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 the permissions for. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<PermissionInner> 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 (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.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + final String apiVersion = "2018-01-01-preview"; + return service.listForResource(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, this.client.subscriptionId(), apiVersion, 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 all permissions the caller has 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<PermissionInner> 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 all permissions the caller has 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 all permissions the caller has 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<PermissionInner> object + */ + public Observable> listByResourceGroupNextAsync(final String nextPageLink) { + return listByResourceGroupNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets all permissions the caller has 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<PermissionInner> 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 all permissions the caller has 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<PermissionInner> 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 permissions the caller has 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<PermissionInner> 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 all permissions the caller has 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 all permissions the caller has 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<PermissionInner> object + */ + public Observable> listForResourceNextAsync(final String nextPageLink) { + return listForResourceNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets all permissions the caller has 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<PermissionInner> 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 all permissions the caller has 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<PermissionInner> 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); + } + +} diff --git a/authorization/resource-manager/v2018_09_01_preview/src/main/java/com/microsoft/azure/management/authorization/v2018_09_01_preview/implementation/ProviderOperationsMetadataImpl.java b/authorization/resource-manager/v2018_09_01_preview/src/main/java/com/microsoft/azure/management/authorization/v2018_09_01_preview/implementation/ProviderOperationsMetadataImpl.java new file mode 100644 index 0000000000000..b6b7c0a0ffc6e --- /dev/null +++ b/authorization/resource-manager/v2018_09_01_preview/src/main/java/com/microsoft/azure/management/authorization/v2018_09_01_preview/implementation/ProviderOperationsMetadataImpl.java @@ -0,0 +1,59 @@ +/** + * 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 com.microsoft.azure.management.authorization.v2018_09_01_preview.ProviderOperationsMetadata; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import java.util.List; +import com.microsoft.azure.management.authorization.v2018_09_01_preview.ProviderOperation; +import com.microsoft.azure.management.authorization.v2018_09_01_preview.ResourceType; + +class ProviderOperationsMetadataImpl extends WrapperImpl implements ProviderOperationsMetadata { + private final AuthorizationManager manager; + ProviderOperationsMetadataImpl(ProviderOperationsMetadataInner inner, AuthorizationManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public AuthorizationManager manager() { + return this.manager; + } + + @Override + public String displayName() { + return this.inner().displayName(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public List operations() { + return this.inner().operations(); + } + + @Override + public List resourceTypes() { + return this.inner().resourceTypes(); + } + + @Override + public String type() { + return this.inner().type(); + } + +} diff --git a/authorization/resource-manager/v2018_09_01_preview/src/main/java/com/microsoft/azure/management/authorization/v2018_09_01_preview/implementation/ProviderOperationsMetadataInner.java b/authorization/resource-manager/v2018_09_01_preview/src/main/java/com/microsoft/azure/management/authorization/v2018_09_01_preview/implementation/ProviderOperationsMetadataInner.java new file mode 100644 index 0000000000000..a79e2db5cf41f --- /dev/null +++ b/authorization/resource-manager/v2018_09_01_preview/src/main/java/com/microsoft/azure/management/authorization/v2018_09_01_preview/implementation/ProviderOperationsMetadataInner.java @@ -0,0 +1,176 @@ +/** + * 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 java.util.List; +import com.microsoft.azure.management.authorization.v2018_09_01_preview.ResourceType; +import com.microsoft.azure.management.authorization.v2018_09_01_preview.ProviderOperation; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Provider Operations metadata. + */ +public class ProviderOperationsMetadataInner { + /** + * The provider id. + */ + @JsonProperty(value = "id") + private String id; + + /** + * The provider name. + */ + @JsonProperty(value = "name") + private String name; + + /** + * The provider type. + */ + @JsonProperty(value = "type") + private String type; + + /** + * The provider display name. + */ + @JsonProperty(value = "displayName") + private String displayName; + + /** + * The provider resource types. + */ + @JsonProperty(value = "resourceTypes") + private List resourceTypes; + + /** + * The provider operations. + */ + @JsonProperty(value = "operations") + private List operations; + + /** + * Get the provider id. + * + * @return the id value + */ + public String id() { + return this.id; + } + + /** + * Set the provider id. + * + * @param id the id value to set + * @return the ProviderOperationsMetadataInner object itself. + */ + public ProviderOperationsMetadataInner withId(String id) { + this.id = id; + return this; + } + + /** + * Get the provider name. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set the provider name. + * + * @param name the name value to set + * @return the ProviderOperationsMetadataInner object itself. + */ + public ProviderOperationsMetadataInner withName(String name) { + this.name = name; + return this; + } + + /** + * Get the provider type. + * + * @return the type value + */ + public String type() { + return this.type; + } + + /** + * Set the provider type. + * + * @param type the type value to set + * @return the ProviderOperationsMetadataInner object itself. + */ + public ProviderOperationsMetadataInner withType(String type) { + this.type = type; + return this; + } + + /** + * Get the provider display name. + * + * @return the displayName value + */ + public String displayName() { + return this.displayName; + } + + /** + * Set the provider display name. + * + * @param displayName the displayName value to set + * @return the ProviderOperationsMetadataInner object itself. + */ + public ProviderOperationsMetadataInner withDisplayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Get the provider resource types. + * + * @return the resourceTypes value + */ + public List resourceTypes() { + return this.resourceTypes; + } + + /** + * Set the provider resource types. + * + * @param resourceTypes the resourceTypes value to set + * @return the ProviderOperationsMetadataInner object itself. + */ + public ProviderOperationsMetadataInner withResourceTypes(List resourceTypes) { + this.resourceTypes = resourceTypes; + return this; + } + + /** + * Get the provider operations. + * + * @return the operations value + */ + public List operations() { + return this.operations; + } + + /** + * Set the provider operations. + * + * @param operations the operations value to set + * @return the ProviderOperationsMetadataInner object itself. + */ + public ProviderOperationsMetadataInner withOperations(List operations) { + this.operations = operations; + return this; + } + +} diff --git a/authorization/resource-manager/v2018_09_01_preview/src/main/java/com/microsoft/azure/management/authorization/v2018_09_01_preview/implementation/ProviderOperationsMetadatasImpl.java b/authorization/resource-manager/v2018_09_01_preview/src/main/java/com/microsoft/azure/management/authorization/v2018_09_01_preview/implementation/ProviderOperationsMetadatasImpl.java new file mode 100644 index 0000000000000..0f6b4e1766a6d --- /dev/null +++ b/authorization/resource-manager/v2018_09_01_preview/src/main/java/com/microsoft/azure/management/authorization/v2018_09_01_preview/implementation/ProviderOperationsMetadatasImpl.java @@ -0,0 +1,61 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * 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.ProviderOperationsMetadatas; +import rx.functions.Func1; +import rx.Observable; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.authorization.v2018_09_01_preview.ProviderOperationsMetadata; + +class ProviderOperationsMetadatasImpl extends WrapperImpl implements ProviderOperationsMetadatas { + private final AuthorizationManager manager; + + ProviderOperationsMetadatasImpl(AuthorizationManager manager) { + super(manager.inner().providerOperationsMetadatas()); + this.manager = manager; + } + + public AuthorizationManager manager() { + return this.manager; + } + + @Override + public Observable getAsync(String resourceProviderNamespace) { + ProviderOperationsMetadatasInner client = this.inner(); + return client.getAsync(resourceProviderNamespace) + .map(new Func1() { + @Override + public ProviderOperationsMetadata call(ProviderOperationsMetadataInner inner) { + return new ProviderOperationsMetadataImpl(inner, manager()); + } + }); + } + + @Override + public Observable listAsync() { + ProviderOperationsMetadatasInner client = this.inner(); + return client.listAsync() + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public ProviderOperationsMetadata call(ProviderOperationsMetadataInner inner) { + return new ProviderOperationsMetadataImpl(inner, manager()); + } + }); + } + +} diff --git a/authorization/resource-manager/v2018_09_01_preview/src/main/java/com/microsoft/azure/management/authorization/v2018_09_01_preview/implementation/ProviderOperationsMetadatasInner.java b/authorization/resource-manager/v2018_09_01_preview/src/main/java/com/microsoft/azure/management/authorization/v2018_09_01_preview/implementation/ProviderOperationsMetadatasInner.java new file mode 100644 index 0000000000000..f87f1506b2a55 --- /dev/null +++ b/authorization/resource-manager/v2018_09_01_preview/src/main/java/com/microsoft/azure/management/authorization/v2018_09_01_preview/implementation/ProviderOperationsMetadatasInner.java @@ -0,0 +1,534 @@ +/** + * 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.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 ProviderOperationsMetadatas. + */ +public class ProviderOperationsMetadatasInner { + /** The Retrofit service to perform REST calls. */ + private ProviderOperationsMetadatasService service; + /** The service client containing this operation class. */ + private AuthorizationManagementClientImpl client; + + /** + * Initializes an instance of ProviderOperationsMetadatasInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public ProviderOperationsMetadatasInner(Retrofit retrofit, AuthorizationManagementClientImpl client) { + this.service = retrofit.create(ProviderOperationsMetadatasService.class); + this.client = client; + } + + /** + * The interface defining all the services for ProviderOperationsMetadatas to be + * used by Retrofit to perform actually REST calls. + */ + interface ProviderOperationsMetadatasService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.authorization.v2018_09_01_preview.ProviderOperationsMetadatas get" }) + @GET("providers/Microsoft.Authorization/providerOperations/{resourceProviderNamespace}") + Observable> get(@Path("resourceProviderNamespace") String resourceProviderNamespace, @Query("api-version") String apiVersion, @Query("$expand") String expand, @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_09_01_preview.ProviderOperationsMetadatas list" }) + @GET("providers/Microsoft.Authorization/providerOperations") + Observable> list(@Query("api-version") String apiVersion, @Query("$expand") String expand, @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_09_01_preview.ProviderOperationsMetadatas listNext" }) + @GET + Observable> listNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Gets provider operations metadata for the specified resource provider. + * + * @param resourceProviderNamespace The namespace of the resource provider. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ProviderOperationsMetadataInner object if successful. + */ + public ProviderOperationsMetadataInner get(String resourceProviderNamespace) { + return getWithServiceResponseAsync(resourceProviderNamespace).toBlocking().single().body(); + } + + /** + * Gets provider operations metadata for the specified resource provider. + * + * @param resourceProviderNamespace The namespace of the resource provider. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getAsync(String resourceProviderNamespace, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceProviderNamespace), serviceCallback); + } + + /** + * Gets provider operations metadata for the specified resource provider. + * + * @param resourceProviderNamespace The namespace of the resource provider. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ProviderOperationsMetadataInner object + */ + public Observable getAsync(String resourceProviderNamespace) { + return getWithServiceResponseAsync(resourceProviderNamespace).map(new Func1, ProviderOperationsMetadataInner>() { + @Override + public ProviderOperationsMetadataInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets provider operations metadata for the specified resource provider. + * + * @param resourceProviderNamespace The namespace of the resource provider. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ProviderOperationsMetadataInner object + */ + public Observable> getWithServiceResponseAsync(String resourceProviderNamespace) { + if (resourceProviderNamespace == null) { + throw new IllegalArgumentException("Parameter resourceProviderNamespace is required and cannot be null."); + } + final String apiVersion = "2018-01-01-preview"; + final String expand = null; + return service.get(resourceProviderNamespace, apiVersion, expand, 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); + } + } + }); + } + + /** + * Gets provider operations metadata for the specified resource provider. + * + * @param resourceProviderNamespace The namespace of the resource provider. + * @param expand Specifies whether to expand the values. + * @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 ProviderOperationsMetadataInner object if successful. + */ + public ProviderOperationsMetadataInner get(String resourceProviderNamespace, String expand) { + return getWithServiceResponseAsync(resourceProviderNamespace, expand).toBlocking().single().body(); + } + + /** + * Gets provider operations metadata for the specified resource provider. + * + * @param resourceProviderNamespace The namespace of the resource provider. + * @param expand Specifies whether to expand the values. + * @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 resourceProviderNamespace, String expand, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceProviderNamespace, expand), serviceCallback); + } + + /** + * Gets provider operations metadata for the specified resource provider. + * + * @param resourceProviderNamespace The namespace of the resource provider. + * @param expand Specifies whether to expand the values. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ProviderOperationsMetadataInner object + */ + public Observable getAsync(String resourceProviderNamespace, String expand) { + return getWithServiceResponseAsync(resourceProviderNamespace, expand).map(new Func1, ProviderOperationsMetadataInner>() { + @Override + public ProviderOperationsMetadataInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets provider operations metadata for the specified resource provider. + * + * @param resourceProviderNamespace The namespace of the resource provider. + * @param expand Specifies whether to expand the values. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ProviderOperationsMetadataInner object + */ + public Observable> getWithServiceResponseAsync(String resourceProviderNamespace, String expand) { + if (resourceProviderNamespace == null) { + throw new IllegalArgumentException("Parameter resourceProviderNamespace is required and cannot be null."); + } + final String apiVersion = "2018-01-01-preview"; + return service.get(resourceProviderNamespace, apiVersion, expand, 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 provider operations metadata for all resource providers. + * + * @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<ProviderOperationsMetadataInner> 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 provider operations metadata for all resource providers. + * + * @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 provider operations metadata for all resource providers. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ProviderOperationsMetadataInner> object + */ + public Observable> listAsync() { + return listWithServiceResponseAsync() + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets provider operations metadata for all resource providers. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ProviderOperationsMetadataInner> 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 provider operations metadata for all resource providers. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ProviderOperationsMetadataInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync() { + final String apiVersion = "2018-01-01-preview"; + final String expand = null; + return service.list(apiVersion, expand, 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 provider operations metadata for all resource providers. + * + * @param expand Specifies whether to expand the values. + * @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<ProviderOperationsMetadataInner> object if successful. + */ + public PagedList list(final String expand) { + ServiceResponse> response = listSinglePageAsync(expand).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets provider operations metadata for all resource providers. + * + * @param expand Specifies whether to expand the values. + * @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 expand, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(expand), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets provider operations metadata for all resource providers. + * + * @param expand Specifies whether to expand the values. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ProviderOperationsMetadataInner> object + */ + public Observable> listAsync(final String expand) { + return listWithServiceResponseAsync(expand) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets provider operations metadata for all resource providers. + * + * @param expand Specifies whether to expand the values. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ProviderOperationsMetadataInner> object + */ + public Observable>> listWithServiceResponseAsync(final String expand) { + return listSinglePageAsync(expand) + .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 provider operations metadata for all resource providers. + * + ServiceResponse> * @param expand Specifies whether to expand the values. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ProviderOperationsMetadataInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync(final String expand) { + final String apiVersion = "2018-01-01-preview"; + return service.list(apiVersion, expand, 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 { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Gets provider operations metadata for all resource providers. + * + * @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<ProviderOperationsMetadataInner> 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 provider operations metadata for all resource providers. + * + * @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 provider operations metadata for all resource providers. + * + * @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<ProviderOperationsMetadataInner> object + */ + public Observable> listNextAsync(final String nextPageLink) { + return listNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets provider operations metadata for all resource providers. + * + * @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<ProviderOperationsMetadataInner> 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 provider operations metadata for all resource providers. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ProviderOperationsMetadataInner> 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/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 new file mode 100644 index 0000000000000..5fd31a21099fd --- /dev/null +++ b/authorization/resource-manager/v2018_09_01_preview/src/main/java/com/microsoft/azure/management/authorization/v2018_09_01_preview/implementation/RoleAssignmentImpl.java @@ -0,0 +1,163 @@ +/** + * 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 com.microsoft.azure.management.authorization.v2018_09_01_preview.RoleAssignment; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import com.microsoft.azure.management.authorization.v2018_09_01_preview.RoleAssignmentCreateParameters; +import com.microsoft.azure.management.authorization.v2018_09_01_preview.PrincipalType; +import rx.functions.Func1; + +class RoleAssignmentImpl extends CreatableUpdatableImpl implements RoleAssignment, RoleAssignment.Definition, RoleAssignment.Update { + private final AuthorizationManager manager; + private String scope; + private String roleAssignmentName; + private RoleAssignmentCreateParameters createOrUpdateParameter; + + RoleAssignmentImpl(String name, AuthorizationManager manager) { + super(name, new RoleAssignmentInner()); + this.manager = manager; + // Set resource name + this.roleAssignmentName = name; + // + this.createOrUpdateParameter = new RoleAssignmentCreateParameters(); + } + + RoleAssignmentImpl(RoleAssignmentInner inner, AuthorizationManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.roleAssignmentName = inner.name(); + // set resource ancestor and positional variables + this.roleAssignmentName = IdParsingUtils.getValueFromIdByName(inner.id(), "roleAssignments"); + this.scope = IdParsingUtils.getValueFromIdByPosition(inner.id(), 0); + // + this.createOrUpdateParameter = new RoleAssignmentCreateParameters(); + } + + @Override + public AuthorizationManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + RoleAssignmentsInner client = this.manager().inner().roleAssignments(); + return client.createAsync(this.scope, this.roleAssignmentName, this.createOrUpdateParameter) + .map(new Func1() { + @Override + public RoleAssignmentInner call(RoleAssignmentInner resource) { + resetCreateUpdateParameters(); + return resource; + } + }) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + RoleAssignmentsInner client = this.manager().inner().roleAssignments(); + return client.createAsync(this.scope, this.roleAssignmentName, this.createOrUpdateParameter) + .map(new Func1() { + @Override + public RoleAssignmentInner call(RoleAssignmentInner resource) { + resetCreateUpdateParameters(); + return resource; + } + }) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + RoleAssignmentsInner client = this.manager().inner().roleAssignments(); + return null; // NOP getInnerAsync implementation as get is not supported + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + private void resetCreateUpdateParameters() { + this.createOrUpdateParameter = new RoleAssignmentCreateParameters(); + } + + @Override + public Boolean canDelegate() { + return this.inner().canDelegate(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public String principalId() { + return this.inner().principalId(); + } + + @Override + public String roleDefinitionId() { + return this.inner().roleDefinitionId(); + } + + @Override + public String scope() { + return this.inner().scope(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public RoleAssignmentImpl withExistingProvider() { + return this; + } + + @Override + public RoleAssignmentImpl withScope(String scope) { + this.scope = scope; + return this; + } + + @Override + public RoleAssignmentImpl withPrincipalId(String principalId) { + this.createOrUpdateParameter.withPrincipalId(principalId); + return this; + } + + @Override + public RoleAssignmentImpl withRoleDefinitionId(String roleDefinitionId) { + this.createOrUpdateParameter.withRoleDefinitionId(roleDefinitionId); + return this; + } + + @Override + public RoleAssignmentImpl withCanDelegate(Boolean canDelegate) { + this.createOrUpdateParameter.withCanDelegate(canDelegate); + return this; + } + + @Override + public RoleAssignmentImpl withPrincipalType(PrincipalType principalType) { + this.createOrUpdateParameter.withPrincipalType(principalType); + return this; + } + +} 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 new file mode 100644 index 0000000000000..cf55ba4fe6b32 --- /dev/null +++ b/authorization/resource-manager/v2018_09_01_preview/src/main/java/com/microsoft/azure/management/authorization/v2018_09_01_preview/implementation/RoleAssignmentInner.java @@ -0,0 +1,168 @@ +/** + * 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 com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; + +/** + * Role Assignments. + */ +@JsonFlatten +public class RoleAssignmentInner { + /** + * The role assignment ID. + */ + @JsonProperty(value = "id", access = JsonProperty.Access.WRITE_ONLY) + private String id; + + /** + * The role assignment name. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /** + * The role assignment type. + */ + @JsonProperty(value = "type", access = JsonProperty.Access.WRITE_ONLY) + private String type; + + /** + * The role assignment scope. + */ + @JsonProperty(value = "properties.scope") + private String scope; + + /** + * The role definition ID. + */ + @JsonProperty(value = "properties.roleDefinitionId") + private String roleDefinitionId; + + /** + * The principal ID. + */ + @JsonProperty(value = "properties.principalId") + private String principalId; + + /** + * The Delegation flag for the roleassignment. + */ + @JsonProperty(value = "properties.canDelegate") + private Boolean canDelegate; + + /** + * Get the role assignment ID. + * + * @return the id value + */ + public String id() { + return this.id; + } + + /** + * Get the role assignment name. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Get the role assignment type. + * + * @return the type value + */ + public String type() { + return this.type; + } + + /** + * Get the role assignment scope. + * + * @return the scope value + */ + public String scope() { + return this.scope; + } + + /** + * Set the role assignment scope. + * + * @param scope the scope value to set + * @return the RoleAssignmentInner object itself. + */ + public RoleAssignmentInner withScope(String scope) { + this.scope = scope; + return this; + } + + /** + * Get the role definition ID. + * + * @return the roleDefinitionId value + */ + public String roleDefinitionId() { + return this.roleDefinitionId; + } + + /** + * Set the role definition ID. + * + * @param roleDefinitionId the roleDefinitionId value to set + * @return the RoleAssignmentInner object itself. + */ + public RoleAssignmentInner withRoleDefinitionId(String roleDefinitionId) { + this.roleDefinitionId = roleDefinitionId; + return this; + } + + /** + * Get the principal ID. + * + * @return the principalId value + */ + public String principalId() { + return this.principalId; + } + + /** + * Set the principal ID. + * + * @param principalId the principalId value to set + * @return the RoleAssignmentInner object itself. + */ + public RoleAssignmentInner withPrincipalId(String principalId) { + this.principalId = principalId; + return this; + } + + /** + * Get the Delegation flag for the roleassignment. + * + * @return the canDelegate value + */ + public Boolean canDelegate() { + return this.canDelegate; + } + + /** + * Set the Delegation flag for the roleassignment. + * + * @param canDelegate the canDelegate value to set + * @return the RoleAssignmentInner object itself. + */ + public RoleAssignmentInner withCanDelegate(Boolean canDelegate) { + this.canDelegate = canDelegate; + return this; + } + +} diff --git a/authorization/resource-manager/v2018_09_01_preview/src/main/java/com/microsoft/azure/management/authorization/v2018_09_01_preview/implementation/RoleAssignmentsImpl.java b/authorization/resource-manager/v2018_09_01_preview/src/main/java/com/microsoft/azure/management/authorization/v2018_09_01_preview/implementation/RoleAssignmentsImpl.java new file mode 100644 index 0000000000000..ed97f5261414c --- /dev/null +++ b/authorization/resource-manager/v2018_09_01_preview/src/main/java/com/microsoft/azure/management/authorization/v2018_09_01_preview/implementation/RoleAssignmentsImpl.java @@ -0,0 +1,177 @@ +/** + * 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 com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.authorization.v2018_09_01_preview.RoleAssignments; +import rx.functions.Func1; +import rx.Observable; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.authorization.v2018_09_01_preview.RoleAssignment; +import com.microsoft.azure.management.authorization.v2018_09_01_preview.RoleAssignmentCreateParameters; + +class RoleAssignmentsImpl extends WrapperImpl implements RoleAssignments { + private final AuthorizationManager manager; + + RoleAssignmentsImpl(AuthorizationManager manager) { + super(manager.inner().roleAssignments()); + this.manager = manager; + } + + public AuthorizationManager manager() { + return this.manager; + } + + @Override + public RoleAssignmentImpl define(String name) { + return wrapModel(name); + } + + private RoleAssignmentImpl wrapModel(RoleAssignmentInner inner) { + return new RoleAssignmentImpl(inner, manager()); + } + + private RoleAssignmentImpl wrapModel(String name) { + return new RoleAssignmentImpl(name, this.manager()); + } + + @Override + public Observable listForResourceAsync(final String resourceGroupName, final String resourceProviderNamespace, final String parentResourcePath, final String resourceType, final String resourceName) { + RoleAssignmentsInner 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 RoleAssignment call(RoleAssignmentInner inner) { + return new RoleAssignmentImpl(inner, manager()); + } + }); + } + + @Override + public Observable deleteAsync(String scope, String roleAssignmentName) { + RoleAssignmentsInner client = this.inner(); + return client.deleteAsync(scope, roleAssignmentName) + .map(new Func1() { + @Override + public RoleAssignment call(RoleAssignmentInner inner) { + return new RoleAssignmentImpl(inner, manager()); + } + }); + } + + @Override + public Observable getAsync(String scope, String roleAssignmentName) { + RoleAssignmentsInner client = this.inner(); + return client.getAsync(scope, roleAssignmentName) + .map(new Func1() { + @Override + public RoleAssignment call(RoleAssignmentInner inner) { + return new RoleAssignmentImpl(inner, manager()); + } + }); + } + + @Override + public Observable deleteByIdAsync(String roleId) { + RoleAssignmentsInner client = this.inner(); + return client.deleteByIdAsync(roleId) + .map(new Func1() { + @Override + public RoleAssignment call(RoleAssignmentInner inner) { + return new RoleAssignmentImpl(inner, manager()); + } + }); + } + + @Override + public Observable createByIdAsync(String roleId, RoleAssignmentCreateParameters parameters) { + RoleAssignmentsInner client = this.inner(); + return client.createByIdAsync(roleId, parameters) + .map(new Func1() { + @Override + public RoleAssignment call(RoleAssignmentInner inner) { + return new RoleAssignmentImpl(inner, manager()); + } + }); + } + + @Override + public Observable getByIdAsync(String roleId) { + RoleAssignmentsInner client = this.inner(); + return client.getByIdAsync(roleId) + .map(new Func1() { + @Override + public RoleAssignment call(RoleAssignmentInner inner) { + return new RoleAssignmentImpl(inner, manager()); + } + }); + } + + @Override + public Observable listByResourceGroupAsync(final String resourceGroupName) { + RoleAssignmentsInner 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 RoleAssignment call(RoleAssignmentInner inner) { + return new RoleAssignmentImpl(inner, manager()); + } + }); + } + + @Override + public Observable listAsync() { + RoleAssignmentsInner client = this.inner(); + return client.listAsync() + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public RoleAssignment call(RoleAssignmentInner inner) { + return new RoleAssignmentImpl(inner, manager()); + } + }); + } + + @Override + public Observable listForScopeAsync(final String scope) { + RoleAssignmentsInner 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 RoleAssignment call(RoleAssignmentInner inner) { + return new RoleAssignmentImpl(inner, manager()); + } + }); + } + +} diff --git a/authorization/resource-manager/v2018_09_01_preview/src/main/java/com/microsoft/azure/management/authorization/v2018_09_01_preview/implementation/RoleAssignmentsInner.java b/authorization/resource-manager/v2018_09_01_preview/src/main/java/com/microsoft/azure/management/authorization/v2018_09_01_preview/implementation/RoleAssignmentsInner.java new file mode 100644 index 0000000000000..62e94e4ba771e --- /dev/null +++ b/authorization/resource-manager/v2018_09_01_preview/src/main/java/com/microsoft/azure/management/authorization/v2018_09_01_preview/implementation/RoleAssignmentsInner.java @@ -0,0 +1,1992 @@ +/** + * 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 com.microsoft.azure.arm.collection.InnerSupportsDelete; +import com.microsoft.azure.arm.collection.InnerSupportsListing; +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.CloudException; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.management.authorization.v2018_09_01_preview.RoleAssignmentCreateParameters; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import com.microsoft.rest.Validator; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.Body; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.HTTP; +import retrofit2.http.Path; +import retrofit2.http.PUT; +import retrofit2.http.Query; +import retrofit2.http.Url; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in RoleAssignments. + */ +public class RoleAssignmentsInner implements InnerSupportsDelete, InnerSupportsListing { + /** The Retrofit service to perform REST calls. */ + private RoleAssignmentsService service; + /** The service client containing this operation class. */ + private AuthorizationManagementClientImpl client; + + /** + * Initializes an instance of RoleAssignmentsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public RoleAssignmentsInner(Retrofit retrofit, AuthorizationManagementClientImpl client) { + this.service = retrofit.create(RoleAssignmentsService.class); + this.client = client; + } + + /** + * The interface defining all the services for RoleAssignments to be + * used by Retrofit to perform actually REST calls. + */ + interface RoleAssignmentsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.authorization.v2018_09_01_preview.RoleAssignments listForResource" }) + @GET("subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}/providers/Microsoft.Authorization/roleAssignments") + Observable> listForResource(@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, @Path("subscriptionId") String subscriptionId, @Query("$filter") String filter, @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_09_01_preview.RoleAssignments listByResourceGroup" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Authorization/roleAssignments") + Observable> listByResourceGroup(@Path("resourceGroupName") String resourceGroupName, @Path("subscriptionId") String subscriptionId, @Query("$filter") String filter, @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_09_01_preview.RoleAssignments delete" }) + @HTTP(path = "{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}", method = "DELETE", hasBody = true) + Observable> delete(@Path(value = "scope", encoded = true) String scope, @Path("roleAssignmentName") String roleAssignmentName, @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_09_01_preview.RoleAssignments create" }) + @PUT("{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}") + Observable> create(@Path(value = "scope", encoded = true) String scope, @Path("roleAssignmentName") String roleAssignmentName, @Body RoleAssignmentCreateParameters parameters, @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_09_01_preview.RoleAssignments get" }) + @GET("{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}") + Observable> get(@Path(value = "scope", encoded = true) String scope, @Path("roleAssignmentName") String roleAssignmentName, @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_09_01_preview.RoleAssignments deleteById" }) + @HTTP(path = "{roleId}", method = "DELETE", hasBody = true) + Observable> deleteById(@Path(value = "roleId", encoded = true) String roleId, @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_09_01_preview.RoleAssignments createById" }) + @PUT("{roleId}") + Observable> createById(@Path(value = "roleId", encoded = true) String roleId, @Body RoleAssignmentCreateParameters parameters, @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_09_01_preview.RoleAssignments getById" }) + @GET("{roleId}") + Observable> getById(@Path(value = "roleId", encoded = true) String roleId, @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_09_01_preview.RoleAssignments list" }) + @GET("subscriptions/{subscriptionId}/providers/Microsoft.Authorization/roleAssignments") + Observable> list(@Path("subscriptionId") String subscriptionId, @Query("$filter") String filter, @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_09_01_preview.RoleAssignments listForScope" }) + @GET("{scope}/providers/Microsoft.Authorization/roleAssignments") + Observable> listForScope(@Path(value = "scope", encoded = true) String scope, @Query("$filter") String filter, @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_09_01_preview.RoleAssignments 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_09_01_preview.RoleAssignments 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_09_01_preview.RoleAssignments 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_09_01_preview.RoleAssignments listForScopeNext" }) + @GET + Observable> listForScopeNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Gets role 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 role 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<RoleAssignmentInner> 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 role 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 role 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 role 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 role assignments for. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<RoleAssignmentInner> 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 role 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 role assignments for. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<RoleAssignmentInner> 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 role 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 role assignments for. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<RoleAssignmentInner> 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 (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.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + final String apiVersion = "2018-09-01-preview"; + final String filter = null; + return service.listForResource(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, this.client.subscriptionId(), filter, apiVersion, 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 role 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 role assignments for. + * @param filter The filter to apply on the operation. Use $filter=atScope() to return all role assignments at or above the scope. Use $filter=principalId eq {id} to return all role assignments at, above or below the scope for the specified principal. + * @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<RoleAssignmentInner> 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 role 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 role assignments for. + * @param filter The filter to apply on the operation. Use $filter=atScope() to return all role assignments at or above the scope. Use $filter=principalId eq {id} to return all role assignments at, above or below the scope for the specified principal. + * @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 role 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 role assignments for. + * @param filter The filter to apply on the operation. Use $filter=atScope() to return all role assignments at or above the scope. Use $filter=principalId eq {id} to return all role assignments at, above or below the scope for the specified principal. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<RoleAssignmentInner> 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 role 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 role assignments for. + * @param filter The filter to apply on the operation. Use $filter=atScope() to return all role assignments at or above the scope. Use $filter=principalId eq {id} to return all role assignments at, above or below the scope for the specified principal. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<RoleAssignmentInner> 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 role 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 role assignments for. + ServiceResponse> * @param filter The filter to apply on the operation. Use $filter=atScope() to return all role assignments at or above the scope. Use $filter=principalId eq {id} to return all role assignments at, above or below the scope for the specified principal. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<RoleAssignmentInner> 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 (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.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + final String apiVersion = "2018-09-01-preview"; + return service.listForResource(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, this.client.subscriptionId(), filter, apiVersion, 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 role 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<RoleAssignmentInner> 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 role 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 role 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<RoleAssignmentInner> object + */ + public Observable> listByResourceGroupAsync(final String resourceGroupName) { + return listByResourceGroupWithServiceResponseAsync(resourceGroupName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets role 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<RoleAssignmentInner> 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 role assignments for a resource group. + * + * @param resourceGroupName The name of the resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<RoleAssignmentInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByResourceGroupSinglePageAsync(final String resourceGroupName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + final String apiVersion = "2018-09-01-preview"; + final String filter = null; + return service.listByResourceGroup(resourceGroupName, this.client.subscriptionId(), filter, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByResourceGroupDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Gets role 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 role assignments at or above the scope. Use $filter=principalId eq {id} to return all role assignments at, above or below the scope for the specified principal. + * @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<RoleAssignmentInner> 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 role 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 role assignments at or above the scope. Use $filter=principalId eq {id} to return all role assignments at, above or below the scope for the specified principal. + * @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 role 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 role assignments at or above the scope. Use $filter=principalId eq {id} to return all role assignments at, above or below the scope for the specified principal. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<RoleAssignmentInner> 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 role 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 role assignments at or above the scope. Use $filter=principalId eq {id} to return all role assignments at, above or below the scope for the specified principal. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<RoleAssignmentInner> 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 role 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 role assignments at or above the scope. Use $filter=principalId eq {id} to return all role assignments at, above or below the scope for the specified principal. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<RoleAssignmentInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByResourceGroupSinglePageAsync(final String resourceGroupName, final String filter) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + final String apiVersion = "2018-09-01-preview"; + return service.listByResourceGroup(resourceGroupName, this.client.subscriptionId(), filter, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByResourceGroupDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByResourceGroupDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Deletes a role assignment. + * + * @param scope The scope of the role assignment to delete. + * @param roleAssignmentName The name of the role assignment to delete. + * @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 RoleAssignmentInner object if successful. + */ + public RoleAssignmentInner delete(String scope, String roleAssignmentName) { + return deleteWithServiceResponseAsync(scope, roleAssignmentName).toBlocking().single().body(); + } + + /** + * Deletes a role assignment. + * + * @param scope The scope of the role assignment to delete. + * @param roleAssignmentName The name of the role assignment to delete. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture deleteAsync(String scope, String roleAssignmentName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(scope, roleAssignmentName), serviceCallback); + } + + /** + * Deletes a role assignment. + * + * @param scope The scope of the role assignment to delete. + * @param roleAssignmentName The name of the role assignment to delete. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the RoleAssignmentInner object + */ + public Observable deleteAsync(String scope, String roleAssignmentName) { + return deleteWithServiceResponseAsync(scope, roleAssignmentName).map(new Func1, RoleAssignmentInner>() { + @Override + public RoleAssignmentInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes a role assignment. + * + * @param scope The scope of the role assignment to delete. + * @param roleAssignmentName The name of the role assignment to delete. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the RoleAssignmentInner object + */ + public Observable> deleteWithServiceResponseAsync(String scope, String roleAssignmentName) { + if (scope == null) { + throw new IllegalArgumentException("Parameter scope is required and cannot be null."); + } + if (roleAssignmentName == null) { + throw new IllegalArgumentException("Parameter roleAssignmentName is required and cannot be null."); + } + final String apiVersion = "2018-09-01-preview"; + return service.delete(scope, roleAssignmentName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = deleteDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse deleteDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Creates a role assignment. + * + * @param scope The scope of the role assignment to create. The scope can be any REST resource instance. For example, use '/subscriptions/{subscription-id}/' for a subscription, '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}' for a resource group, and '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/providers/{resource-provider}/{resource-type}/{resource-name}' for a resource. + * @param roleAssignmentName The name of the role assignment to create. It can be any valid GUID. + * @param parameters Parameters for the role assignment. + * @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 RoleAssignmentInner object if successful. + */ + public RoleAssignmentInner create(String scope, String roleAssignmentName, RoleAssignmentCreateParameters parameters) { + return createWithServiceResponseAsync(scope, roleAssignmentName, parameters).toBlocking().single().body(); + } + + /** + * Creates a role assignment. + * + * @param scope The scope of the role assignment to create. The scope can be any REST resource instance. For example, use '/subscriptions/{subscription-id}/' for a subscription, '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}' for a resource group, and '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/providers/{resource-provider}/{resource-type}/{resource-name}' for a resource. + * @param roleAssignmentName The name of the role assignment to create. It can be any valid GUID. + * @param parameters Parameters for the role assignment. + * @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 createAsync(String scope, String roleAssignmentName, RoleAssignmentCreateParameters parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createWithServiceResponseAsync(scope, roleAssignmentName, parameters), serviceCallback); + } + + /** + * Creates a role assignment. + * + * @param scope The scope of the role assignment to create. The scope can be any REST resource instance. For example, use '/subscriptions/{subscription-id}/' for a subscription, '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}' for a resource group, and '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/providers/{resource-provider}/{resource-type}/{resource-name}' for a resource. + * @param roleAssignmentName The name of the role assignment to create. It can be any valid GUID. + * @param parameters Parameters for the role assignment. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the RoleAssignmentInner object + */ + public Observable createAsync(String scope, String roleAssignmentName, RoleAssignmentCreateParameters parameters) { + return createWithServiceResponseAsync(scope, roleAssignmentName, parameters).map(new Func1, RoleAssignmentInner>() { + @Override + public RoleAssignmentInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates a role assignment. + * + * @param scope The scope of the role assignment to create. The scope can be any REST resource instance. For example, use '/subscriptions/{subscription-id}/' for a subscription, '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}' for a resource group, and '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/providers/{resource-provider}/{resource-type}/{resource-name}' for a resource. + * @param roleAssignmentName The name of the role assignment to create. It can be any valid GUID. + * @param parameters Parameters for the role assignment. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the RoleAssignmentInner object + */ + public Observable> createWithServiceResponseAsync(String scope, String roleAssignmentName, RoleAssignmentCreateParameters parameters) { + if (scope == null) { + throw new IllegalArgumentException("Parameter scope is required and cannot be null."); + } + if (roleAssignmentName == null) { + throw new IllegalArgumentException("Parameter roleAssignmentName is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + Validator.validate(parameters); + final String apiVersion = "2018-09-01-preview"; + return service.create(scope, roleAssignmentName, parameters, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = createDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse createDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(201, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Get the specified role assignment. + * + * @param scope The scope of the role assignment. + * @param roleAssignmentName The name of the role 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 RoleAssignmentInner object if successful. + */ + public RoleAssignmentInner get(String scope, String roleAssignmentName) { + return getWithServiceResponseAsync(scope, roleAssignmentName).toBlocking().single().body(); + } + + /** + * Get the specified role assignment. + * + * @param scope The scope of the role assignment. + * @param roleAssignmentName The name of the role 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 roleAssignmentName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(scope, roleAssignmentName), serviceCallback); + } + + /** + * Get the specified role assignment. + * + * @param scope The scope of the role assignment. + * @param roleAssignmentName The name of the role assignment to get. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the RoleAssignmentInner object + */ + public Observable getAsync(String scope, String roleAssignmentName) { + return getWithServiceResponseAsync(scope, roleAssignmentName).map(new Func1, RoleAssignmentInner>() { + @Override + public RoleAssignmentInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Get the specified role assignment. + * + * @param scope The scope of the role assignment. + * @param roleAssignmentName The name of the role assignment to get. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the RoleAssignmentInner object + */ + public Observable> getWithServiceResponseAsync(String scope, String roleAssignmentName) { + if (scope == null) { + throw new IllegalArgumentException("Parameter scope is required and cannot be null."); + } + if (roleAssignmentName == null) { + throw new IllegalArgumentException("Parameter roleAssignmentName is required and cannot be null."); + } + final String apiVersion = "2018-09-01-preview"; + return service.get(scope, roleAssignmentName, 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); + } + + /** + * Deletes a role assignment. + * + * @param roleId The ID of the role assignment to delete. + * @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 RoleAssignmentInner object if successful. + */ + public RoleAssignmentInner deleteById(String roleId) { + return deleteByIdWithServiceResponseAsync(roleId).toBlocking().single().body(); + } + + /** + * Deletes a role assignment. + * + * @param roleId The ID of the role assignment to delete. + * @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 deleteByIdAsync(String roleId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteByIdWithServiceResponseAsync(roleId), serviceCallback); + } + + /** + * Deletes a role assignment. + * + * @param roleId The ID of the role assignment to delete. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the RoleAssignmentInner object + */ + public Observable deleteByIdAsync(String roleId) { + return deleteByIdWithServiceResponseAsync(roleId).map(new Func1, RoleAssignmentInner>() { + @Override + public RoleAssignmentInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes a role assignment. + * + * @param roleId The ID of the role assignment to delete. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the RoleAssignmentInner object + */ + public Observable> deleteByIdWithServiceResponseAsync(String roleId) { + if (roleId == null) { + throw new IllegalArgumentException("Parameter roleId is required and cannot be null."); + } + final String apiVersion = "2018-09-01-preview"; + return service.deleteById(roleId, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = deleteByIdDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse deleteByIdDelegate(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); + } + + /** + * Creates a role assignment by ID. + * + * @param roleId The ID of the role assignment to create. + * @param parameters Parameters for the role assignment. + * @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 RoleAssignmentInner object if successful. + */ + public RoleAssignmentInner createById(String roleId, RoleAssignmentCreateParameters parameters) { + return createByIdWithServiceResponseAsync(roleId, parameters).toBlocking().single().body(); + } + + /** + * Creates a role assignment by ID. + * + * @param roleId The ID of the role assignment to create. + * @param parameters Parameters for the role assignment. + * @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 createByIdAsync(String roleId, RoleAssignmentCreateParameters parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createByIdWithServiceResponseAsync(roleId, parameters), serviceCallback); + } + + /** + * Creates a role assignment by ID. + * + * @param roleId The ID of the role assignment to create. + * @param parameters Parameters for the role assignment. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the RoleAssignmentInner object + */ + public Observable createByIdAsync(String roleId, RoleAssignmentCreateParameters parameters) { + return createByIdWithServiceResponseAsync(roleId, parameters).map(new Func1, RoleAssignmentInner>() { + @Override + public RoleAssignmentInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates a role assignment by ID. + * + * @param roleId The ID of the role assignment to create. + * @param parameters Parameters for the role assignment. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the RoleAssignmentInner object + */ + public Observable> createByIdWithServiceResponseAsync(String roleId, RoleAssignmentCreateParameters parameters) { + if (roleId == null) { + throw new IllegalArgumentException("Parameter roleId is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + Validator.validate(parameters); + final String apiVersion = "2018-09-01-preview"; + return service.createById(roleId, parameters, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = createByIdDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse createByIdDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(201, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Gets a role assignment by ID. + * + * @param roleId The ID of the role 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 RoleAssignmentInner object if successful. + */ + public RoleAssignmentInner getById(String roleId) { + return getByIdWithServiceResponseAsync(roleId).toBlocking().single().body(); + } + + /** + * Gets a role assignment by ID. + * + * @param roleId The ID of the role 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 getByIdAsync(String roleId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getByIdWithServiceResponseAsync(roleId), serviceCallback); + } + + /** + * Gets a role assignment by ID. + * + * @param roleId The ID of the role assignment to get. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the RoleAssignmentInner object + */ + public Observable getByIdAsync(String roleId) { + return getByIdWithServiceResponseAsync(roleId).map(new Func1, RoleAssignmentInner>() { + @Override + public RoleAssignmentInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets a role assignment by ID. + * + * @param roleId The ID of the role assignment to get. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the RoleAssignmentInner object + */ + public Observable> getByIdWithServiceResponseAsync(String roleId) { + if (roleId == null) { + throw new IllegalArgumentException("Parameter roleId is required and cannot be null."); + } + final String apiVersion = "2018-09-01-preview"; + return service.getById(roleId, 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 all role 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<RoleAssignmentInner> 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 role 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 role assignments for the subscription. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<RoleAssignmentInner> object + */ + public Observable> listAsync() { + return listWithServiceResponseAsync() + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets all role assignments for the subscription. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<RoleAssignmentInner> 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 role assignments for the subscription. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<RoleAssignmentInner> 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."); + } + final String apiVersion = "2018-09-01-preview"; + final String filter = null; + return service.list(this.client.subscriptionId(), filter, 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); + } + } + }); + } + + /** + * Gets all role assignments for the subscription. + * + * @param filter The filter to apply on the operation. Use $filter=atScope() to return all role assignments at or above the scope. Use $filter=principalId eq {id} to return all role assignments at, above or below the scope for the specified principal. + * @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<RoleAssignmentInner> 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 role assignments for the subscription. + * + * @param filter The filter to apply on the operation. Use $filter=atScope() to return all role assignments at or above the scope. Use $filter=principalId eq {id} to return all role assignments at, above or below the scope for the specified principal. + * @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 role assignments for the subscription. + * + * @param filter The filter to apply on the operation. Use $filter=atScope() to return all role assignments at or above the scope. Use $filter=principalId eq {id} to return all role assignments at, above or below the scope for the specified principal. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<RoleAssignmentInner> 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 role assignments for the subscription. + * + * @param filter The filter to apply on the operation. Use $filter=atScope() to return all role assignments at or above the scope. Use $filter=principalId eq {id} to return all role assignments at, above or below the scope for the specified principal. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<RoleAssignmentInner> 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 role assignments for the subscription. + * + ServiceResponse> * @param filter The filter to apply on the operation. Use $filter=atScope() to return all role assignments at or above the scope. Use $filter=principalId eq {id} to return all role assignments at, above or below the scope for the specified principal. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<RoleAssignmentInner> 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."); + } + final String apiVersion = "2018-09-01-preview"; + return service.list(this.client.subscriptionId(), filter, 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 role assignments for a scope. + * + * @param scope The scope of the role 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<RoleAssignmentInner> 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 role assignments for a scope. + * + * @param scope The scope of the role 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 role assignments for a scope. + * + * @param scope The scope of the role assignments. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<RoleAssignmentInner> object + */ + public Observable> listForScopeAsync(final String scope) { + return listForScopeWithServiceResponseAsync(scope) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets role assignments for a scope. + * + * @param scope The scope of the role assignments. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<RoleAssignmentInner> 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 role assignments for a scope. + * + * @param scope The scope of the role assignments. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<RoleAssignmentInner> 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."); + } + final String apiVersion = "2018-09-01-preview"; + final String filter = null; + return service.listForScope(scope, filter, apiVersion, 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 role assignments for a scope. + * + * @param scope The scope of the role assignments. + * @param filter The filter to apply on the operation. Use $filter=atScope() to return all role assignments at or above the scope. Use $filter=principalId eq {id} to return all role assignments at, above or below the scope for the specified principal. + * @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<RoleAssignmentInner> 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 role assignments for a scope. + * + * @param scope The scope of the role assignments. + * @param filter The filter to apply on the operation. Use $filter=atScope() to return all role assignments at or above the scope. Use $filter=principalId eq {id} to return all role assignments at, above or below the scope for the specified principal. + * @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 role assignments for a scope. + * + * @param scope The scope of the role assignments. + * @param filter The filter to apply on the operation. Use $filter=atScope() to return all role assignments at or above the scope. Use $filter=principalId eq {id} to return all role assignments at, above or below the scope for the specified principal. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<RoleAssignmentInner> 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 role assignments for a scope. + * + * @param scope The scope of the role assignments. + * @param filter The filter to apply on the operation. Use $filter=atScope() to return all role assignments at or above the scope. Use $filter=principalId eq {id} to return all role assignments at, above or below the scope for the specified principal. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<RoleAssignmentInner> 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 role assignments for a scope. + * + ServiceResponse> * @param scope The scope of the role assignments. + ServiceResponse> * @param filter The filter to apply on the operation. Use $filter=atScope() to return all role assignments at or above the scope. Use $filter=principalId eq {id} to return all role assignments at, above or below the scope for the specified principal. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<RoleAssignmentInner> 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."); + } + final String apiVersion = "2018-09-01-preview"; + return service.listForScope(scope, filter, apiVersion, 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 role 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<RoleAssignmentInner> 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 role 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 role 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<RoleAssignmentInner> object + */ + public Observable> listForResourceNextAsync(final String nextPageLink) { + return listForResourceNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets role 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<RoleAssignmentInner> 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 role 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<RoleAssignmentInner> 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 role 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<RoleAssignmentInner> 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 role 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 role 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<RoleAssignmentInner> object + */ + public Observable> listByResourceGroupNextAsync(final String nextPageLink) { + return listByResourceGroupNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets role 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<RoleAssignmentInner> 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 role 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<RoleAssignmentInner> 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 role 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<RoleAssignmentInner> 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 role 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 role 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<RoleAssignmentInner> 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 role 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<RoleAssignmentInner> 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 role 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<RoleAssignmentInner> 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 role 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<RoleAssignmentInner> 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 role 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 role 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<RoleAssignmentInner> object + */ + public Observable> listForScopeNextAsync(final String nextPageLink) { + return listForScopeNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets role 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<RoleAssignmentInner> 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 role 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<RoleAssignmentInner> 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_09_01_preview/src/main/java/com/microsoft/azure/management/authorization/v2018_09_01_preview/implementation/RoleDefinitionImpl.java b/authorization/resource-manager/v2018_09_01_preview/src/main/java/com/microsoft/azure/management/authorization/v2018_09_01_preview/implementation/RoleDefinitionImpl.java new file mode 100644 index 0000000000000..534bc1d2a5c1d --- /dev/null +++ b/authorization/resource-manager/v2018_09_01_preview/src/main/java/com/microsoft/azure/management/authorization/v2018_09_01_preview/implementation/RoleDefinitionImpl.java @@ -0,0 +1,156 @@ +/** + * 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 com.microsoft.azure.management.authorization.v2018_09_01_preview.RoleDefinition; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import java.util.List; +import java.util.ArrayList; +import com.microsoft.azure.management.authorization.v2018_09_01_preview.Permission; + +class RoleDefinitionImpl extends CreatableUpdatableImpl implements RoleDefinition, RoleDefinition.Definition, RoleDefinition.Update { + private String scope; + private String roleDefinitionId; + private final AuthorizationManager manager; + + RoleDefinitionImpl(String name, AuthorizationManager manager) { + super(name, new RoleDefinitionInner()); + this.manager = manager; + // Set resource name + this.roleDefinitionId = name; + // + } + + RoleDefinitionImpl(RoleDefinitionInner inner, AuthorizationManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.roleDefinitionId = inner.name(); + // set resource ancestor and positional variables + this.roleDefinitionId = IdParsingUtils.getValueFromIdByName(inner.id(), "roleDefinitions"); + this.scope = IdParsingUtils.getValueFromIdByPosition(inner.id(), 0); + // set other parameters for create and update + } + + @Override + public AuthorizationManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + RoleDefinitionsInner client = this.manager().inner().roleDefinitions(); + 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.inner()) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + RoleDefinitionsInner client = this.manager().inner().roleDefinitions(); + return client.getAsync(this.scope, this.roleDefinitionId); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + + @Override + public List assignableScopes() { + return this.inner().assignableScopes(); + } + + @Override + public String description() { + return this.inner().description(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + 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 + public String type() { + return this.inner().type(); + } + + @Override + public RoleDefinitionImpl withScope(String scope) { + this.scope = scope; + return this; + } + + @Override + 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/v2018_09_01_preview/src/main/java/com/microsoft/azure/management/authorization/v2018_09_01_preview/implementation/RoleDefinitionInner.java b/authorization/resource-manager/v2018_09_01_preview/src/main/java/com/microsoft/azure/management/authorization/v2018_09_01_preview/implementation/RoleDefinitionInner.java new file mode 100644 index 0000000000000..8e5d2224353a8 --- /dev/null +++ b/authorization/resource-manager/v2018_09_01_preview/src/main/java/com/microsoft/azure/management/authorization/v2018_09_01_preview/implementation/RoleDefinitionInner.java @@ -0,0 +1,195 @@ +/** + * 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 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. + */ + @JsonProperty(value = "id", access = JsonProperty.Access.WRITE_ONLY) + private String id; + + /** + * The role definition name. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /** + * The role definition type. + */ + @JsonProperty(value = "type", access = JsonProperty.Access.WRITE_ONLY) + private String type; + + /** + * The role name. + */ + @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. + * + * @return the id value + */ + public String id() { + return this.id; + } + + /** + * Get the role definition name. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Get the role definition type. + * + * @return the type value + */ + public String type() { + return this.type; + } + + /** + * 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 assignableScopes value + */ + public List assignableScopes() { + return this.assignableScopes; + } + + /** + * Set role definition assignable scopes. + * + * @param assignableScopes the assignableScopes value to set + * @return the RoleDefinitionInner object itself. + */ + public RoleDefinitionInner withAssignableScopes(List assignableScopes) { + this.assignableScopes = assignableScopes; + return this; + } + +} diff --git a/authorization/resource-manager/v2018_09_01_preview/src/main/java/com/microsoft/azure/management/authorization/v2018_09_01_preview/implementation/RoleDefinitionsImpl.java b/authorization/resource-manager/v2018_09_01_preview/src/main/java/com/microsoft/azure/management/authorization/v2018_09_01_preview/implementation/RoleDefinitionsImpl.java new file mode 100644 index 0000000000000..4202f268384c0 --- /dev/null +++ b/authorization/resource-manager/v2018_09_01_preview/src/main/java/com/microsoft/azure/management/authorization/v2018_09_01_preview/implementation/RoleDefinitionsImpl.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. + * jkl + */ + +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.RoleDefinitions; +import rx.functions.Func1; +import rx.Observable; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.authorization.v2018_09_01_preview.RoleDefinition; + +class RoleDefinitionsImpl extends WrapperImpl implements RoleDefinitions { + private final AuthorizationManager manager; + + RoleDefinitionsImpl(AuthorizationManager manager) { + super(manager.inner().roleDefinitions()); + this.manager = manager; + } + + public AuthorizationManager manager() { + return this.manager; + } + + @Override + public RoleDefinitionImpl define(String name) { + return wrapModel(name); + } + + private RoleDefinitionImpl wrapModel(RoleDefinitionInner inner) { + return new RoleDefinitionImpl(inner, manager()); + } + + private RoleDefinitionImpl wrapModel(String name) { + return new RoleDefinitionImpl(name, this.manager()); + } + + @Override + public Observable deleteAsync(String scope, String roleDefinitionId) { + RoleDefinitionsInner client = this.inner(); + return client.deleteAsync(scope, roleDefinitionId) + .map(new Func1() { + @Override + public RoleDefinition call(RoleDefinitionInner inner) { + return new RoleDefinitionImpl(inner, manager()); + } + }); + } + + @Override + public Observable getAsync(String scope, String roleDefinitionId) { + RoleDefinitionsInner client = this.inner(); + return client.getAsync(scope, roleDefinitionId) + .map(new Func1() { + @Override + public RoleDefinition call(RoleDefinitionInner inner) { + return new RoleDefinitionImpl(inner, manager()); + } + }); + } + + @Override + public Observable getByIdAsync(String roleId) { + RoleDefinitionsInner client = this.inner(); + return client.getByIdAsync(roleId) + .map(new Func1() { + @Override + public RoleDefinition call(RoleDefinitionInner inner) { + return new RoleDefinitionImpl(inner, manager()); + } + }); + } + + @Override + public Observable listAsync(final String scope) { + RoleDefinitionsInner client = this.inner(); + return client.listAsync(scope) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public RoleDefinition call(RoleDefinitionInner inner) { + return new RoleDefinitionImpl(inner, manager()); + } + }); + } + +} diff --git a/authorization/resource-manager/v2018_09_01_preview/src/main/java/com/microsoft/azure/management/authorization/v2018_09_01_preview/implementation/RoleDefinitionsInner.java b/authorization/resource-manager/v2018_09_01_preview/src/main/java/com/microsoft/azure/management/authorization/v2018_09_01_preview/implementation/RoleDefinitionsInner.java new file mode 100644 index 0000000000000..940b950761188 --- /dev/null +++ b/authorization/resource-manager/v2018_09_01_preview/src/main/java/com/microsoft/azure/management/authorization/v2018_09_01_preview/implementation/RoleDefinitionsInner.java @@ -0,0 +1,746 @@ +/** + * 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 com.microsoft.azure.arm.collection.InnerSupportsDelete; +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.CloudException; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import com.microsoft.rest.Validator; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.Body; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.HTTP; +import retrofit2.http.Path; +import retrofit2.http.PUT; +import retrofit2.http.Query; +import retrofit2.http.Url; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in RoleDefinitions. + */ +public class RoleDefinitionsInner implements InnerSupportsDelete { + /** The Retrofit service to perform REST calls. */ + private RoleDefinitionsService service; + /** The service client containing this operation class. */ + private AuthorizationManagementClientImpl client; + + /** + * Initializes an instance of RoleDefinitionsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public RoleDefinitionsInner(Retrofit retrofit, AuthorizationManagementClientImpl client) { + this.service = retrofit.create(RoleDefinitionsService.class); + this.client = client; + } + + /** + * The interface defining all the services for RoleDefinitions to be + * used by Retrofit to perform actually REST calls. + */ + interface RoleDefinitionsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.authorization.v2018_09_01_preview.RoleDefinitions delete" }) + @HTTP(path = "{scope}/providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionId}", method = "DELETE", hasBody = true) + Observable> delete(@Path(value = "scope", encoded = true) String scope, @Path("roleDefinitionId") String roleDefinitionId, @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_09_01_preview.RoleDefinitions get" }) + @GET("{scope}/providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionId}") + Observable> get(@Path(value = "scope", encoded = true) String scope, @Path("roleDefinitionId") String roleDefinitionId, @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_09_01_preview.RoleDefinitions createOrUpdate" }) + @PUT("{scope}/providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionId}") + 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.v2018_09_01_preview.RoleDefinitions list" }) + @GET("{scope}/providers/Microsoft.Authorization/roleDefinitions") + Observable> list(@Path(value = "scope", encoded = true) String scope, @Query("$filter") String filter, @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_09_01_preview.RoleDefinitions getById" }) + @GET("{roleId}") + Observable> getById(@Path(value = "roleId", encoded = true) String roleId, @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_09_01_preview.RoleDefinitions listNext" }) + @GET + Observable> listNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Deletes a role definition. + * + * @param scope The scope of the role definition. + * @param roleDefinitionId The ID of the role definition to delete. + * @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 delete(String scope, String roleDefinitionId) { + return deleteWithServiceResponseAsync(scope, roleDefinitionId).toBlocking().single().body(); + } + + /** + * Deletes a role definition. + * + * @param scope The scope of the role definition. + * @param roleDefinitionId The ID of the role definition to delete. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture deleteAsync(String scope, String roleDefinitionId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(scope, roleDefinitionId), serviceCallback); + } + + /** + * Deletes a role definition. + * + * @param scope The scope of the role definition. + * @param roleDefinitionId The ID of the role definition to delete. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the RoleDefinitionInner object + */ + public Observable deleteAsync(String scope, String roleDefinitionId) { + return deleteWithServiceResponseAsync(scope, roleDefinitionId).map(new Func1, RoleDefinitionInner>() { + @Override + public RoleDefinitionInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes a role definition. + * + * @param scope The scope of the role definition. + * @param roleDefinitionId The ID of the role definition to delete. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the RoleDefinitionInner object + */ + public Observable> deleteWithServiceResponseAsync(String scope, String roleDefinitionId) { + 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."); + } + final String apiVersion = "2018-01-01-preview"; + return service.delete(scope, roleDefinitionId, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = deleteDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse deleteDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Get role definition by name (GUID). + * + * @param scope The scope of the role definition. + * @param roleDefinitionId The ID of 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 get(String scope, String roleDefinitionId) { + return getWithServiceResponseAsync(scope, roleDefinitionId).toBlocking().single().body(); + } + + /** + * Get role definition by name (GUID). + * + * @param scope The scope of the role definition. + * @param roleDefinitionId The ID of 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 getAsync(String scope, String roleDefinitionId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(scope, roleDefinitionId), serviceCallback); + } + + /** + * Get role definition by name (GUID). + * + * @param scope The scope of the role definition. + * @param roleDefinitionId The ID of the role definition. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the RoleDefinitionInner object + */ + public Observable getAsync(String scope, String roleDefinitionId) { + return getWithServiceResponseAsync(scope, roleDefinitionId).map(new Func1, RoleDefinitionInner>() { + @Override + public RoleDefinitionInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Get role definition by name (GUID). + * + * @param scope The scope of the role definition. + * @param roleDefinitionId The ID of the role definition. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the RoleDefinitionInner object + */ + public Observable> getWithServiceResponseAsync(String scope, String roleDefinitionId) { + 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."); + } + final String apiVersion = "2018-01-01-preview"; + return service.get(scope, roleDefinitionId, 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); + } + + /** + * Creates or updates a role definition. + * + * @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, RoleDefinitionInner roleDefinition) { + return createOrUpdateWithServiceResponseAsync(scope, roleDefinitionId, roleDefinition).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 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, RoleDefinitionInner roleDefinition, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(scope, roleDefinitionId, roleDefinition), serviceCallback); + } + + /** + * Creates or updates a role definition. + * + * @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, RoleDefinitionInner roleDefinition) { + return createOrUpdateWithServiceResponseAsync(scope, roleDefinitionId, roleDefinition).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 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, 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 (roleDefinition == null) { + throw new IllegalArgumentException("Parameter roleDefinition is required and cannot be null."); + } + Validator.validate(roleDefinition); + final String apiVersion = "2018-01-01-preview"; + return service.createOrUpdate(scope, roleDefinitionId, roleDefinition, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = createOrUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse createOrUpdateDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(201, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Get all role definitions that are applicable at scope and above. + * + * @param scope The scope of 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 PagedList<RoleDefinitionInner> object if successful. + */ + public PagedList list(final String scope) { + ServiceResponse> response = listSinglePageAsync(scope).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Get all role definitions that are applicable at scope and above. + * + * @param scope The scope of 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> listAsync(final String scope, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(scope), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Get all role definitions that are applicable at scope and above. + * + * @param scope The scope of the role definition. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<RoleDefinitionInner> object + */ + public Observable> listAsync(final String scope) { + return listWithServiceResponseAsync(scope) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Get all role definitions that are applicable at scope and above. + * + * @param scope The scope of the role definition. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<RoleDefinitionInner> object + */ + public Observable>> listWithServiceResponseAsync(final String scope) { + return listSinglePageAsync(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(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Get all role definitions that are applicable at scope and above. + * + * @param scope The scope of the role definition. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<RoleDefinitionInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync(final String scope) { + if (scope == null) { + throw new IllegalArgumentException("Parameter scope is required and cannot be null."); + } + final String apiVersion = "2018-01-01-preview"; + final String filter = null; + return service.list(scope, filter, 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); + } + } + }); + } + + /** + * Get all role definitions that are applicable at scope and above. + * + * @param scope The scope of the role definition. + * @param filter The filter to apply on the operation. Use atScopeAndBelow filter to search below the given scope as well. + * @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<RoleDefinitionInner> object if successful. + */ + public PagedList list(final String scope, final String filter) { + ServiceResponse> response = listSinglePageAsync(scope, filter).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Get all role definitions that are applicable at scope and above. + * + * @param scope The scope of the role definition. + * @param filter The filter to apply on the operation. Use atScopeAndBelow filter to search below the given scope as well. + * @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 scope, final String filter, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(scope, filter), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Get all role definitions that are applicable at scope and above. + * + * @param scope The scope of the role definition. + * @param filter The filter to apply on the operation. Use atScopeAndBelow filter to search below the given scope as well. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<RoleDefinitionInner> object + */ + public Observable> listAsync(final String scope, final String filter) { + return listWithServiceResponseAsync(scope, filter) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Get all role definitions that are applicable at scope and above. + * + * @param scope The scope of the role definition. + * @param filter The filter to apply on the operation. Use atScopeAndBelow filter to search below the given scope as well. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<RoleDefinitionInner> object + */ + public Observable>> listWithServiceResponseAsync(final String scope, final String filter) { + return listSinglePageAsync(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(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Get all role definitions that are applicable at scope and above. + * + ServiceResponse> * @param scope The scope of the role definition. + ServiceResponse> * @param filter The filter to apply on the operation. Use atScopeAndBelow filter to search below the given scope as well. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<RoleDefinitionInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync(final String scope, final String filter) { + if (scope == null) { + throw new IllegalArgumentException("Parameter scope is required and cannot be null."); + } + final String apiVersion = "2018-01-01-preview"; + return service.list(scope, filter, 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 a role definition by ID. + * + * @param roleId The fully qualified role definition ID. Use the format, /subscriptions/{guid}/providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionId} for subscription level role definitions, or /providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionId} for tenant level role definitions. + * @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 getById(String roleId) { + return getByIdWithServiceResponseAsync(roleId).toBlocking().single().body(); + } + + /** + * Gets a role definition by ID. + * + * @param roleId The fully qualified role definition ID. Use the format, /subscriptions/{guid}/providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionId} for subscription level role definitions, or /providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionId} for tenant level role definitions. + * @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 roleId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getByIdWithServiceResponseAsync(roleId), serviceCallback); + } + + /** + * Gets a role definition by ID. + * + * @param roleId The fully qualified role definition ID. Use the format, /subscriptions/{guid}/providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionId} for subscription level role definitions, or /providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionId} for tenant level role definitions. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the RoleDefinitionInner object + */ + public Observable getByIdAsync(String roleId) { + return getByIdWithServiceResponseAsync(roleId).map(new Func1, RoleDefinitionInner>() { + @Override + public RoleDefinitionInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets a role definition by ID. + * + * @param roleId The fully qualified role definition ID. Use the format, /subscriptions/{guid}/providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionId} for subscription level role definitions, or /providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionId} for tenant level role definitions. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the RoleDefinitionInner object + */ + public Observable> getByIdWithServiceResponseAsync(String roleId) { + if (roleId == null) { + throw new IllegalArgumentException("Parameter roleId is required and cannot be null."); + } + final String apiVersion = "2018-01-01-preview"; + return service.getById(roleId, 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); + } + + /** + * Get all role definitions that are applicable at scope and above. + * + * @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<RoleDefinitionInner> 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(); + } + }; + } + + /** + * Get all role definitions that are applicable at scope and above. + * + * @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); + } + + /** + * Get all role definitions that are applicable at scope and above. + * + * @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<RoleDefinitionInner> object + */ + public Observable> listNextAsync(final String nextPageLink) { + return listNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Get all role definitions that are applicable at scope and above. + * + * @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<RoleDefinitionInner> 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)); + } + }); + } + + /** + * Get all role definitions that are applicable at scope and above. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<RoleDefinitionInner> 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/v2018_09_01_preview/src/main/java/com/microsoft/azure/management/authorization/v2018_09_01_preview/implementation/package-info.java b/authorization/resource-manager/v2018_09_01_preview/src/main/java/com/microsoft/azure/management/authorization/v2018_09_01_preview/implementation/package-info.java new file mode 100644 index 0000000000000..5ad8cffb5b2f7 --- /dev/null +++ b/authorization/resource-manager/v2018_09_01_preview/src/main/java/com/microsoft/azure/management/authorization/v2018_09_01_preview/implementation/package-info.java @@ -0,0 +1,10 @@ +// 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. + */ +package com.microsoft.azure.management.authorization.v2018_09_01_preview.implementation; diff --git a/authorization/resource-manager/v2018_09_01_preview/src/main/java/com/microsoft/azure/management/authorization/v2018_09_01_preview/package-info.java b/authorization/resource-manager/v2018_09_01_preview/src/main/java/com/microsoft/azure/management/authorization/v2018_09_01_preview/package-info.java new file mode 100644 index 0000000000000..e9edecaa7f119 --- /dev/null +++ b/authorization/resource-manager/v2018_09_01_preview/src/main/java/com/microsoft/azure/management/authorization/v2018_09_01_preview/package-info.java @@ -0,0 +1,10 @@ +// 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. + */ +package com.microsoft.azure.management.authorization.v2018_09_01_preview; diff --git a/gulpfile.js b/gulpfile.js index 4856155e1cc09..e694d68ec919e 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -56,7 +56,7 @@ gulp.task('default', function() { const maxParallelism = parseInt(args['parallel'], 10) || os.cpus().length; var specRoot = args['spec-root'] || defaultSpecRoot; var projects = args['projects']; -var autoRestVersion = 'latest'; // default +var autoRestVersion = 'preview'; // default if (args['autorest'] !== undefined) { autoRestVersion = args['autorest']; } @@ -66,7 +66,7 @@ var autoRestExe; gulp.task('codegen', function(cb) { if (autoRestVersion.match(/[0-9]+\.[0-9]+\.[0-9]+.*/) || - autoRestVersion == 'latest') { + autoRestVersion == 'preview') { autoRestExe = 'autorest ---version=' + autoRestVersion; handleInput(projects, cb); } else { @@ -119,7 +119,7 @@ var codegen = function(project, cb) { apiVersion = ''; } - var fconfig; + var fconfig; if (mappings[project].fconfig !== undefined) { fconfig = " --fconfig='" + JSON.stringify(mappings[project].fconfig) + "'" + ' '; } else { @@ -136,7 +136,7 @@ var codegen = function(project, cb) { regenManager + genInterface + apiVersion + - fconfig + + fconfig + autoRestArgs; if (mappings[project].args !== undefined) { @@ -170,7 +170,7 @@ var deleteFolderRecursive = function(folder) { gulp.task('java:build', shell.task('mvn package javadoc:aggregate -DskipTests=true -q')); gulp.task('java:stage', ['java:build'], function(){ - return gulp.src('./target/site/apidocs/**/*').pipe(gulp.dest('./dist')); + return gulp.src('./target/site/apidocs/**/*').pipe(gulp.dest('./dist')); }); /// Top level build entry point @@ -178,7 +178,7 @@ gulp.task('stage', ['java:stage']); gulp.task('publish', ['stage'], function(){ var options = {}; if(process.env.GH_TOKEN){ - options.remoteUrl = 'https://' + process.env.GH_TOKEN + '@github.com/azure/azure-libraries-for-java.git' + options.remoteUrl = 'https://' + process.env.GH_TOKEN + '@github.com/azure/azure-libraries-for-java.git' } return gulp.src('./dist/**/*').pipe(gulpif(!argv.dryrun, ghPages(options))); });