From 8f99afcbc132b819cf0973a6f7f468d28a0864db Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Mon, 12 Apr 2021 20:11:34 +0000 Subject: [PATCH] CodeGen from PR 13892 in Azure/azure-rest-api-specs Merge 7f84e15830842cddbf71276feb0af2180b378fe8 into 93e71ddc610824711d52b364103d7bea18ddb1d6 --- eng/versioning/version_client.txt | 1 + .../CHANGELOG.md | 5 + .../README.md | 99 + .../pom.xml | 67 + .../generated/AuthorizationManager.java | 219 ++ .../fluent/AuthorizationManagementClient.java | 53 + .../fluent/RoleAssignmentsClient.java | 315 +++ .../fluent/models/RoleAssignmentInner.java | 418 ++++ .../generated/fluent/models/package-info.java | 10 + .../generated/fluent/package-info.java | 10 + .../AuthorizationManagementClientBuilder.java | 146 ++ .../AuthorizationManagementClientImpl.java | 293 +++ .../implementation/RoleAssignmentImpl.java | 196 ++ .../RoleAssignmentsClientImpl.java | 2175 +++++++++++++++++ .../implementation/RoleAssignmentsImpl.java | 223 ++ .../generated/implementation/Utils.java | 204 ++ .../implementation/package-info.java | 10 + .../generated/models/PrincipalType.java | 58 + .../generated/models/RoleAssignment.java | 288 +++ .../RoleAssignmentCreateParameters.java | 258 ++ .../models/RoleAssignmentListResult.java | 81 + .../generated/models/RoleAssignments.java | 263 ++ .../generated/models/package-info.java | 10 + .../authorization/generated/package-info.java | 10 + .../src/main/java/module-info.java | 19 + sdk/authorization/ci.yml | 19 +- sdk/authorization/pom.xml | 1 + 27 files changed, 5435 insertions(+), 16 deletions(-) create mode 100644 sdk/authorization/azure-resourcemanager-authorization-generated/CHANGELOG.md create mode 100644 sdk/authorization/azure-resourcemanager-authorization-generated/README.md create mode 100644 sdk/authorization/azure-resourcemanager-authorization-generated/pom.xml create mode 100644 sdk/authorization/azure-resourcemanager-authorization-generated/src/main/java/com/azure/resourcemanager/authorization/generated/AuthorizationManager.java create mode 100644 sdk/authorization/azure-resourcemanager-authorization-generated/src/main/java/com/azure/resourcemanager/authorization/generated/fluent/AuthorizationManagementClient.java create mode 100644 sdk/authorization/azure-resourcemanager-authorization-generated/src/main/java/com/azure/resourcemanager/authorization/generated/fluent/RoleAssignmentsClient.java create mode 100644 sdk/authorization/azure-resourcemanager-authorization-generated/src/main/java/com/azure/resourcemanager/authorization/generated/fluent/models/RoleAssignmentInner.java create mode 100644 sdk/authorization/azure-resourcemanager-authorization-generated/src/main/java/com/azure/resourcemanager/authorization/generated/fluent/models/package-info.java create mode 100644 sdk/authorization/azure-resourcemanager-authorization-generated/src/main/java/com/azure/resourcemanager/authorization/generated/fluent/package-info.java create mode 100644 sdk/authorization/azure-resourcemanager-authorization-generated/src/main/java/com/azure/resourcemanager/authorization/generated/implementation/AuthorizationManagementClientBuilder.java create mode 100644 sdk/authorization/azure-resourcemanager-authorization-generated/src/main/java/com/azure/resourcemanager/authorization/generated/implementation/AuthorizationManagementClientImpl.java create mode 100644 sdk/authorization/azure-resourcemanager-authorization-generated/src/main/java/com/azure/resourcemanager/authorization/generated/implementation/RoleAssignmentImpl.java create mode 100644 sdk/authorization/azure-resourcemanager-authorization-generated/src/main/java/com/azure/resourcemanager/authorization/generated/implementation/RoleAssignmentsClientImpl.java create mode 100644 sdk/authorization/azure-resourcemanager-authorization-generated/src/main/java/com/azure/resourcemanager/authorization/generated/implementation/RoleAssignmentsImpl.java create mode 100644 sdk/authorization/azure-resourcemanager-authorization-generated/src/main/java/com/azure/resourcemanager/authorization/generated/implementation/Utils.java create mode 100644 sdk/authorization/azure-resourcemanager-authorization-generated/src/main/java/com/azure/resourcemanager/authorization/generated/implementation/package-info.java create mode 100644 sdk/authorization/azure-resourcemanager-authorization-generated/src/main/java/com/azure/resourcemanager/authorization/generated/models/PrincipalType.java create mode 100644 sdk/authorization/azure-resourcemanager-authorization-generated/src/main/java/com/azure/resourcemanager/authorization/generated/models/RoleAssignment.java create mode 100644 sdk/authorization/azure-resourcemanager-authorization-generated/src/main/java/com/azure/resourcemanager/authorization/generated/models/RoleAssignmentCreateParameters.java create mode 100644 sdk/authorization/azure-resourcemanager-authorization-generated/src/main/java/com/azure/resourcemanager/authorization/generated/models/RoleAssignmentListResult.java create mode 100644 sdk/authorization/azure-resourcemanager-authorization-generated/src/main/java/com/azure/resourcemanager/authorization/generated/models/RoleAssignments.java create mode 100644 sdk/authorization/azure-resourcemanager-authorization-generated/src/main/java/com/azure/resourcemanager/authorization/generated/models/package-info.java create mode 100644 sdk/authorization/azure-resourcemanager-authorization-generated/src/main/java/com/azure/resourcemanager/authorization/generated/package-info.java create mode 100644 sdk/authorization/azure-resourcemanager-authorization-generated/src/main/java/module-info.java diff --git a/eng/versioning/version_client.txt b/eng/versioning/version_client.txt index cdb3effc2811a..ae527a6ba1d95 100644 --- a/eng/versioning/version_client.txt +++ b/eng/versioning/version_client.txt @@ -237,6 +237,7 @@ com.azure.resourcemanager:azure-resourcemanager-appconfiguration;1.0.0-beta.1;1. com.azure.resourcemanager:azure-resourcemanager-attestation;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-azurestack;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-azurestackhci;1.0.0-beta.1;1.0.0-beta.2 +com.azure.resourcemanager:azure-resourcemanager-authorization-generated;1.0.0-beta.1;1.0.0-beta.1 # Unreleased dependencies: Copy the entry from above, prepend "unreleased_" and remove the current # version. Unreleased dependencies are only valid for dependency versions. diff --git a/sdk/authorization/azure-resourcemanager-authorization-generated/CHANGELOG.md b/sdk/authorization/azure-resourcemanager-authorization-generated/CHANGELOG.md new file mode 100644 index 0000000000000..b69c35ee302b9 --- /dev/null +++ b/sdk/authorization/azure-resourcemanager-authorization-generated/CHANGELOG.md @@ -0,0 +1,5 @@ +# Release History + +## 1.0.0-beta.1 (2021-04-12) + +- Azure Resource Manager Authorization client library for Java. This package contains Microsoft Azure SDK for Authorization Management SDK. Role based access control provides you a way to apply granular level policy administration down to individual resources or resource groups. These operations enable you to manage role assignments. A role assignment grants access to Azure Active Directory users. Package tag package-2020-04-01-preview-only. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). diff --git a/sdk/authorization/azure-resourcemanager-authorization-generated/README.md b/sdk/authorization/azure-resourcemanager-authorization-generated/README.md new file mode 100644 index 0000000000000..6b5afb9058e1d --- /dev/null +++ b/sdk/authorization/azure-resourcemanager-authorization-generated/README.md @@ -0,0 +1,99 @@ +# Azure Resource Manager Authorization client library for Java + +Azure Resource Manager Authorization client library for Java. + +This package contains Microsoft Azure SDK for Authorization Management SDK. Role based access control provides you a way to apply granular level policy administration down to individual resources or resource groups. These operations enable you to manage role assignments. A role assignment grants access to Azure Active Directory users. Package tag package-2020-04-01-preview-only. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). + +## We'd love to hear your feedback + +We're always working on improving our products and the way we communicate with our users. So we'd love to learn what's working and how we can do better. + +If you haven't already, please take a few minutes to [complete this short survey][survey] we have put together. + +Thank you in advance for your collaboration. We really appreciate your time! + +## Documentation + +Various documentation is available to help you get started + +- [API reference documentation][docs] + +## Getting started + +### Prerequisites + +- [Java Development Kit (JDK)][jdk] with version 8 or above +- [Azure Subscription][azure_subscription] + +### Adding the package to your product + +[//]: # ({x-version-update-start;com.azure.resourcemanager:azure-resourcemanager-authorization-generated;current}) +```xml + + com.azure.resourcemanager + azure-resourcemanager-authorization-generated + 1.0.0-beta.1 + +``` +[//]: # ({x-version-update-end}) + +### Include the recommended packages + +Azure Management Libraries require a `TokenCredential` implementation for authentication and an `HttpClient` implementation for HTTP client. + +[Azure Identity][azure_identity] package and [Azure Core Netty HTTP][azure_core_http_netty] package provide the default implementation. + +### Authentication + +By default, Azure Active Directory token authentication depends on correct configure of following environment variables. + +- `AZURE_CLIENT_ID` for Azure client ID. +- `AZURE_TENANT_ID` for Azure tenant ID. +- `AZURE_CLIENT_SECRET` or `AZURE_CLIENT_CERTIFICATE_PATH` for client secret or client certificate. + +In addition, Azure subscription ID can be configured via environment variable `AZURE_SUBSCRIPTION_ID`. + +With above configuration, `azure` client can be authenticated by following code: + +```java +AzureProfile profile = new AzureProfile(AzureEnvironment.AZURE); +TokenCredential credential = new DefaultAzureCredentialBuilder() + .authorityHost(profile.getEnvironment().getActiveDirectoryEndpoint()) + .build(); +AuthorizationManager manager = AuthorizationManager + .authenticate(credential, profile); +``` + +The sample code assumes global Azure. Please change `AzureEnvironment.AZURE` variable if otherwise. + +See [Authentication][authenticate] for more options. + +## Key concepts + +See [API design][design] for general introduction on design and key concepts on Azure Management Libraries. + +## Examples + +## Troubleshooting + +## Next steps + +## Contributing + +For details on contributing to this repository, see the [contributing guide](https://github.com/Azure/azure-sdk-for-java/blob/master/CONTRIBUTING.md). + +1. Fork it +1. Create your feature branch (`git checkout -b my-new-feature`) +1. Commit your changes (`git commit -am 'Add some feature'`) +1. Push to the branch (`git push origin my-new-feature`) +1. Create new Pull Request + + +[survey]: https://microsoft.qualtrics.com/jfe/form/SV_ehN0lIk2FKEBkwd?Q_CHL=DOCS +[docs]: https://azure.github.io/azure-sdk-for-java/ +[jdk]: https://docs.microsoft.com/java/azure/jdk/ +[azure_subscription]: https://azure.microsoft.com/free/ +[azure_identity]: https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/identity/azure-identity +[azure_core_http_netty]: https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/core/azure-core-http-netty +[authenticate]: https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/resourcemanager/docs/AUTH.md +[design]: https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/resourcemanager/docs/DESIGN.md diff --git a/sdk/authorization/azure-resourcemanager-authorization-generated/pom.xml b/sdk/authorization/azure-resourcemanager-authorization-generated/pom.xml new file mode 100644 index 0000000000000..cc414f2b33cb5 --- /dev/null +++ b/sdk/authorization/azure-resourcemanager-authorization-generated/pom.xml @@ -0,0 +1,67 @@ + + 4.0.0 + + com.azure + azure-client-sdk-parent + 1.7.0 + ../../parents/azure-client-sdk-parent + + + com.azure.resourcemanager + azure-resourcemanager-authorization-generated + 1.0.0-beta.1 + jar + + Microsoft Azure SDK for Authorization Management + This package contains Microsoft Azure SDK for Authorization Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. Role based access control provides you a way to apply granular level policy administration down to individual resources or resource groups. These operations enable you to manage role assignments. A role assignment grants access to Azure Active Directory users. Package tag package-2020-04-01-preview-only. + https://github.com/Azure/azure-sdk-for-java + + + + The MIT License (MIT) + http://opensource.org/licenses/MIT + repo + + + + + https://github.com/Azure/azure-sdk-for-java + scm:git:git@github.com:Azure/azure-sdk-for-java.git + scm:git:git@github.com:Azure/azure-sdk-for-java.git + HEAD + + + + microsoft + Microsoft + + + + UTF-8 + + + + + com.azure + azure-core + 1.15.0 + + + com.azure + azure-core-management + 1.2.1 + + + + + + org.jacoco + jacoco-maven-plugin + 0.8.5 + + true + + + + + diff --git a/sdk/authorization/azure-resourcemanager-authorization-generated/src/main/java/com/azure/resourcemanager/authorization/generated/AuthorizationManager.java b/sdk/authorization/azure-resourcemanager-authorization-generated/src/main/java/com/azure/resourcemanager/authorization/generated/AuthorizationManager.java new file mode 100644 index 0000000000000..57a4d026d8f0c --- /dev/null +++ b/sdk/authorization/azure-resourcemanager-authorization-generated/src/main/java/com/azure/resourcemanager/authorization/generated/AuthorizationManager.java @@ -0,0 +1,219 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.authorization.generated; + +import com.azure.core.credential.TokenCredential; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.policy.AddDatePolicy; +import com.azure.core.http.policy.BearerTokenAuthenticationPolicy; +import com.azure.core.http.policy.HttpLogOptions; +import com.azure.core.http.policy.HttpLoggingPolicy; +import com.azure.core.http.policy.HttpPipelinePolicy; +import com.azure.core.http.policy.HttpPolicyProviders; +import com.azure.core.http.policy.RequestIdPolicy; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.util.Configuration; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.authorization.generated.fluent.AuthorizationManagementClient; +import com.azure.resourcemanager.authorization.generated.implementation.AuthorizationManagementClientBuilder; +import com.azure.resourcemanager.authorization.generated.implementation.RoleAssignmentsImpl; +import com.azure.resourcemanager.authorization.generated.models.RoleAssignments; +import java.time.Duration; +import java.time.temporal.ChronoUnit; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; + +/** + * Entry point to AuthorizationManager. Role based access control provides you a way to apply granular level policy + * administration down to individual resources or resource groups. These operations enable you to manage role + * assignments. A role assignment grants access to Azure Active Directory users. + */ +public final class AuthorizationManager { + private RoleAssignments roleAssignments; + + private final AuthorizationManagementClient clientObject; + + private AuthorizationManager(HttpPipeline httpPipeline, AzureProfile profile, Duration defaultPollInterval) { + Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + this.clientObject = + new AuthorizationManagementClientBuilder() + .pipeline(httpPipeline) + .endpoint(profile.getEnvironment().getResourceManagerEndpoint()) + .subscriptionId(profile.getSubscriptionId()) + .defaultPollInterval(defaultPollInterval) + .buildClient(); + } + + /** + * Creates an instance of Authorization service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the Authorization service API instance. + */ + public static AuthorizationManager authenticate(TokenCredential credential, AzureProfile profile) { + Objects.requireNonNull(credential, "'credential' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + return configure().authenticate(credential, profile); + } + + /** + * Gets a Configurable instance that can be used to create AuthorizationManager with optional configuration. + * + * @return the Configurable instance allowing configurations. + */ + public static Configurable configure() { + return new AuthorizationManager.Configurable(); + } + + /** The Configurable allowing configurations to be set. */ + public static final class Configurable { + private final ClientLogger logger = new ClientLogger(Configurable.class); + + private HttpClient httpClient; + private HttpLogOptions httpLogOptions; + private final List policies = new ArrayList<>(); + private RetryPolicy retryPolicy; + private Duration defaultPollInterval; + + private Configurable() { + } + + /** + * Sets the http client. + * + * @param httpClient the HTTP client. + * @return the configurable object itself. + */ + public Configurable withHttpClient(HttpClient httpClient) { + this.httpClient = Objects.requireNonNull(httpClient, "'httpClient' cannot be null."); + return this; + } + + /** + * Sets the logging options to the HTTP pipeline. + * + * @param httpLogOptions the HTTP log options. + * @return the configurable object itself. + */ + public Configurable withLogOptions(HttpLogOptions httpLogOptions) { + this.httpLogOptions = Objects.requireNonNull(httpLogOptions, "'httpLogOptions' cannot be null."); + return this; + } + + /** + * Adds the pipeline policy to the HTTP pipeline. + * + * @param policy the HTTP pipeline policy. + * @return the configurable object itself. + */ + public Configurable withPolicy(HttpPipelinePolicy policy) { + this.policies.add(Objects.requireNonNull(policy, "'policy' cannot be null.")); + return this; + } + + /** + * Sets the retry policy to the HTTP pipeline. + * + * @param retryPolicy the HTTP pipeline retry policy. + * @return the configurable object itself. + */ + public Configurable withRetryPolicy(RetryPolicy retryPolicy) { + this.retryPolicy = Objects.requireNonNull(retryPolicy, "'retryPolicy' cannot be null."); + return this; + } + + /** + * Sets the default poll interval, used when service does not provide "Retry-After" header. + * + * @param defaultPollInterval the default poll interval. + * @return the configurable object itself. + */ + public Configurable withDefaultPollInterval(Duration defaultPollInterval) { + this.defaultPollInterval = Objects.requireNonNull(defaultPollInterval, "'retryPolicy' cannot be null."); + if (this.defaultPollInterval.isNegative()) { + throw logger.logExceptionAsError(new IllegalArgumentException("'httpPipeline' cannot be negative")); + } + return this; + } + + /** + * Creates an instance of Authorization service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the Authorization service API instance. + */ + public AuthorizationManager authenticate(TokenCredential credential, AzureProfile profile) { + Objects.requireNonNull(credential, "'credential' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + + StringBuilder userAgentBuilder = new StringBuilder(); + userAgentBuilder + .append("azsdk-java") + .append("-") + .append("com.azure.resourcemanager.authorization.generated") + .append("/") + .append("1.0.0-beta.1"); + if (!Configuration.getGlobalConfiguration().get("AZURE_TELEMETRY_DISABLED", false)) { + userAgentBuilder + .append(" (") + .append(Configuration.getGlobalConfiguration().get("java.version")) + .append("; ") + .append(Configuration.getGlobalConfiguration().get("os.name")) + .append("; ") + .append(Configuration.getGlobalConfiguration().get("os.version")) + .append("; auto-generated)"); + } else { + userAgentBuilder.append(" (auto-generated)"); + } + + if (retryPolicy == null) { + retryPolicy = new RetryPolicy("Retry-After", ChronoUnit.SECONDS); + } + List policies = new ArrayList<>(); + policies.add(new UserAgentPolicy(userAgentBuilder.toString())); + policies.add(new RequestIdPolicy()); + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(retryPolicy); + policies.add(new AddDatePolicy()); + policies + .add( + new BearerTokenAuthenticationPolicy( + credential, profile.getEnvironment().getManagementEndpoint() + "/.default")); + policies.addAll(this.policies); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(httpLogOptions)); + HttpPipeline httpPipeline = + new HttpPipelineBuilder() + .httpClient(httpClient) + .policies(policies.toArray(new HttpPipelinePolicy[0])) + .build(); + return new AuthorizationManager(httpPipeline, profile, defaultPollInterval); + } + } + + /** @return Resource collection API of RoleAssignments. */ + public RoleAssignments roleAssignments() { + if (this.roleAssignments == null) { + this.roleAssignments = new RoleAssignmentsImpl(clientObject.getRoleAssignments(), this); + } + return roleAssignments; + } + + /** + * @return Wrapped service client AuthorizationManagementClient providing direct access to the underlying + * auto-generated API implementation, based on Azure REST API. + */ + public AuthorizationManagementClient serviceClient() { + return this.clientObject; + } +} diff --git a/sdk/authorization/azure-resourcemanager-authorization-generated/src/main/java/com/azure/resourcemanager/authorization/generated/fluent/AuthorizationManagementClient.java b/sdk/authorization/azure-resourcemanager-authorization-generated/src/main/java/com/azure/resourcemanager/authorization/generated/fluent/AuthorizationManagementClient.java new file mode 100644 index 0000000000000..060d4d5e98b9f --- /dev/null +++ b/sdk/authorization/azure-resourcemanager-authorization-generated/src/main/java/com/azure/resourcemanager/authorization/generated/fluent/AuthorizationManagementClient.java @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.authorization.generated.fluent; + +import com.azure.core.http.HttpPipeline; +import java.time.Duration; + +/** The interface for AuthorizationManagementClient class. */ +public interface AuthorizationManagementClient { + /** + * Gets The ID of the target subscription. + * + * @return the subscriptionId value. + */ + String getSubscriptionId(); + + /** + * Gets server parameter. + * + * @return the endpoint value. + */ + String getEndpoint(); + + /** + * Gets Api Version. + * + * @return the apiVersion value. + */ + String getApiVersion(); + + /** + * Gets The HTTP pipeline to send requests through. + * + * @return the httpPipeline value. + */ + HttpPipeline getHttpPipeline(); + + /** + * Gets The default poll interval for long-running operation. + * + * @return the defaultPollInterval value. + */ + Duration getDefaultPollInterval(); + + /** + * Gets the RoleAssignmentsClient object to access its operations. + * + * @return the RoleAssignmentsClient object. + */ + RoleAssignmentsClient getRoleAssignments(); +} diff --git a/sdk/authorization/azure-resourcemanager-authorization-generated/src/main/java/com/azure/resourcemanager/authorization/generated/fluent/RoleAssignmentsClient.java b/sdk/authorization/azure-resourcemanager-authorization-generated/src/main/java/com/azure/resourcemanager/authorization/generated/fluent/RoleAssignmentsClient.java new file mode 100644 index 0000000000000..e5cecac5ae2e1 --- /dev/null +++ b/sdk/authorization/azure-resourcemanager-authorization-generated/src/main/java/com/azure/resourcemanager/authorization/generated/fluent/RoleAssignmentsClient.java @@ -0,0 +1,315 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.authorization.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.authorization.generated.fluent.models.RoleAssignmentInner; +import com.azure.resourcemanager.authorization.generated.models.RoleAssignmentCreateParameters; + +/** An instance of this class provides access to all the operations defined in RoleAssignmentsClient. */ +public interface RoleAssignmentsClient { + /** + * List role assignments for a resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return role assignment list operation result. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listForResource( + String resourceGroupName, + String resourceProviderNamespace, + String parentResourcePath, + String resourceType, + String resourceName); + + /** + * List role assignments for a resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return role assignment list operation result. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listForResource( + String resourceGroupName, + String resourceProviderNamespace, + String parentResourcePath, + String resourceType, + String resourceName, + String filter, + Context context); + + /** + * List role assignments for a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return role assignment list operation result. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * List role assignments for a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return role assignment list operation result. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName, String filter, Context context); + + /** + * Delete 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return role Assignments. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + RoleAssignmentInner delete(String scope, String roleAssignmentName); + + /** + * Delete a role assignment. + * + * @param scope The scope of the role assignment to delete. + * @param roleAssignmentName The name of the role assignment to delete. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return role Assignments. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response deleteWithResponse(String scope, String roleAssignmentName, Context context); + + /** + * Create 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return role Assignments. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + RoleAssignmentInner create(String scope, String roleAssignmentName, RoleAssignmentCreateParameters parameters); + + /** + * Create 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return role Assignments. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createWithResponse( + String scope, String roleAssignmentName, RoleAssignmentCreateParameters parameters, Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the specified role assignment. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + RoleAssignmentInner get(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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the specified role assignment. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String scope, String roleAssignmentName, Context context); + + /** + * Delete a role assignment. + * + * @param roleId The ID of the role assignment to delete. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return role Assignments. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + RoleAssignmentInner deleteById(String roleId); + + /** + * Delete a role assignment. + * + * @param roleId The ID of the role assignment to delete. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return role Assignments. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response deleteByIdWithResponse(String roleId, Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return role Assignments. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + RoleAssignmentInner createById(String roleId, RoleAssignmentCreateParameters parameters); + + /** + * Creates a role assignment by ID. + * + * @param roleId The ID of the role assignment to create. + * @param parameters Parameters for the role assignment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return role Assignments. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createByIdWithResponse( + String roleId, RoleAssignmentCreateParameters parameters, Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a role assignment by ID. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + RoleAssignmentInner getById(String roleId); + + /** + * Gets a role assignment by ID. + * + * @param roleId The ID of the role assignment to get. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a role assignment by ID. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByIdWithResponse(String roleId, Context context); + + /** + * Gets all role assignments for the subscription. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all role assignments for the subscription. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all role assignments for the subscription. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String filter, Context context); + + /** + * Gets role assignments for a scope. + * + * @param scope The scope of the role assignments. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return role assignments for a scope. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listForScope(String scope); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return role assignments for a scope. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listForScope(String scope, String filter, Context context); +} diff --git a/sdk/authorization/azure-resourcemanager-authorization-generated/src/main/java/com/azure/resourcemanager/authorization/generated/fluent/models/RoleAssignmentInner.java b/sdk/authorization/azure-resourcemanager-authorization-generated/src/main/java/com/azure/resourcemanager/authorization/generated/fluent/models/RoleAssignmentInner.java new file mode 100644 index 0000000000000..19ce1d2f89046 --- /dev/null +++ b/sdk/authorization/azure-resourcemanager-authorization-generated/src/main/java/com/azure/resourcemanager/authorization/generated/fluent/models/RoleAssignmentInner.java @@ -0,0 +1,418 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.authorization.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.authorization.generated.models.PrincipalType; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** Role Assignments. */ +@JsonFlatten +@Fluent +public class RoleAssignmentInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(RoleAssignmentInner.class); + + /* + * 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 principal type of the assigned principal ID. + */ + @JsonProperty(value = "properties.principalType") + private PrincipalType principalType; + + /* + * The Delegation flag for the role assignment + */ + @JsonProperty(value = "properties.canDelegate") + private Boolean canDelegate; + + /* + * Description of role assignment + */ + @JsonProperty(value = "properties.description") + private String description; + + /* + * The conditions on the role assignment. This limits the resources it can + * be assigned to. e.g.: + * @Resource[Microsoft.Storage/storageAccounts/blobServices/containers:ContainerName] + * StringEqualsIgnoreCase 'foo_storage_container' + */ + @JsonProperty(value = "properties.condition") + private String condition; + + /* + * Version of the condition. Currently accepted value is '2.0' + */ + @JsonProperty(value = "properties.conditionVersion") + private String conditionVersion; + + /* + * Time it was created + */ + @JsonProperty(value = "properties.createdOn") + private OffsetDateTime createdOn; + + /* + * Time it was updated + */ + @JsonProperty(value = "properties.updatedOn") + private OffsetDateTime updatedOn; + + /* + * Id of the user who created the assignment + */ + @JsonProperty(value = "properties.createdBy") + private String createdBy; + + /* + * Id of the user who updated the assignment + */ + @JsonProperty(value = "properties.updatedBy") + private String updatedBy; + + /* + * Id of the delegated managed identity resource + */ + @JsonProperty(value = "properties.delegatedManagedIdentityResourceId") + private String delegatedManagedIdentityResourceId; + + /** + * Get the id property: The role assignment ID. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Get the name property: The role assignment name. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Get the type property: The role assignment type. + * + * @return the type value. + */ + public String type() { + return this.type; + } + + /** + * Get the scope property: The role assignment scope. + * + * @return the scope value. + */ + public String scope() { + return this.scope; + } + + /** + * Set the scope property: 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 roleDefinitionId property: The role definition ID. + * + * @return the roleDefinitionId value. + */ + public String roleDefinitionId() { + return this.roleDefinitionId; + } + + /** + * Set the roleDefinitionId property: 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 principalId property: The principal ID. + * + * @return the principalId value. + */ + public String principalId() { + return this.principalId; + } + + /** + * Set the principalId property: 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 principalType property: The principal type of the assigned principal ID. + * + * @return the principalType value. + */ + public PrincipalType principalType() { + return this.principalType; + } + + /** + * Set the principalType property: The principal type of the assigned principal ID. + * + * @param principalType the principalType value to set. + * @return the RoleAssignmentInner object itself. + */ + public RoleAssignmentInner withPrincipalType(PrincipalType principalType) { + this.principalType = principalType; + return this; + } + + /** + * Get the canDelegate property: The Delegation flag for the role assignment. + * + * @return the canDelegate value. + */ + public Boolean canDelegate() { + return this.canDelegate; + } + + /** + * Set the canDelegate property: The Delegation flag for the role assignment. + * + * @param canDelegate the canDelegate value to set. + * @return the RoleAssignmentInner object itself. + */ + public RoleAssignmentInner withCanDelegate(Boolean canDelegate) { + this.canDelegate = canDelegate; + return this; + } + + /** + * Get the description property: Description of role assignment. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Set the description property: Description of role assignment. + * + * @param description the description value to set. + * @return the RoleAssignmentInner object itself. + */ + public RoleAssignmentInner withDescription(String description) { + this.description = description; + return this; + } + + /** + * Get the condition property: The conditions on the role assignment. This limits the resources it can be assigned + * to. e.g.: @Resource[Microsoft.Storage/storageAccounts/blobServices/containers:ContainerName] + * StringEqualsIgnoreCase 'foo_storage_container'. + * + * @return the condition value. + */ + public String condition() { + return this.condition; + } + + /** + * Set the condition property: The conditions on the role assignment. This limits the resources it can be assigned + * to. e.g.: @Resource[Microsoft.Storage/storageAccounts/blobServices/containers:ContainerName] + * StringEqualsIgnoreCase 'foo_storage_container'. + * + * @param condition the condition value to set. + * @return the RoleAssignmentInner object itself. + */ + public RoleAssignmentInner withCondition(String condition) { + this.condition = condition; + return this; + } + + /** + * Get the conditionVersion property: Version of the condition. Currently accepted value is '2.0'. + * + * @return the conditionVersion value. + */ + public String conditionVersion() { + return this.conditionVersion; + } + + /** + * Set the conditionVersion property: Version of the condition. Currently accepted value is '2.0'. + * + * @param conditionVersion the conditionVersion value to set. + * @return the RoleAssignmentInner object itself. + */ + public RoleAssignmentInner withConditionVersion(String conditionVersion) { + this.conditionVersion = conditionVersion; + return this; + } + + /** + * Get the createdOn property: Time it was created. + * + * @return the createdOn value. + */ + public OffsetDateTime createdOn() { + return this.createdOn; + } + + /** + * Set the createdOn property: Time it was created. + * + * @param createdOn the createdOn value to set. + * @return the RoleAssignmentInner object itself. + */ + public RoleAssignmentInner withCreatedOn(OffsetDateTime createdOn) { + this.createdOn = createdOn; + return this; + } + + /** + * Get the updatedOn property: Time it was updated. + * + * @return the updatedOn value. + */ + public OffsetDateTime updatedOn() { + return this.updatedOn; + } + + /** + * Set the updatedOn property: Time it was updated. + * + * @param updatedOn the updatedOn value to set. + * @return the RoleAssignmentInner object itself. + */ + public RoleAssignmentInner withUpdatedOn(OffsetDateTime updatedOn) { + this.updatedOn = updatedOn; + return this; + } + + /** + * Get the createdBy property: Id of the user who created the assignment. + * + * @return the createdBy value. + */ + public String createdBy() { + return this.createdBy; + } + + /** + * Set the createdBy property: Id of the user who created the assignment. + * + * @param createdBy the createdBy value to set. + * @return the RoleAssignmentInner object itself. + */ + public RoleAssignmentInner withCreatedBy(String createdBy) { + this.createdBy = createdBy; + return this; + } + + /** + * Get the updatedBy property: Id of the user who updated the assignment. + * + * @return the updatedBy value. + */ + public String updatedBy() { + return this.updatedBy; + } + + /** + * Set the updatedBy property: Id of the user who updated the assignment. + * + * @param updatedBy the updatedBy value to set. + * @return the RoleAssignmentInner object itself. + */ + public RoleAssignmentInner withUpdatedBy(String updatedBy) { + this.updatedBy = updatedBy; + return this; + } + + /** + * Get the delegatedManagedIdentityResourceId property: Id of the delegated managed identity resource. + * + * @return the delegatedManagedIdentityResourceId value. + */ + public String delegatedManagedIdentityResourceId() { + return this.delegatedManagedIdentityResourceId; + } + + /** + * Set the delegatedManagedIdentityResourceId property: Id of the delegated managed identity resource. + * + * @param delegatedManagedIdentityResourceId the delegatedManagedIdentityResourceId value to set. + * @return the RoleAssignmentInner object itself. + */ + public RoleAssignmentInner withDelegatedManagedIdentityResourceId(String delegatedManagedIdentityResourceId) { + this.delegatedManagedIdentityResourceId = delegatedManagedIdentityResourceId; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/authorization/azure-resourcemanager-authorization-generated/src/main/java/com/azure/resourcemanager/authorization/generated/fluent/models/package-info.java b/sdk/authorization/azure-resourcemanager-authorization-generated/src/main/java/com/azure/resourcemanager/authorization/generated/fluent/models/package-info.java new file mode 100644 index 0000000000000..664c1a7eb8448 --- /dev/null +++ b/sdk/authorization/azure-resourcemanager-authorization-generated/src/main/java/com/azure/resourcemanager/authorization/generated/fluent/models/package-info.java @@ -0,0 +1,10 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * Package containing the inner data models for AuthorizationManagementClient. Role based access control provides you a + * way to apply granular level policy administration down to individual resources or resource groups. These operations + * enable you to manage role assignments. A role assignment grants access to Azure Active Directory users. + */ +package com.azure.resourcemanager.authorization.generated.fluent.models; diff --git a/sdk/authorization/azure-resourcemanager-authorization-generated/src/main/java/com/azure/resourcemanager/authorization/generated/fluent/package-info.java b/sdk/authorization/azure-resourcemanager-authorization-generated/src/main/java/com/azure/resourcemanager/authorization/generated/fluent/package-info.java new file mode 100644 index 0000000000000..6c6d839a30779 --- /dev/null +++ b/sdk/authorization/azure-resourcemanager-authorization-generated/src/main/java/com/azure/resourcemanager/authorization/generated/fluent/package-info.java @@ -0,0 +1,10 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * Package containing the service clients for AuthorizationManagementClient. Role based access control provides you a + * way to apply granular level policy administration down to individual resources or resource groups. These operations + * enable you to manage role assignments. A role assignment grants access to Azure Active Directory users. + */ +package com.azure.resourcemanager.authorization.generated.fluent; diff --git a/sdk/authorization/azure-resourcemanager-authorization-generated/src/main/java/com/azure/resourcemanager/authorization/generated/implementation/AuthorizationManagementClientBuilder.java b/sdk/authorization/azure-resourcemanager-authorization-generated/src/main/java/com/azure/resourcemanager/authorization/generated/implementation/AuthorizationManagementClientBuilder.java new file mode 100644 index 0000000000000..12424ae829d74 --- /dev/null +++ b/sdk/authorization/azure-resourcemanager-authorization-generated/src/main/java/com/azure/resourcemanager/authorization/generated/implementation/AuthorizationManagementClientBuilder.java @@ -0,0 +1,146 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.authorization.generated.implementation; + +import com.azure.core.annotation.ServiceClientBuilder; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.policy.CookiePolicy; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.serializer.SerializerFactory; +import com.azure.core.util.serializer.SerializerAdapter; +import java.time.Duration; + +/** A builder for creating a new instance of the AuthorizationManagementClientImpl type. */ +@ServiceClientBuilder(serviceClients = {AuthorizationManagementClientImpl.class}) +public final class AuthorizationManagementClientBuilder { + /* + * The ID of the target subscription. + */ + private String subscriptionId; + + /** + * Sets The ID of the target subscription. + * + * @param subscriptionId the subscriptionId value. + * @return the AuthorizationManagementClientBuilder. + */ + public AuthorizationManagementClientBuilder subscriptionId(String subscriptionId) { + this.subscriptionId = subscriptionId; + return this; + } + + /* + * server parameter + */ + private String endpoint; + + /** + * Sets server parameter. + * + * @param endpoint the endpoint value. + * @return the AuthorizationManagementClientBuilder. + */ + public AuthorizationManagementClientBuilder endpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /* + * The environment to connect to + */ + private AzureEnvironment environment; + + /** + * Sets The environment to connect to. + * + * @param environment the environment value. + * @return the AuthorizationManagementClientBuilder. + */ + public AuthorizationManagementClientBuilder environment(AzureEnvironment environment) { + this.environment = environment; + return this; + } + + /* + * The default poll interval for long-running operation + */ + private Duration defaultPollInterval; + + /** + * Sets The default poll interval for long-running operation. + * + * @param defaultPollInterval the defaultPollInterval value. + * @return the AuthorizationManagementClientBuilder. + */ + public AuthorizationManagementClientBuilder defaultPollInterval(Duration defaultPollInterval) { + this.defaultPollInterval = defaultPollInterval; + return this; + } + + /* + * The HTTP pipeline to send requests through + */ + private HttpPipeline pipeline; + + /** + * Sets The HTTP pipeline to send requests through. + * + * @param pipeline the pipeline value. + * @return the AuthorizationManagementClientBuilder. + */ + public AuthorizationManagementClientBuilder pipeline(HttpPipeline pipeline) { + this.pipeline = pipeline; + return this; + } + + /* + * The serializer to serialize an object into a string + */ + private SerializerAdapter serializerAdapter; + + /** + * Sets The serializer to serialize an object into a string. + * + * @param serializerAdapter the serializerAdapter value. + * @return the AuthorizationManagementClientBuilder. + */ + public AuthorizationManagementClientBuilder serializerAdapter(SerializerAdapter serializerAdapter) { + this.serializerAdapter = serializerAdapter; + return this; + } + + /** + * Builds an instance of AuthorizationManagementClientImpl with the provided parameters. + * + * @return an instance of AuthorizationManagementClientImpl. + */ + public AuthorizationManagementClientImpl buildClient() { + if (endpoint == null) { + this.endpoint = "https://management.azure.com"; + } + if (environment == null) { + this.environment = AzureEnvironment.AZURE; + } + if (defaultPollInterval == null) { + this.defaultPollInterval = Duration.ofSeconds(30); + } + if (pipeline == null) { + this.pipeline = + new HttpPipelineBuilder() + .policies(new UserAgentPolicy(), new RetryPolicy(), new CookiePolicy()) + .build(); + } + if (serializerAdapter == null) { + this.serializerAdapter = SerializerFactory.createDefaultManagementSerializerAdapter(); + } + AuthorizationManagementClientImpl client = + new AuthorizationManagementClientImpl( + pipeline, serializerAdapter, defaultPollInterval, environment, subscriptionId, endpoint); + return client; + } +} diff --git a/sdk/authorization/azure-resourcemanager-authorization-generated/src/main/java/com/azure/resourcemanager/authorization/generated/implementation/AuthorizationManagementClientImpl.java b/sdk/authorization/azure-resourcemanager-authorization-generated/src/main/java/com/azure/resourcemanager/authorization/generated/implementation/AuthorizationManagementClientImpl.java new file mode 100644 index 0000000000000..4277992b0aca4 --- /dev/null +++ b/sdk/authorization/azure-resourcemanager-authorization-generated/src/main/java/com/azure/resourcemanager/authorization/generated/implementation/AuthorizationManagementClientImpl.java @@ -0,0 +1,293 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.authorization.generated.implementation; + +import com.azure.core.annotation.ServiceClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpResponse; +import com.azure.core.http.rest.Response; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.exception.ManagementError; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.management.polling.PollerFactory; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.AsyncPollResponse; +import com.azure.core.util.polling.LongRunningOperationStatus; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.serializer.SerializerAdapter; +import com.azure.core.util.serializer.SerializerEncoding; +import com.azure.resourcemanager.authorization.generated.fluent.AuthorizationManagementClient; +import com.azure.resourcemanager.authorization.generated.fluent.RoleAssignmentsClient; +import java.io.IOException; +import java.lang.reflect.Type; +import java.nio.ByteBuffer; +import java.nio.charset.Charset; +import java.nio.charset.StandardCharsets; +import java.time.Duration; +import java.util.Map; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** Initializes a new instance of the AuthorizationManagementClientImpl type. */ +@ServiceClient(builder = AuthorizationManagementClientBuilder.class) +public final class AuthorizationManagementClientImpl implements AuthorizationManagementClient { + private final ClientLogger logger = new ClientLogger(AuthorizationManagementClientImpl.class); + + /** The ID of the target subscription. */ + private final String subscriptionId; + + /** + * Gets The ID of the target subscription. + * + * @return the subscriptionId value. + */ + public String getSubscriptionId() { + return this.subscriptionId; + } + + /** server parameter. */ + private final String endpoint; + + /** + * Gets server parameter. + * + * @return the endpoint value. + */ + public String getEndpoint() { + return this.endpoint; + } + + /** Api Version. */ + private final String apiVersion; + + /** + * Gets Api Version. + * + * @return the apiVersion value. + */ + public String getApiVersion() { + return this.apiVersion; + } + + /** The HTTP pipeline to send requests through. */ + private final HttpPipeline httpPipeline; + + /** + * Gets The HTTP pipeline to send requests through. + * + * @return the httpPipeline value. + */ + public HttpPipeline getHttpPipeline() { + return this.httpPipeline; + } + + /** The serializer to serialize an object into a string. */ + private final SerializerAdapter serializerAdapter; + + /** + * Gets The serializer to serialize an object into a string. + * + * @return the serializerAdapter value. + */ + SerializerAdapter getSerializerAdapter() { + return this.serializerAdapter; + } + + /** The default poll interval for long-running operation. */ + private final Duration defaultPollInterval; + + /** + * Gets The default poll interval for long-running operation. + * + * @return the defaultPollInterval value. + */ + public Duration getDefaultPollInterval() { + return this.defaultPollInterval; + } + + /** The RoleAssignmentsClient object to access its operations. */ + private final RoleAssignmentsClient roleAssignments; + + /** + * Gets the RoleAssignmentsClient object to access its operations. + * + * @return the RoleAssignmentsClient object. + */ + public RoleAssignmentsClient getRoleAssignments() { + return this.roleAssignments; + } + + /** + * Initializes an instance of AuthorizationManagementClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param serializerAdapter The serializer to serialize an object into a string. + * @param defaultPollInterval The default poll interval for long-running operation. + * @param environment The Azure environment. + * @param subscriptionId The ID of the target subscription. + * @param endpoint server parameter. + */ + AuthorizationManagementClientImpl( + HttpPipeline httpPipeline, + SerializerAdapter serializerAdapter, + Duration defaultPollInterval, + AzureEnvironment environment, + String subscriptionId, + String endpoint) { + this.httpPipeline = httpPipeline; + this.serializerAdapter = serializerAdapter; + this.defaultPollInterval = defaultPollInterval; + this.subscriptionId = subscriptionId; + this.endpoint = endpoint; + this.apiVersion = "2020-04-01-preview"; + this.roleAssignments = new RoleAssignmentsClientImpl(this); + } + + /** + * Gets default client context. + * + * @return the default client context. + */ + public Context getContext() { + return Context.NONE; + } + + /** + * Merges default client context with provided context. + * + * @param context the context to be merged with default client context. + * @return the merged context. + */ + public Context mergeContext(Context context) { + for (Map.Entry entry : this.getContext().getValues().entrySet()) { + context = context.addData(entry.getKey(), entry.getValue()); + } + return context; + } + + /** + * Gets long running operation result. + * + * @param activationResponse the response of activation operation. + * @param httpPipeline the http pipeline. + * @param pollResultType type of poll result. + * @param finalResultType type of final result. + * @param context the context shared by all requests. + * @param type of poll result. + * @param type of final result. + * @return poller flux for poll result and final result. + */ + public PollerFlux, U> getLroResult( + Mono>> activationResponse, + HttpPipeline httpPipeline, + Type pollResultType, + Type finalResultType, + Context context) { + return PollerFactory + .create( + serializerAdapter, + httpPipeline, + pollResultType, + finalResultType, + defaultPollInterval, + activationResponse, + context); + } + + /** + * Gets the final result, or an error, based on last async poll response. + * + * @param response the last async poll response. + * @param type of poll result. + * @param type of final result. + * @return the final result, or an error. + */ + public Mono getLroFinalResultOrError(AsyncPollResponse, U> response) { + if (response.getStatus() != LongRunningOperationStatus.SUCCESSFULLY_COMPLETED) { + String errorMessage; + ManagementError managementError = null; + HttpResponse errorResponse = null; + PollResult.Error lroError = response.getValue().getError(); + if (lroError != null) { + errorResponse = + new HttpResponseImpl( + lroError.getResponseStatusCode(), lroError.getResponseHeaders(), lroError.getResponseBody()); + + errorMessage = response.getValue().getError().getMessage(); + String errorBody = response.getValue().getError().getResponseBody(); + if (errorBody != null) { + // try to deserialize error body to ManagementError + try { + managementError = + this + .getSerializerAdapter() + .deserialize(errorBody, ManagementError.class, SerializerEncoding.JSON); + if (managementError.getCode() == null || managementError.getMessage() == null) { + managementError = null; + } + } catch (IOException | RuntimeException ioe) { + logger.logThrowableAsWarning(ioe); + } + } + } else { + // fallback to default error message + errorMessage = "Long running operation failed."; + } + if (managementError == null) { + // fallback to default ManagementError + managementError = new ManagementError(response.getStatus().toString(), errorMessage); + } + return Mono.error(new ManagementException(errorMessage, errorResponse, managementError)); + } else { + return response.getFinalResult(); + } + } + + private static final class HttpResponseImpl extends HttpResponse { + private final int statusCode; + + private final byte[] responseBody; + + private final HttpHeaders httpHeaders; + + HttpResponseImpl(int statusCode, HttpHeaders httpHeaders, String responseBody) { + super(null); + this.statusCode = statusCode; + this.httpHeaders = httpHeaders; + this.responseBody = responseBody == null ? null : responseBody.getBytes(StandardCharsets.UTF_8); + } + + public int getStatusCode() { + return statusCode; + } + + public String getHeaderValue(String s) { + return httpHeaders.getValue(s); + } + + public HttpHeaders getHeaders() { + return httpHeaders; + } + + public Flux getBody() { + return Flux.just(ByteBuffer.wrap(responseBody)); + } + + public Mono getBodyAsByteArray() { + return Mono.just(responseBody); + } + + public Mono getBodyAsString() { + return Mono.just(new String(responseBody, StandardCharsets.UTF_8)); + } + + public Mono getBodyAsString(Charset charset) { + return Mono.just(new String(responseBody, charset)); + } + } +} diff --git a/sdk/authorization/azure-resourcemanager-authorization-generated/src/main/java/com/azure/resourcemanager/authorization/generated/implementation/RoleAssignmentImpl.java b/sdk/authorization/azure-resourcemanager-authorization-generated/src/main/java/com/azure/resourcemanager/authorization/generated/implementation/RoleAssignmentImpl.java new file mode 100644 index 0000000000000..c5c812d8f8155 --- /dev/null +++ b/sdk/authorization/azure-resourcemanager-authorization-generated/src/main/java/com/azure/resourcemanager/authorization/generated/implementation/RoleAssignmentImpl.java @@ -0,0 +1,196 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.authorization.generated.implementation; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.authorization.generated.fluent.models.RoleAssignmentInner; +import com.azure.resourcemanager.authorization.generated.models.PrincipalType; +import com.azure.resourcemanager.authorization.generated.models.RoleAssignment; +import com.azure.resourcemanager.authorization.generated.models.RoleAssignmentCreateParameters; +import java.time.OffsetDateTime; + +public final class RoleAssignmentImpl implements RoleAssignment, RoleAssignment.Definition { + private RoleAssignmentInner innerObject; + + private final com.azure.resourcemanager.authorization.generated.AuthorizationManager serviceManager; + + RoleAssignmentImpl( + RoleAssignmentInner innerObject, + com.azure.resourcemanager.authorization.generated.AuthorizationManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String scope() { + return this.innerModel().scope(); + } + + public String roleDefinitionId() { + return this.innerModel().roleDefinitionId(); + } + + public String principalId() { + return this.innerModel().principalId(); + } + + public PrincipalType principalType() { + return this.innerModel().principalType(); + } + + public Boolean canDelegate() { + return this.innerModel().canDelegate(); + } + + public String description() { + return this.innerModel().description(); + } + + public String condition() { + return this.innerModel().condition(); + } + + public String conditionVersion() { + return this.innerModel().conditionVersion(); + } + + public OffsetDateTime createdOn() { + return this.innerModel().createdOn(); + } + + public OffsetDateTime updatedOn() { + return this.innerModel().updatedOn(); + } + + public String createdBy() { + return this.innerModel().createdBy(); + } + + public String updatedBy() { + return this.innerModel().updatedBy(); + } + + public String delegatedManagedIdentityResourceId() { + return this.innerModel().delegatedManagedIdentityResourceId(); + } + + public RoleAssignmentInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.authorization.generated.AuthorizationManager manager() { + return this.serviceManager; + } + + private String scope; + + private String roleAssignmentName; + + private RoleAssignmentCreateParameters createParameters; + + public RoleAssignmentImpl withExistingScope(String scope) { + this.scope = scope; + return this; + } + + public RoleAssignment create() { + this.innerObject = + serviceManager + .serviceClient() + .getRoleAssignments() + .createWithResponse(scope, roleAssignmentName, createParameters, Context.NONE) + .getValue(); + return this; + } + + public RoleAssignment create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getRoleAssignments() + .createWithResponse(scope, roleAssignmentName, createParameters, context) + .getValue(); + return this; + } + + RoleAssignmentImpl( + String name, com.azure.resourcemanager.authorization.generated.AuthorizationManager serviceManager) { + this.innerObject = new RoleAssignmentInner(); + this.serviceManager = serviceManager; + this.roleAssignmentName = name; + this.createParameters = new RoleAssignmentCreateParameters(); + } + + public RoleAssignment refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getRoleAssignments() + .getWithResponse(scope, roleAssignmentName, Context.NONE) + .getValue(); + return this; + } + + public RoleAssignment refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getRoleAssignments() + .getWithResponse(scope, roleAssignmentName, context) + .getValue(); + return this; + } + + public RoleAssignmentImpl withRoleDefinitionId(String roleDefinitionId) { + this.createParameters.withRoleDefinitionId(roleDefinitionId); + return this; + } + + public RoleAssignmentImpl withPrincipalId(String principalId) { + this.createParameters.withPrincipalId(principalId); + return this; + } + + public RoleAssignmentImpl withPrincipalType(PrincipalType principalType) { + this.createParameters.withPrincipalType(principalType); + return this; + } + + public RoleAssignmentImpl withCanDelegate(Boolean canDelegate) { + this.createParameters.withCanDelegate(canDelegate); + return this; + } + + public RoleAssignmentImpl withDescription(String description) { + this.createParameters.withDescription(description); + return this; + } + + public RoleAssignmentImpl withCondition(String condition) { + this.createParameters.withCondition(condition); + return this; + } + + public RoleAssignmentImpl withConditionVersion(String conditionVersion) { + this.createParameters.withConditionVersion(conditionVersion); + return this; + } + + public RoleAssignmentImpl withDelegatedManagedIdentityResourceId(String delegatedManagedIdentityResourceId) { + this.createParameters.withDelegatedManagedIdentityResourceId(delegatedManagedIdentityResourceId); + return this; + } +} diff --git a/sdk/authorization/azure-resourcemanager-authorization-generated/src/main/java/com/azure/resourcemanager/authorization/generated/implementation/RoleAssignmentsClientImpl.java b/sdk/authorization/azure-resourcemanager-authorization-generated/src/main/java/com/azure/resourcemanager/authorization/generated/implementation/RoleAssignmentsClientImpl.java new file mode 100644 index 0000000000000..bf1b32a0019a0 --- /dev/null +++ b/sdk/authorization/azure-resourcemanager-authorization-generated/src/main/java/com/azure/resourcemanager/authorization/generated/implementation/RoleAssignmentsClientImpl.java @@ -0,0 +1,2175 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.authorization.generated.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.authorization.generated.fluent.RoleAssignmentsClient; +import com.azure.resourcemanager.authorization.generated.fluent.models.RoleAssignmentInner; +import com.azure.resourcemanager.authorization.generated.models.RoleAssignmentCreateParameters; +import com.azure.resourcemanager.authorization.generated.models.RoleAssignmentListResult; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in RoleAssignmentsClient. */ +public final class RoleAssignmentsClientImpl implements RoleAssignmentsClient { + private final ClientLogger logger = new ClientLogger(RoleAssignmentsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final RoleAssignmentsService service; + + /** The service client containing this operation class. */ + private final AuthorizationManagementClientImpl client; + + /** + * Initializes an instance of RoleAssignmentsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + RoleAssignmentsClientImpl(AuthorizationManagementClientImpl client) { + this.service = + RestProxy.create(RoleAssignmentsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for AuthorizationManagementClientRoleAssignments to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "AuthorizationManagem") + private interface RoleAssignmentsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}" + + "/{parentResourcePath}/{resourceType}/{resourceName}/providers/Microsoft.Authorization" + + "/roleAssignments") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listForResource( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("resourceProviderNamespace") String resourceProviderNamespace, + @PathParam(value = "parentResourcePath", encoded = true) String parentResourcePath, + @PathParam(value = "resourceType", encoded = true) String resourceType, + @PathParam("resourceName") String resourceName, + @QueryParam("$filter") String filter, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Authorization" + + "/roleAssignments") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroup( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @QueryParam("$filter") String filter, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete("/{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}") + @ExpectedResponses({200, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete( + @HostParam("$host") String endpoint, + @PathParam(value = "scope", encoded = true) String scope, + @PathParam("roleAssignmentName") String roleAssignmentName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put("/{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}") + @ExpectedResponses({201}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> create( + @HostParam("$host") String endpoint, + @PathParam(value = "scope", encoded = true) String scope, + @PathParam("roleAssignmentName") String roleAssignmentName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") RoleAssignmentCreateParameters parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("/{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam(value = "scope", encoded = true) String scope, + @PathParam("roleAssignmentName") String roleAssignmentName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete("/{roleId}") + @ExpectedResponses({200, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> deleteById( + @HostParam("$host") String endpoint, + @PathParam(value = "roleId", encoded = true) String roleId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put("/{roleId}") + @ExpectedResponses({201}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> createById( + @HostParam("$host") String endpoint, + @PathParam(value = "roleId", encoded = true) String roleId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") RoleAssignmentCreateParameters parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("/{roleId}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getById( + @HostParam("$host") String endpoint, + @PathParam(value = "roleId", encoded = true) String roleId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/roleAssignments") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @QueryParam("$filter") String filter, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("/{scope}/providers/Microsoft.Authorization/roleAssignments") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listForScope( + @HostParam("$host") String endpoint, + @PathParam(value = "scope", encoded = true) String scope, + @QueryParam("$filter") String filter, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listForResourceNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listForResourceGroupNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listForScopeNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * List role assignments for a resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return role assignment list operation result. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listForResourceSinglePageAsync( + String resourceGroupName, + String resourceProviderNamespace, + String parentResourcePath, + String resourceType, + String resourceName, + String filter) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (resourceProviderNamespace == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter resourceProviderNamespace is required and cannot be null.")); + } + if (parentResourcePath == null) { + return Mono + .error(new IllegalArgumentException("Parameter parentResourcePath is required and cannot be null.")); + } + if (resourceType == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceType is required and cannot be null.")); + } + if (resourceName == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listForResource( + this.client.getEndpoint(), + resourceGroupName, + resourceProviderNamespace, + parentResourcePath, + resourceType, + resourceName, + filter, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List role assignments for a resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return role assignment list operation result. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listForResourceSinglePageAsync( + String resourceGroupName, + String resourceProviderNamespace, + String parentResourcePath, + String resourceType, + String resourceName, + String filter, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (resourceProviderNamespace == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter resourceProviderNamespace is required and cannot be null.")); + } + if (parentResourcePath == null) { + return Mono + .error(new IllegalArgumentException("Parameter parentResourcePath is required and cannot be null.")); + } + if (resourceType == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceType is required and cannot be null.")); + } + if (resourceName == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listForResource( + this.client.getEndpoint(), + resourceGroupName, + resourceProviderNamespace, + parentResourcePath, + resourceType, + resourceName, + filter, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * List role assignments for a resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return role assignment list operation result. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listForResourceAsync( + String resourceGroupName, + String resourceProviderNamespace, + String parentResourcePath, + String resourceType, + String resourceName, + String filter) { + return new PagedFlux<>( + () -> + listForResourceSinglePageAsync( + resourceGroupName, + resourceProviderNamespace, + parentResourcePath, + resourceType, + resourceName, + filter), + nextLink -> listForResourceNextSinglePageAsync(nextLink)); + } + + /** + * List role assignments for a resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return role assignment list operation result. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listForResourceAsync( + String resourceGroupName, + String resourceProviderNamespace, + String parentResourcePath, + String resourceType, + String resourceName) { + final String filter = null; + return new PagedFlux<>( + () -> + listForResourceSinglePageAsync( + resourceGroupName, + resourceProviderNamespace, + parentResourcePath, + resourceType, + resourceName, + filter), + nextLink -> listForResourceNextSinglePageAsync(nextLink)); + } + + /** + * List role assignments for a resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return role assignment list operation result. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listForResourceAsync( + String resourceGroupName, + String resourceProviderNamespace, + String parentResourcePath, + String resourceType, + String resourceName, + String filter, + Context context) { + return new PagedFlux<>( + () -> + listForResourceSinglePageAsync( + resourceGroupName, + resourceProviderNamespace, + parentResourcePath, + resourceType, + resourceName, + filter, + context), + nextLink -> listForResourceNextSinglePageAsync(nextLink, context)); + } + + /** + * List role assignments for a resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return role assignment list operation result. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listForResource( + String resourceGroupName, + String resourceProviderNamespace, + String parentResourcePath, + String resourceType, + String resourceName) { + final String filter = null; + return new PagedIterable<>( + listForResourceAsync( + resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, filter)); + } + + /** + * List role assignments for a resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return role assignment list operation result. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listForResource( + String resourceGroupName, + String resourceProviderNamespace, + String parentResourcePath, + String resourceType, + String resourceName, + String filter, + Context context) { + return new PagedIterable<>( + listForResourceAsync( + resourceGroupName, + resourceProviderNamespace, + parentResourcePath, + resourceType, + resourceName, + filter, + context)); + } + + /** + * List role assignments for a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return role assignment list operation result. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync( + String resourceGroupName, String filter) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByResourceGroup( + this.client.getEndpoint(), + resourceGroupName, + filter, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List role assignments for a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return role assignment list operation result. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync( + String resourceGroupName, String filter, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByResourceGroup( + this.client.getEndpoint(), + resourceGroupName, + filter, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * List role assignments for a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return role assignment list operation result. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName, String filter) { + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName, filter), + nextLink -> listForResourceGroupNextSinglePageAsync(nextLink)); + } + + /** + * List role assignments for a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return role assignment list operation result. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName) { + final String filter = null; + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName, filter), + nextLink -> listForResourceGroupNextSinglePageAsync(nextLink)); + } + + /** + * List role assignments for a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return role assignment list operation result. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync( + String resourceGroupName, String filter, Context context) { + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName, filter, context), + nextLink -> listForResourceGroupNextSinglePageAsync(nextLink, context)); + } + + /** + * List role assignments for a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return role assignment list operation result. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName) { + final String filter = null; + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName, filter)); + } + + /** + * List role assignments for a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return role assignment list operation result. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup( + String resourceGroupName, String filter, Context context) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName, filter, context)); + } + + /** + * Delete 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return role Assignments. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync(String scope, String roleAssignmentName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (scope == null) { + return Mono.error(new IllegalArgumentException("Parameter scope is required and cannot be null.")); + } + if (roleAssignmentName == null) { + return Mono + .error(new IllegalArgumentException("Parameter roleAssignmentName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + scope, + roleAssignmentName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Delete a role assignment. + * + * @param scope The scope of the role assignment to delete. + * @param roleAssignmentName The name of the role assignment to delete. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return role Assignments. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync( + String scope, String roleAssignmentName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (scope == null) { + return Mono.error(new IllegalArgumentException("Parameter scope is required and cannot be null.")); + } + if (roleAssignmentName == null) { + return Mono + .error(new IllegalArgumentException("Parameter roleAssignmentName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .delete(this.client.getEndpoint(), scope, roleAssignmentName, this.client.getApiVersion(), accept, context); + } + + /** + * Delete 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return role Assignments. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String scope, String roleAssignmentName) { + return deleteWithResponseAsync(scope, roleAssignmentName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Delete 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return role Assignments. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public RoleAssignmentInner delete(String scope, String roleAssignmentName) { + return deleteAsync(scope, roleAssignmentName).block(); + } + + /** + * Delete a role assignment. + * + * @param scope The scope of the role assignment to delete. + * @param roleAssignmentName The name of the role assignment to delete. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return role Assignments. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteWithResponse(String scope, String roleAssignmentName, Context context) { + return deleteWithResponseAsync(scope, roleAssignmentName, context).block(); + } + + /** + * Create 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return role Assignments. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createWithResponseAsync( + String scope, String roleAssignmentName, RoleAssignmentCreateParameters parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (scope == null) { + return Mono.error(new IllegalArgumentException("Parameter scope is required and cannot be null.")); + } + if (roleAssignmentName == null) { + return Mono + .error(new IllegalArgumentException("Parameter roleAssignmentName is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .create( + this.client.getEndpoint(), + scope, + roleAssignmentName, + this.client.getApiVersion(), + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Create 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return role Assignments. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createWithResponseAsync( + String scope, String roleAssignmentName, RoleAssignmentCreateParameters parameters, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (scope == null) { + return Mono.error(new IllegalArgumentException("Parameter scope is required and cannot be null.")); + } + if (roleAssignmentName == null) { + return Mono + .error(new IllegalArgumentException("Parameter roleAssignmentName is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .create( + this.client.getEndpoint(), + scope, + roleAssignmentName, + this.client.getApiVersion(), + parameters, + accept, + context); + } + + /** + * Create 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return role Assignments. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createAsync( + String scope, String roleAssignmentName, RoleAssignmentCreateParameters parameters) { + return createWithResponseAsync(scope, roleAssignmentName, parameters) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Create 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return role Assignments. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public RoleAssignmentInner create( + String scope, String roleAssignmentName, RoleAssignmentCreateParameters parameters) { + return createAsync(scope, roleAssignmentName, parameters).block(); + } + + /** + * Create 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return role Assignments. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createWithResponse( + String scope, String roleAssignmentName, RoleAssignmentCreateParameters parameters, Context context) { + return createWithResponseAsync(scope, roleAssignmentName, parameters, context).block(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the specified role assignment. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String scope, String roleAssignmentName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (scope == null) { + return Mono.error(new IllegalArgumentException("Parameter scope is required and cannot be null.")); + } + if (roleAssignmentName == null) { + return Mono + .error(new IllegalArgumentException("Parameter roleAssignmentName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + scope, + roleAssignmentName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the specified role assignment. + * + * @param scope The scope of the role assignment. + * @param roleAssignmentName The name of the role assignment to get. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the specified role assignment. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String scope, String roleAssignmentName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (scope == null) { + return Mono.error(new IllegalArgumentException("Parameter scope is required and cannot be null.")); + } + if (roleAssignmentName == null) { + return Mono + .error(new IllegalArgumentException("Parameter roleAssignmentName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get(this.client.getEndpoint(), scope, roleAssignmentName, this.client.getApiVersion(), accept, context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the specified role assignment. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String scope, String roleAssignmentName) { + return getWithResponseAsync(scope, roleAssignmentName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the specified role assignment. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public RoleAssignmentInner get(String scope, String roleAssignmentName) { + return getAsync(scope, roleAssignmentName).block(); + } + + /** + * Get the specified role assignment. + * + * @param scope The scope of the role assignment. + * @param roleAssignmentName The name of the role assignment to get. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the specified role assignment. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String scope, String roleAssignmentName, Context context) { + return getWithResponseAsync(scope, roleAssignmentName, context).block(); + } + + /** + * Delete a role assignment. + * + * @param roleId The ID of the role assignment to delete. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return role Assignments. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteByIdWithResponseAsync(String roleId) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (roleId == null) { + return Mono.error(new IllegalArgumentException("Parameter roleId is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service.deleteById(this.client.getEndpoint(), roleId, this.client.getApiVersion(), accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Delete a role assignment. + * + * @param roleId The ID of the role assignment to delete. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return role Assignments. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteByIdWithResponseAsync(String roleId, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (roleId == null) { + return Mono.error(new IllegalArgumentException("Parameter roleId is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.deleteById(this.client.getEndpoint(), roleId, this.client.getApiVersion(), accept, context); + } + + /** + * Delete a role assignment. + * + * @param roleId The ID of the role assignment to delete. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return role Assignments. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteByIdAsync(String roleId) { + return deleteByIdWithResponseAsync(roleId) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Delete a role assignment. + * + * @param roleId The ID of the role assignment to delete. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return role Assignments. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public RoleAssignmentInner deleteById(String roleId) { + return deleteByIdAsync(roleId).block(); + } + + /** + * Delete a role assignment. + * + * @param roleId The ID of the role assignment to delete. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return role Assignments. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteByIdWithResponse(String roleId, Context context) { + return deleteByIdWithResponseAsync(roleId, context).block(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return role Assignments. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createByIdWithResponseAsync( + String roleId, RoleAssignmentCreateParameters parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (roleId == null) { + return Mono.error(new IllegalArgumentException("Parameter roleId is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createById( + this.client.getEndpoint(), + roleId, + this.client.getApiVersion(), + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates a role assignment by ID. + * + * @param roleId The ID of the role assignment to create. + * @param parameters Parameters for the role assignment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return role Assignments. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createByIdWithResponseAsync( + String roleId, RoleAssignmentCreateParameters parameters, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (roleId == null) { + return Mono.error(new IllegalArgumentException("Parameter roleId is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createById(this.client.getEndpoint(), roleId, this.client.getApiVersion(), parameters, accept, context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return role Assignments. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createByIdAsync(String roleId, RoleAssignmentCreateParameters parameters) { + return createByIdWithResponseAsync(roleId, parameters) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return role Assignments. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public RoleAssignmentInner createById(String roleId, RoleAssignmentCreateParameters parameters) { + return createByIdAsync(roleId, parameters).block(); + } + + /** + * Creates a role assignment by ID. + * + * @param roleId The ID of the role assignment to create. + * @param parameters Parameters for the role assignment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return role Assignments. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createByIdWithResponse( + String roleId, RoleAssignmentCreateParameters parameters, Context context) { + return createByIdWithResponseAsync(roleId, parameters, context).block(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a role assignment by ID. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByIdWithResponseAsync(String roleId) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (roleId == null) { + return Mono.error(new IllegalArgumentException("Parameter roleId is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service.getById(this.client.getEndpoint(), roleId, this.client.getApiVersion(), accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a role assignment by ID. + * + * @param roleId The ID of the role assignment to get. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a role assignment by ID. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByIdWithResponseAsync(String roleId, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (roleId == null) { + return Mono.error(new IllegalArgumentException("Parameter roleId is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.getById(this.client.getEndpoint(), roleId, this.client.getApiVersion(), accept, context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a role assignment by ID. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByIdAsync(String roleId) { + return getByIdWithResponseAsync(roleId) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a role assignment by ID. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public RoleAssignmentInner getById(String roleId) { + return getByIdAsync(roleId).block(); + } + + /** + * Gets a role assignment by ID. + * + * @param roleId The ID of the role assignment to get. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a role assignment by ID. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByIdWithResponse(String roleId, Context context) { + return getByIdWithResponseAsync(roleId, context).block(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all role assignments for the subscription. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String filter) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + filter, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all role assignments for the subscription. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String filter, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list( + this.client.getEndpoint(), + filter, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all role assignments for the subscription. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String filter) { + return new PagedFlux<>(() -> listSinglePageAsync(filter), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Gets all role assignments for the subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all role assignments for the subscription. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + final String filter = null; + return new PagedFlux<>(() -> listSinglePageAsync(filter), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all role assignments for the subscription. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String filter, Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(filter, context), nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets all role assignments for the subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all role assignments for the subscription. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + final String filter = null; + return new PagedIterable<>(listAsync(filter)); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all role assignments for the subscription. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String filter, Context context) { + return new PagedIterable<>(listAsync(filter, context)); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return role assignments for a scope. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listForScopeSinglePageAsync(String scope, String filter) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (scope == null) { + return Mono.error(new IllegalArgumentException("Parameter scope is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listForScope( + this.client.getEndpoint(), scope, filter, this.client.getApiVersion(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return role assignments for a scope. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listForScopeSinglePageAsync( + String scope, String filter, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (scope == null) { + return Mono.error(new IllegalArgumentException("Parameter scope is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listForScope(this.client.getEndpoint(), scope, filter, this.client.getApiVersion(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return role assignments for a scope. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listForScopeAsync(String scope, String filter) { + return new PagedFlux<>( + () -> listForScopeSinglePageAsync(scope, filter), nextLink -> listForScopeNextSinglePageAsync(nextLink)); + } + + /** + * Gets role assignments for a scope. + * + * @param scope The scope of the role assignments. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return role assignments for a scope. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listForScopeAsync(String scope) { + final String filter = null; + return new PagedFlux<>( + () -> listForScopeSinglePageAsync(scope, filter), nextLink -> listForScopeNextSinglePageAsync(nextLink)); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return role assignments for a scope. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listForScopeAsync(String scope, String filter, Context context) { + return new PagedFlux<>( + () -> listForScopeSinglePageAsync(scope, filter, context), + nextLink -> listForScopeNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets role assignments for a scope. + * + * @param scope The scope of the role assignments. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return role assignments for a scope. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listForScope(String scope) { + final String filter = null; + return new PagedIterable<>(listForScopeAsync(scope, filter)); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return role assignments for a scope. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listForScope(String scope, String filter, Context context) { + return new PagedIterable<>(listForScopeAsync(scope, filter, context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return role assignment list operation result. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listForResourceNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listForResourceNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return role assignment list operation result. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listForResourceNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listForResourceNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return role assignment list operation result. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listForResourceGroupNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listForResourceGroupNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return role assignment list operation result. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listForResourceGroupNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listForResourceGroupNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return role assignment list operation result. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return role assignment list operation result. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return role assignment list operation result. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listForScopeNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listForScopeNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return role assignment list operation result. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listForScopeNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listForScopeNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/authorization/azure-resourcemanager-authorization-generated/src/main/java/com/azure/resourcemanager/authorization/generated/implementation/RoleAssignmentsImpl.java b/sdk/authorization/azure-resourcemanager-authorization-generated/src/main/java/com/azure/resourcemanager/authorization/generated/implementation/RoleAssignmentsImpl.java new file mode 100644 index 0000000000000..be3cf50412da9 --- /dev/null +++ b/sdk/authorization/azure-resourcemanager-authorization-generated/src/main/java/com/azure/resourcemanager/authorization/generated/implementation/RoleAssignmentsImpl.java @@ -0,0 +1,223 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.authorization.generated.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.authorization.generated.fluent.RoleAssignmentsClient; +import com.azure.resourcemanager.authorization.generated.fluent.models.RoleAssignmentInner; +import com.azure.resourcemanager.authorization.generated.models.RoleAssignment; +import com.azure.resourcemanager.authorization.generated.models.RoleAssignmentCreateParameters; +import com.azure.resourcemanager.authorization.generated.models.RoleAssignments; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class RoleAssignmentsImpl implements RoleAssignments { + @JsonIgnore private final ClientLogger logger = new ClientLogger(RoleAssignmentsImpl.class); + + private final RoleAssignmentsClient innerClient; + + private final com.azure.resourcemanager.authorization.generated.AuthorizationManager serviceManager; + + public RoleAssignmentsImpl( + RoleAssignmentsClient innerClient, + com.azure.resourcemanager.authorization.generated.AuthorizationManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listForResource( + String resourceGroupName, + String resourceProviderNamespace, + String parentResourcePath, + String resourceType, + String resourceName) { + PagedIterable inner = + this + .serviceClient() + .listForResource( + resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName); + return Utils.mapPage(inner, inner1 -> new RoleAssignmentImpl(inner1, this.manager())); + } + + public PagedIterable listForResource( + String resourceGroupName, + String resourceProviderNamespace, + String parentResourcePath, + String resourceType, + String resourceName, + String filter, + Context context) { + PagedIterable inner = + this + .serviceClient() + .listForResource( + resourceGroupName, + resourceProviderNamespace, + parentResourcePath, + resourceType, + resourceName, + filter, + context); + return Utils.mapPage(inner, inner1 -> new RoleAssignmentImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName); + return Utils.mapPage(inner, inner1 -> new RoleAssignmentImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName, String filter, Context context) { + PagedIterable inner = + this.serviceClient().listByResourceGroup(resourceGroupName, filter, context); + return Utils.mapPage(inner, inner1 -> new RoleAssignmentImpl(inner1, this.manager())); + } + + public RoleAssignment deleteByResourceGroup(String scope, String roleAssignmentName) { + RoleAssignmentInner inner = this.serviceClient().delete(scope, roleAssignmentName); + if (inner != null) { + return new RoleAssignmentImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response deleteWithResponse(String scope, String roleAssignmentName, Context context) { + Response inner = + this.serviceClient().deleteWithResponse(scope, roleAssignmentName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new RoleAssignmentImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public RoleAssignment get(String scope, String roleAssignmentName) { + RoleAssignmentInner inner = this.serviceClient().get(scope, roleAssignmentName); + if (inner != null) { + return new RoleAssignmentImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse(String scope, String roleAssignmentName, Context context) { + Response inner = this.serviceClient().getWithResponse(scope, roleAssignmentName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new RoleAssignmentImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public RoleAssignment deleteById(String roleId) { + RoleAssignmentInner inner = this.serviceClient().deleteById(roleId); + if (inner != null) { + return new RoleAssignmentImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response deleteByIdWithResponse(String roleId, Context context) { + Response inner = this.serviceClient().deleteByIdWithResponse(roleId, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new RoleAssignmentImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public RoleAssignment createById(String roleId, RoleAssignmentCreateParameters parameters) { + RoleAssignmentInner inner = this.serviceClient().createById(roleId, parameters); + if (inner != null) { + return new RoleAssignmentImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response createByIdWithResponse( + String roleId, RoleAssignmentCreateParameters parameters, Context context) { + Response inner = this.serviceClient().createByIdWithResponse(roleId, parameters, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new RoleAssignmentImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public RoleAssignment getById(String roleId) { + RoleAssignmentInner inner = this.serviceClient().getById(roleId); + if (inner != null) { + return new RoleAssignmentImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getByIdWithResponse(String roleId, Context context) { + Response inner = this.serviceClient().getByIdWithResponse(roleId, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new RoleAssignmentImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return Utils.mapPage(inner, inner1 -> new RoleAssignmentImpl(inner1, this.manager())); + } + + public PagedIterable list(String filter, Context context) { + PagedIterable inner = this.serviceClient().list(filter, context); + return Utils.mapPage(inner, inner1 -> new RoleAssignmentImpl(inner1, this.manager())); + } + + public PagedIterable listForScope(String scope) { + PagedIterable inner = this.serviceClient().listForScope(scope); + return Utils.mapPage(inner, inner1 -> new RoleAssignmentImpl(inner1, this.manager())); + } + + public PagedIterable listForScope(String scope, String filter, Context context) { + PagedIterable inner = this.serviceClient().listForScope(scope, filter, context); + return Utils.mapPage(inner, inner1 -> new RoleAssignmentImpl(inner1, this.manager())); + } + + private RoleAssignmentsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.authorization.generated.AuthorizationManager manager() { + return this.serviceManager; + } + + public RoleAssignmentImpl define(String name) { + return new RoleAssignmentImpl(name, this.manager()); + } +} diff --git a/sdk/authorization/azure-resourcemanager-authorization-generated/src/main/java/com/azure/resourcemanager/authorization/generated/implementation/Utils.java b/sdk/authorization/azure-resourcemanager-authorization-generated/src/main/java/com/azure/resourcemanager/authorization/generated/implementation/Utils.java new file mode 100644 index 0000000000000..9ee144b3a9883 --- /dev/null +++ b/sdk/authorization/azure-resourcemanager-authorization-generated/src/main/java/com/azure/resourcemanager/authorization/generated/implementation/Utils.java @@ -0,0 +1,204 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.authorization.generated.implementation; + +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.util.CoreUtils; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.Iterator; +import java.util.List; +import java.util.function.Function; +import java.util.stream.Collectors; +import java.util.stream.Stream; +import reactor.core.publisher.Flux; + +final class Utils { + static String getValueFromIdByName(String id, String name) { + if (id == null) { + return null; + } + Iterator itr = Arrays.stream(id.split("/")).iterator(); + while (itr.hasNext()) { + String part = itr.next(); + if (part != null && !part.trim().isEmpty()) { + if (part.equalsIgnoreCase(name)) { + if (itr.hasNext()) { + return itr.next(); + } else { + return null; + } + } + } + } + return null; + } + + static String getValueFromIdByParameterName(String id, String pathTemplate, String parameterName) { + if (id == null || pathTemplate == null) { + return null; + } + String parameterNameParentheses = "{" + parameterName + "}"; + List idSegmentsReverted = Arrays.asList(id.split("/")); + List pathSegments = Arrays.asList(pathTemplate.split("/")); + Collections.reverse(idSegmentsReverted); + Iterator idItrReverted = idSegmentsReverted.iterator(); + int pathIndex = pathSegments.size(); + while (idItrReverted.hasNext() && pathIndex > 0) { + String idSegment = idItrReverted.next(); + String pathSegment = pathSegments.get(--pathIndex); + if (!CoreUtils.isNullOrEmpty(idSegment) && !CoreUtils.isNullOrEmpty(pathSegment)) { + if (pathSegment.equalsIgnoreCase(parameterNameParentheses)) { + if (pathIndex == 0 || (pathIndex == 1 && pathSegments.get(0).isEmpty())) { + List segments = new ArrayList<>(); + segments.add(idSegment); + idItrReverted.forEachRemaining(segments::add); + Collections.reverse(segments); + if (segments.size() > 0 && segments.get(0).isEmpty()) { + segments.remove(0); + } + return String.join("/", segments); + } else { + return idSegment; + } + } + } + } + return null; + } + + static PagedIterable mapPage(PagedIterable pageIterable, Function mapper) { + return new PagedIterableImpl(pageIterable, mapper); + } + + private static final class PagedIterableImpl extends PagedIterable { + + private final PagedIterable pagedIterable; + private final Function mapper; + private final Function, PagedResponse> pageMapper; + + private PagedIterableImpl(PagedIterable pagedIterable, Function mapper) { + super( + PagedFlux + .create( + () -> + (continuationToken, pageSize) -> + Flux.fromStream(pagedIterable.streamByPage().map(getPageMapper(mapper))))); + this.pagedIterable = pagedIterable; + this.mapper = mapper; + this.pageMapper = getPageMapper(mapper); + } + + private static Function, PagedResponse> getPageMapper(Function mapper) { + return page -> + new PagedResponseBase( + page.getRequest(), + page.getStatusCode(), + page.getHeaders(), + page.getElements().stream().map(mapper).collect(Collectors.toList()), + page.getContinuationToken(), + null); + } + + @Override + public Stream stream() { + return pagedIterable.stream().map(mapper); + } + + @Override + public Stream> streamByPage() { + return pagedIterable.streamByPage().map(pageMapper); + } + + @Override + public Stream> streamByPage(String continuationToken) { + return pagedIterable.streamByPage(continuationToken).map(pageMapper); + } + + @Override + public Stream> streamByPage(int preferredPageSize) { + return pagedIterable.streamByPage(preferredPageSize).map(pageMapper); + } + + @Override + public Stream> streamByPage(String continuationToken, int preferredPageSize) { + return pagedIterable.streamByPage(continuationToken, preferredPageSize).map(pageMapper); + } + + @Override + public Iterator iterator() { + return new IteratorImpl(pagedIterable.iterator(), mapper); + } + + @Override + public Iterable> iterableByPage() { + return new IterableImpl, PagedResponse>(pagedIterable.iterableByPage(), pageMapper); + } + + @Override + public Iterable> iterableByPage(String continuationToken) { + return new IterableImpl, PagedResponse>( + pagedIterable.iterableByPage(continuationToken), pageMapper); + } + + @Override + public Iterable> iterableByPage(int preferredPageSize) { + return new IterableImpl, PagedResponse>( + pagedIterable.iterableByPage(preferredPageSize), pageMapper); + } + + @Override + public Iterable> iterableByPage(String continuationToken, int preferredPageSize) { + return new IterableImpl, PagedResponse>( + pagedIterable.iterableByPage(continuationToken, preferredPageSize), pageMapper); + } + } + + private static final class IteratorImpl implements Iterator { + + private final Iterator iterator; + private final Function mapper; + + private IteratorImpl(Iterator iterator, Function mapper) { + this.iterator = iterator; + this.mapper = mapper; + } + + @Override + public boolean hasNext() { + return iterator.hasNext(); + } + + @Override + public S next() { + return mapper.apply(iterator.next()); + } + + @Override + public void remove() { + iterator.remove(); + } + } + + private static final class IterableImpl implements Iterable { + + private final Iterable iterable; + private final Function mapper; + + private IterableImpl(Iterable iterable, Function mapper) { + this.iterable = iterable; + this.mapper = mapper; + } + + @Override + public Iterator iterator() { + return new IteratorImpl(iterable.iterator(), mapper); + } + } +} diff --git a/sdk/authorization/azure-resourcemanager-authorization-generated/src/main/java/com/azure/resourcemanager/authorization/generated/implementation/package-info.java b/sdk/authorization/azure-resourcemanager-authorization-generated/src/main/java/com/azure/resourcemanager/authorization/generated/implementation/package-info.java new file mode 100644 index 0000000000000..c819d27ea8e3a --- /dev/null +++ b/sdk/authorization/azure-resourcemanager-authorization-generated/src/main/java/com/azure/resourcemanager/authorization/generated/implementation/package-info.java @@ -0,0 +1,10 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * Package containing the implementations for AuthorizationManagementClient. Role based access control provides you a + * way to apply granular level policy administration down to individual resources or resource groups. These operations + * enable you to manage role assignments. A role assignment grants access to Azure Active Directory users. + */ +package com.azure.resourcemanager.authorization.generated.implementation; diff --git a/sdk/authorization/azure-resourcemanager-authorization-generated/src/main/java/com/azure/resourcemanager/authorization/generated/models/PrincipalType.java b/sdk/authorization/azure-resourcemanager-authorization-generated/src/main/java/com/azure/resourcemanager/authorization/generated/models/PrincipalType.java new file mode 100644 index 0000000000000..92a5340e584ba --- /dev/null +++ b/sdk/authorization/azure-resourcemanager-authorization-generated/src/main/java/com/azure/resourcemanager/authorization/generated/models/PrincipalType.java @@ -0,0 +1,58 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.authorization.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** 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/sdk/authorization/azure-resourcemanager-authorization-generated/src/main/java/com/azure/resourcemanager/authorization/generated/models/RoleAssignment.java b/sdk/authorization/azure-resourcemanager-authorization-generated/src/main/java/com/azure/resourcemanager/authorization/generated/models/RoleAssignment.java new file mode 100644 index 0000000000000..2bac63b76702f --- /dev/null +++ b/sdk/authorization/azure-resourcemanager-authorization-generated/src/main/java/com/azure/resourcemanager/authorization/generated/models/RoleAssignment.java @@ -0,0 +1,288 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.authorization.generated.models; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.authorization.generated.fluent.models.RoleAssignmentInner; +import java.time.OffsetDateTime; + +/** An immutable client-side representation of RoleAssignment. */ +public interface RoleAssignment { + /** + * Gets the id property: The role assignment ID. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The role assignment name. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The role assignment type. + * + * @return the type value. + */ + String type(); + + /** + * Gets the scope property: The role assignment scope. + * + * @return the scope value. + */ + String scope(); + + /** + * Gets the roleDefinitionId property: The role definition ID. + * + * @return the roleDefinitionId value. + */ + String roleDefinitionId(); + + /** + * Gets the principalId property: The principal ID. + * + * @return the principalId value. + */ + String principalId(); + + /** + * Gets the principalType property: The principal type of the assigned principal ID. + * + * @return the principalType value. + */ + PrincipalType principalType(); + + /** + * Gets the canDelegate property: The Delegation flag for the role assignment. + * + * @return the canDelegate value. + */ + Boolean canDelegate(); + + /** + * Gets the description property: Description of role assignment. + * + * @return the description value. + */ + String description(); + + /** + * Gets the condition property: The conditions on the role assignment. This limits the resources it can be assigned + * to. e.g.: @Resource[Microsoft.Storage/storageAccounts/blobServices/containers:ContainerName] + * StringEqualsIgnoreCase 'foo_storage_container'. + * + * @return the condition value. + */ + String condition(); + + /** + * Gets the conditionVersion property: Version of the condition. Currently accepted value is '2.0'. + * + * @return the conditionVersion value. + */ + String conditionVersion(); + + /** + * Gets the createdOn property: Time it was created. + * + * @return the createdOn value. + */ + OffsetDateTime createdOn(); + + /** + * Gets the updatedOn property: Time it was updated. + * + * @return the updatedOn value. + */ + OffsetDateTime updatedOn(); + + /** + * Gets the createdBy property: Id of the user who created the assignment. + * + * @return the createdBy value. + */ + String createdBy(); + + /** + * Gets the updatedBy property: Id of the user who updated the assignment. + * + * @return the updatedBy value. + */ + String updatedBy(); + + /** + * Gets the delegatedManagedIdentityResourceId property: Id of the delegated managed identity resource. + * + * @return the delegatedManagedIdentityResourceId value. + */ + String delegatedManagedIdentityResourceId(); + + /** + * Gets the inner com.azure.resourcemanager.authorization.generated.fluent.models.RoleAssignmentInner object. + * + * @return the inner object. + */ + RoleAssignmentInner innerModel(); + + /** The entirety of the RoleAssignment definition. */ + interface Definition + extends DefinitionStages.Blank, + DefinitionStages.WithScope, + DefinitionStages.WithRoleDefinitionId, + DefinitionStages.WithPrincipalId, + DefinitionStages.WithCreate { + } + /** The RoleAssignment definition stages. */ + interface DefinitionStages { + /** The first stage of the RoleAssignment definition. */ + interface Blank extends WithScope { + } + /** The stage of the RoleAssignment definition allowing to specify parent resource. */ + 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. + */ + WithRoleDefinitionId withExistingScope(String scope); + } + /** The stage of the RoleAssignment definition allowing to specify roleDefinitionId. */ + interface WithRoleDefinitionId { + /** + * Specifies the roleDefinitionId property: The role definition ID used in the role assignment.. + * + * @param roleDefinitionId The role definition ID used in the role assignment. + * @return the next definition stage. + */ + WithPrincipalId withRoleDefinitionId(String roleDefinitionId); + } + /** The stage of the RoleAssignment definition allowing to specify principalId. */ + interface WithPrincipalId { + /** + * Specifies the principalId property: 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 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. + */ + WithCreate withPrincipalId(String principalId); + } + /** + * The stage of the RoleAssignment definition which contains all the minimum required properties for the + * resource to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate + extends DefinitionStages.WithPrincipalType, + DefinitionStages.WithCanDelegate, + DefinitionStages.WithDescription, + DefinitionStages.WithCondition, + DefinitionStages.WithConditionVersion, + DefinitionStages.WithDelegatedManagedIdentityResourceId { + /** + * Executes the create request. + * + * @return the created resource. + */ + RoleAssignment create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + RoleAssignment create(Context context); + } + /** The stage of the RoleAssignment definition allowing to specify principalType. */ + interface WithPrincipalType { + /** + * Specifies the principalType property: The principal type of the assigned principal ID.. + * + * @param principalType The principal type of the assigned principal ID. + * @return the next definition stage. + */ + WithCreate withPrincipalType(PrincipalType principalType); + } + /** The stage of the RoleAssignment definition allowing to specify canDelegate. */ + interface WithCanDelegate { + /** + * Specifies the canDelegate property: The delegation flag used for creating a role assignment. + * + * @param canDelegate The delegation flag used for creating a role assignment. + * @return the next definition stage. + */ + WithCreate withCanDelegate(Boolean canDelegate); + } + /** The stage of the RoleAssignment definition allowing to specify description. */ + interface WithDescription { + /** + * Specifies the description property: Description of role assignment. + * + * @param description Description of role assignment. + * @return the next definition stage. + */ + WithCreate withDescription(String description); + } + /** The stage of the RoleAssignment definition allowing to specify condition. */ + interface WithCondition { + /** + * Specifies the condition property: The conditions on the role assignment. This limits the resources it can + * be assigned to. e.g.: @Resource[Microsoft.Storage/storageAccounts/blobServices/containers:ContainerName] + * StringEqualsIgnoreCase 'foo_storage_container'. + * + * @param condition The conditions on the role assignment. This limits the resources it can be assigned to. + * e.g.: @Resource[Microsoft.Storage/storageAccounts/blobServices/containers:ContainerName] + * StringEqualsIgnoreCase 'foo_storage_container'. + * @return the next definition stage. + */ + WithCreate withCondition(String condition); + } + /** The stage of the RoleAssignment definition allowing to specify conditionVersion. */ + interface WithConditionVersion { + /** + * Specifies the conditionVersion property: Version of the condition. Currently accepted value is '2.0'. + * + * @param conditionVersion Version of the condition. Currently accepted value is '2.0'. + * @return the next definition stage. + */ + WithCreate withConditionVersion(String conditionVersion); + } + /** The stage of the RoleAssignment definition allowing to specify delegatedManagedIdentityResourceId. */ + interface WithDelegatedManagedIdentityResourceId { + /** + * Specifies the delegatedManagedIdentityResourceId property: Id of the delegated managed identity resource. + * + * @param delegatedManagedIdentityResourceId Id of the delegated managed identity resource. + * @return the next definition stage. + */ + WithCreate withDelegatedManagedIdentityResourceId(String delegatedManagedIdentityResourceId); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + RoleAssignment refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + RoleAssignment refresh(Context context); +} diff --git a/sdk/authorization/azure-resourcemanager-authorization-generated/src/main/java/com/azure/resourcemanager/authorization/generated/models/RoleAssignmentCreateParameters.java b/sdk/authorization/azure-resourcemanager-authorization-generated/src/main/java/com/azure/resourcemanager/authorization/generated/models/RoleAssignmentCreateParameters.java new file mode 100644 index 0000000000000..e44fcb10e7fd4 --- /dev/null +++ b/sdk/authorization/azure-resourcemanager-authorization-generated/src/main/java/com/azure/resourcemanager/authorization/generated/models/RoleAssignmentCreateParameters.java @@ -0,0 +1,258 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.authorization.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Role assignment create parameters. */ +@JsonFlatten +@Fluent +public class RoleAssignmentCreateParameters { + @JsonIgnore private final ClientLogger logger = new ClientLogger(RoleAssignmentCreateParameters.class); + + /* + * 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. + */ + @JsonProperty(value = "properties.principalType") + private PrincipalType principalType; + + /* + * The delegation flag used for creating a role assignment + */ + @JsonProperty(value = "properties.canDelegate") + private Boolean canDelegate; + + /* + * Description of role assignment + */ + @JsonProperty(value = "properties.description") + private String description; + + /* + * The conditions on the role assignment. This limits the resources it can + * be assigned to. e.g.: + * @Resource[Microsoft.Storage/storageAccounts/blobServices/containers:ContainerName] + * StringEqualsIgnoreCase 'foo_storage_container' + */ + @JsonProperty(value = "properties.condition") + private String condition; + + /* + * Version of the condition. Currently accepted value is '2.0' + */ + @JsonProperty(value = "properties.conditionVersion") + private String conditionVersion; + + /* + * Id of the delegated managed identity resource + */ + @JsonProperty(value = "properties.delegatedManagedIdentityResourceId") + private String delegatedManagedIdentityResourceId; + + /** + * Get the roleDefinitionId property: The role definition ID used in the role assignment. + * + * @return the roleDefinitionId value. + */ + public String roleDefinitionId() { + return this.roleDefinitionId; + } + + /** + * Set the roleDefinitionId property: 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 principalId property: 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 principalId property: 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 principalType property: The principal type of the assigned principal ID. + * + * @return the principalType value. + */ + public PrincipalType principalType() { + return this.principalType; + } + + /** + * Set the principalType property: The principal type of the assigned principal ID. + * + * @param principalType the principalType value to set. + * @return the RoleAssignmentCreateParameters object itself. + */ + public RoleAssignmentCreateParameters withPrincipalType(PrincipalType principalType) { + this.principalType = principalType; + return this; + } + + /** + * Get the canDelegate property: The delegation flag used for creating a role assignment. + * + * @return the canDelegate value. + */ + public Boolean canDelegate() { + return this.canDelegate; + } + + /** + * Set the canDelegate property: The delegation 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; + } + + /** + * Get the description property: Description of role assignment. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Set the description property: Description of role assignment. + * + * @param description the description value to set. + * @return the RoleAssignmentCreateParameters object itself. + */ + public RoleAssignmentCreateParameters withDescription(String description) { + this.description = description; + return this; + } + + /** + * Get the condition property: The conditions on the role assignment. This limits the resources it can be assigned + * to. e.g.: @Resource[Microsoft.Storage/storageAccounts/blobServices/containers:ContainerName] + * StringEqualsIgnoreCase 'foo_storage_container'. + * + * @return the condition value. + */ + public String condition() { + return this.condition; + } + + /** + * Set the condition property: The conditions on the role assignment. This limits the resources it can be assigned + * to. e.g.: @Resource[Microsoft.Storage/storageAccounts/blobServices/containers:ContainerName] + * StringEqualsIgnoreCase 'foo_storage_container'. + * + * @param condition the condition value to set. + * @return the RoleAssignmentCreateParameters object itself. + */ + public RoleAssignmentCreateParameters withCondition(String condition) { + this.condition = condition; + return this; + } + + /** + * Get the conditionVersion property: Version of the condition. Currently accepted value is '2.0'. + * + * @return the conditionVersion value. + */ + public String conditionVersion() { + return this.conditionVersion; + } + + /** + * Set the conditionVersion property: Version of the condition. Currently accepted value is '2.0'. + * + * @param conditionVersion the conditionVersion value to set. + * @return the RoleAssignmentCreateParameters object itself. + */ + public RoleAssignmentCreateParameters withConditionVersion(String conditionVersion) { + this.conditionVersion = conditionVersion; + return this; + } + + /** + * Get the delegatedManagedIdentityResourceId property: Id of the delegated managed identity resource. + * + * @return the delegatedManagedIdentityResourceId value. + */ + public String delegatedManagedIdentityResourceId() { + return this.delegatedManagedIdentityResourceId; + } + + /** + * Set the delegatedManagedIdentityResourceId property: Id of the delegated managed identity resource. + * + * @param delegatedManagedIdentityResourceId the delegatedManagedIdentityResourceId value to set. + * @return the RoleAssignmentCreateParameters object itself. + */ + public RoleAssignmentCreateParameters withDelegatedManagedIdentityResourceId( + String delegatedManagedIdentityResourceId) { + this.delegatedManagedIdentityResourceId = delegatedManagedIdentityResourceId; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (roleDefinitionId() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property roleDefinitionId in model RoleAssignmentCreateParameters")); + } + if (principalId() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property principalId in model RoleAssignmentCreateParameters")); + } + } +} diff --git a/sdk/authorization/azure-resourcemanager-authorization-generated/src/main/java/com/azure/resourcemanager/authorization/generated/models/RoleAssignmentListResult.java b/sdk/authorization/azure-resourcemanager-authorization-generated/src/main/java/com/azure/resourcemanager/authorization/generated/models/RoleAssignmentListResult.java new file mode 100644 index 0000000000000..02e72a281aacf --- /dev/null +++ b/sdk/authorization/azure-resourcemanager-authorization-generated/src/main/java/com/azure/resourcemanager/authorization/generated/models/RoleAssignmentListResult.java @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.authorization.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.authorization.generated.fluent.models.RoleAssignmentInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Role assignment list operation result. */ +@Fluent +public final class RoleAssignmentListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(RoleAssignmentListResult.class); + + /* + * Role assignment list. + */ + @JsonProperty(value = "value") + private List value; + + /* + * The URL to use for getting the next set of results. + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** + * Get the value property: Role assignment list. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: Role assignment list. + * + * @param value the value value to set. + * @return the RoleAssignmentListResult object itself. + */ + public RoleAssignmentListResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The URL to use for getting the next set of results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: The URL to use for getting the next set of results. + * + * @param nextLink the nextLink value to set. + * @return the RoleAssignmentListResult object itself. + */ + public RoleAssignmentListResult withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/authorization/azure-resourcemanager-authorization-generated/src/main/java/com/azure/resourcemanager/authorization/generated/models/RoleAssignments.java b/sdk/authorization/azure-resourcemanager-authorization-generated/src/main/java/com/azure/resourcemanager/authorization/generated/models/RoleAssignments.java new file mode 100644 index 0000000000000..55bd2f573c44e --- /dev/null +++ b/sdk/authorization/azure-resourcemanager-authorization-generated/src/main/java/com/azure/resourcemanager/authorization/generated/models/RoleAssignments.java @@ -0,0 +1,263 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.authorization.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of RoleAssignments. */ +public interface RoleAssignments { + /** + * List role assignments for a resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return role assignment list operation result. + */ + PagedIterable listForResource( + String resourceGroupName, + String resourceProviderNamespace, + String parentResourcePath, + String resourceType, + String resourceName); + + /** + * List role assignments for a resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return role assignment list operation result. + */ + PagedIterable listForResource( + String resourceGroupName, + String resourceProviderNamespace, + String parentResourcePath, + String resourceType, + String resourceName, + String filter, + Context context); + + /** + * List role assignments for a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return role assignment list operation result. + */ + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * List role assignments for a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return role assignment list operation result. + */ + PagedIterable listByResourceGroup(String resourceGroupName, String filter, Context context); + + /** + * Delete 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return role Assignments. + */ + RoleAssignment deleteByResourceGroup(String scope, String roleAssignmentName); + + /** + * Delete a role assignment. + * + * @param scope The scope of the role assignment to delete. + * @param roleAssignmentName The name of the role assignment to delete. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return role Assignments. + */ + Response deleteWithResponse(String scope, String roleAssignmentName, Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the specified role assignment. + */ + RoleAssignment get(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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the specified role assignment. + */ + Response getWithResponse(String scope, String roleAssignmentName, Context context); + + /** + * Delete a role assignment. + * + * @param roleId The ID of the role assignment to delete. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return role Assignments. + */ + RoleAssignment deleteById(String roleId); + + /** + * Delete a role assignment. + * + * @param roleId The ID of the role assignment to delete. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return role Assignments. + */ + Response deleteByIdWithResponse(String roleId, Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return role Assignments. + */ + RoleAssignment createById(String roleId, RoleAssignmentCreateParameters parameters); + + /** + * Creates a role assignment by ID. + * + * @param roleId The ID of the role assignment to create. + * @param parameters Parameters for the role assignment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return role Assignments. + */ + Response createByIdWithResponse( + String roleId, RoleAssignmentCreateParameters parameters, Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a role assignment by ID. + */ + RoleAssignment getById(String roleId); + + /** + * Gets a role assignment by ID. + * + * @param roleId The ID of the role assignment to get. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a role assignment by ID. + */ + Response getByIdWithResponse(String roleId, Context context); + + /** + * Gets all role assignments for the subscription. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all role assignments for the subscription. + */ + PagedIterable list(); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all role assignments for the subscription. + */ + PagedIterable list(String filter, Context context); + + /** + * Gets role assignments for a scope. + * + * @param scope The scope of the role assignments. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return role assignments for a scope. + */ + PagedIterable listForScope(String scope); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return role assignments for a scope. + */ + PagedIterable listForScope(String scope, String filter, Context context); + + /** + * Begins definition for a new RoleAssignment resource. + * + * @param name resource name. + * @return the first stage of the new RoleAssignment definition. + */ + RoleAssignment.DefinitionStages.Blank define(String name); +} diff --git a/sdk/authorization/azure-resourcemanager-authorization-generated/src/main/java/com/azure/resourcemanager/authorization/generated/models/package-info.java b/sdk/authorization/azure-resourcemanager-authorization-generated/src/main/java/com/azure/resourcemanager/authorization/generated/models/package-info.java new file mode 100644 index 0000000000000..b3130c700051b --- /dev/null +++ b/sdk/authorization/azure-resourcemanager-authorization-generated/src/main/java/com/azure/resourcemanager/authorization/generated/models/package-info.java @@ -0,0 +1,10 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * Package containing the data models for AuthorizationManagementClient. Role based access control provides you a way to + * apply granular level policy administration down to individual resources or resource groups. These operations enable + * you to manage role assignments. A role assignment grants access to Azure Active Directory users. + */ +package com.azure.resourcemanager.authorization.generated.models; diff --git a/sdk/authorization/azure-resourcemanager-authorization-generated/src/main/java/com/azure/resourcemanager/authorization/generated/package-info.java b/sdk/authorization/azure-resourcemanager-authorization-generated/src/main/java/com/azure/resourcemanager/authorization/generated/package-info.java new file mode 100644 index 0000000000000..f434948e72757 --- /dev/null +++ b/sdk/authorization/azure-resourcemanager-authorization-generated/src/main/java/com/azure/resourcemanager/authorization/generated/package-info.java @@ -0,0 +1,10 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * Package containing the classes for AuthorizationManagementClient. Role based access control provides you a way to + * apply granular level policy administration down to individual resources or resource groups. These operations enable + * you to manage role assignments. A role assignment grants access to Azure Active Directory users. + */ +package com.azure.resourcemanager.authorization.generated; diff --git a/sdk/authorization/azure-resourcemanager-authorization-generated/src/main/java/module-info.java b/sdk/authorization/azure-resourcemanager-authorization-generated/src/main/java/module-info.java new file mode 100644 index 0000000000000..ff6e8e09354da --- /dev/null +++ b/sdk/authorization/azure-resourcemanager-authorization-generated/src/main/java/module-info.java @@ -0,0 +1,19 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +module com.azure.resourcemanager.authorization.generated { + requires transitive com.azure.core.management; + + exports com.azure.resourcemanager.authorization.generated; + exports com.azure.resourcemanager.authorization.generated.fluent; + exports com.azure.resourcemanager.authorization.generated.fluent.models; + exports com.azure.resourcemanager.authorization.generated.models; + + opens com.azure.resourcemanager.authorization.generated.fluent.models to + com.azure.core, + com.fasterxml.jackson.databind; + opens com.azure.resourcemanager.authorization.generated.models to + com.azure.core, + com.fasterxml.jackson.databind; +} diff --git a/sdk/authorization/ci.yml b/sdk/authorization/ci.yml index 152cf949dd0c7..763b3e4c09add 100644 --- a/sdk/authorization/ci.yml +++ b/sdk/authorization/ci.yml @@ -10,12 +10,6 @@ trigger: paths: include: - sdk/authorization/ - exclude: - - sdk/authorization/mgmt - - sdk/authorization/mgmt-v2015_06_01 - - sdk/authorization/mgmt-v2015_07_01 - - sdk/authorization/mgmt-v2018_07_01_preview - - sdk/authorization/mgmt-v2018_09_01_preview pr: branches: @@ -28,19 +22,12 @@ pr: paths: include: - sdk/authorization/ - exclude: - - sdk/authorization/mgmt - - sdk/authorization/mgmt-v2015_06_01 - - sdk/authorization/mgmt-v2015_07_01 - - sdk/authorization/mgmt-v2018_07_01_preview - - sdk/authorization/mgmt-v2018_09_01_preview extends: template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: - SDKType: data ServiceDirectory: authorization Artifacts: - - name: azure-authentication-msi-token-provider - groupId: com.microsoft.azure.msi_auth_token_provider - safeName: azureauthenticationmsitokenprovider + - name: azure-resourcemanager-authorization-generated + groupId: com.azure.resourcemanager + safeName: azureresourcemanagerauthorizationgenerated diff --git a/sdk/authorization/pom.xml b/sdk/authorization/pom.xml index bd6a9b28d5fe6..3f73e6e47b919 100644 --- a/sdk/authorization/pom.xml +++ b/sdk/authorization/pom.xml @@ -9,6 +9,7 @@ pom 1.0.0 + azure-resourcemanager-authorization-generated microsoft-azure-authentication-msi-token-provider