From cdcf903c5ab49b522f95d13d3678a1f2949f7709 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Thu, 9 Nov 2023 02:40:10 +0000 Subject: [PATCH] CodeGen from PR 3688 in openapi-env-test/azure-rest-api-specs Merge 38495c1cc9e5b9b5b265a3dc01e7f310061f1476 into 41e238f9fd4ba837de65fca653a971f577529b12 --- eng/versioning/version_client.txt | 1 + pom.xml | 1 + .../CHANGELOG.md | 5 + .../README.md | 105 ++ .../SAMPLE.md | 180 +++ .../pom.xml | 61 + .../generated/AuthorizationManager.java | 286 +++++ .../fluent/AuthorizationManagementClient.java | 46 + .../RoleAssignmentScheduleRequestsClient.java | 182 +++ .../RoleAssignmentScheduleRequestInner.java | 425 +++++++ ...leAssignmentScheduleRequestProperties.java | 469 ++++++++ .../generated/fluent/models/package-info.java | 10 + .../generated/fluent/package-info.java | 10 + .../AuthorizationManagementClientBuilder.java | 123 ++ .../AuthorizationManagementClientImpl.java | 275 +++++ .../RoleAssignmentScheduleRequestImpl.java | 261 +++++ ...eAssignmentScheduleRequestsClientImpl.java | 1018 +++++++++++++++++ .../RoleAssignmentScheduleRequestsImpl.java | 178 +++ .../generated/implementation/Utils.java | 204 ++++ .../implementation/package-info.java | 10 + .../generated/models/ExpandedProperties.java | 111 ++ .../models/ExpandedPropertiesPrincipal.java | 128 +++ .../ExpandedPropertiesRoleDefinition.java | 102 ++ .../models/ExpandedPropertiesScope.java | 102 ++ .../generated/models/PrincipalType.java | 56 + .../generated/models/RequestType.java | 68 ++ .../models/RoleAssignmentScheduleRequest.java | 415 +++++++ ...leAssignmentScheduleRequestListResult.java | 81 ++ ...ScheduleRequestPropertiesScheduleInfo.java | 81 ++ ...questPropertiesScheduleInfoExpiration.java | 103 ++ ...ntScheduleRequestPropertiesTicketInfo.java | 76 ++ .../RoleAssignmentScheduleRequests.java | 155 +++ .../generated/models/Status.java | 107 ++ .../authorization/generated/models/Type.java | 50 + .../generated/models/package-info.java | 10 + .../authorization/generated/package-info.java | 10 + .../src/main/java/module-info.java | 19 + ...signmentScheduleRequestsCancelSamples.java | 26 + ...signmentScheduleRequestsCreateSamples.java | 47 + ...eAssignmentScheduleRequestsGetSamples.java | 26 + ...ntScheduleRequestsListForScopeSamples.java | 26 + ...gnmentScheduleRequestsValidateSamples.java | 50 + sdk/authorization/ci.yml | 47 + sdk/authorization/pom.xml | 15 + 44 files changed, 5761 insertions(+) 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/SAMPLE.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/RoleAssignmentScheduleRequestsClient.java create mode 100644 sdk/authorization/azure-resourcemanager-authorization-generated/src/main/java/com/azure/resourcemanager/authorization/generated/fluent/models/RoleAssignmentScheduleRequestInner.java create mode 100644 sdk/authorization/azure-resourcemanager-authorization-generated/src/main/java/com/azure/resourcemanager/authorization/generated/fluent/models/RoleAssignmentScheduleRequestProperties.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/RoleAssignmentScheduleRequestImpl.java create mode 100644 sdk/authorization/azure-resourcemanager-authorization-generated/src/main/java/com/azure/resourcemanager/authorization/generated/implementation/RoleAssignmentScheduleRequestsClientImpl.java create mode 100644 sdk/authorization/azure-resourcemanager-authorization-generated/src/main/java/com/azure/resourcemanager/authorization/generated/implementation/RoleAssignmentScheduleRequestsImpl.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/ExpandedProperties.java create mode 100644 sdk/authorization/azure-resourcemanager-authorization-generated/src/main/java/com/azure/resourcemanager/authorization/generated/models/ExpandedPropertiesPrincipal.java create mode 100644 sdk/authorization/azure-resourcemanager-authorization-generated/src/main/java/com/azure/resourcemanager/authorization/generated/models/ExpandedPropertiesRoleDefinition.java create mode 100644 sdk/authorization/azure-resourcemanager-authorization-generated/src/main/java/com/azure/resourcemanager/authorization/generated/models/ExpandedPropertiesScope.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/RequestType.java create mode 100644 sdk/authorization/azure-resourcemanager-authorization-generated/src/main/java/com/azure/resourcemanager/authorization/generated/models/RoleAssignmentScheduleRequest.java create mode 100644 sdk/authorization/azure-resourcemanager-authorization-generated/src/main/java/com/azure/resourcemanager/authorization/generated/models/RoleAssignmentScheduleRequestListResult.java create mode 100644 sdk/authorization/azure-resourcemanager-authorization-generated/src/main/java/com/azure/resourcemanager/authorization/generated/models/RoleAssignmentScheduleRequestPropertiesScheduleInfo.java create mode 100644 sdk/authorization/azure-resourcemanager-authorization-generated/src/main/java/com/azure/resourcemanager/authorization/generated/models/RoleAssignmentScheduleRequestPropertiesScheduleInfoExpiration.java create mode 100644 sdk/authorization/azure-resourcemanager-authorization-generated/src/main/java/com/azure/resourcemanager/authorization/generated/models/RoleAssignmentScheduleRequestPropertiesTicketInfo.java create mode 100644 sdk/authorization/azure-resourcemanager-authorization-generated/src/main/java/com/azure/resourcemanager/authorization/generated/models/RoleAssignmentScheduleRequests.java create mode 100644 sdk/authorization/azure-resourcemanager-authorization-generated/src/main/java/com/azure/resourcemanager/authorization/generated/models/Status.java create mode 100644 sdk/authorization/azure-resourcemanager-authorization-generated/src/main/java/com/azure/resourcemanager/authorization/generated/models/Type.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 create mode 100644 sdk/authorization/azure-resourcemanager-authorization-generated/src/samples/java/com/azure/resourcemanager/authorization/generated/generated/RoleAssignmentScheduleRequestsCancelSamples.java create mode 100644 sdk/authorization/azure-resourcemanager-authorization-generated/src/samples/java/com/azure/resourcemanager/authorization/generated/generated/RoleAssignmentScheduleRequestsCreateSamples.java create mode 100644 sdk/authorization/azure-resourcemanager-authorization-generated/src/samples/java/com/azure/resourcemanager/authorization/generated/generated/RoleAssignmentScheduleRequestsGetSamples.java create mode 100644 sdk/authorization/azure-resourcemanager-authorization-generated/src/samples/java/com/azure/resourcemanager/authorization/generated/generated/RoleAssignmentScheduleRequestsListForScopeSamples.java create mode 100644 sdk/authorization/azure-resourcemanager-authorization-generated/src/samples/java/com/azure/resourcemanager/authorization/generated/generated/RoleAssignmentScheduleRequestsValidateSamples.java create mode 100644 sdk/authorization/ci.yml create mode 100644 sdk/authorization/pom.xml diff --git a/eng/versioning/version_client.txt b/eng/versioning/version_client.txt index 7bb4aab049c4e..4188666690b71 100644 --- a/eng/versioning/version_client.txt +++ b/eng/versioning/version_client.txt @@ -412,6 +412,7 @@ com.azure.resourcemanager:azure-resourcemanager-newrelicobservability;1.0.0;1.1. com.azure.resourcemanager:azure-resourcemanager-qumulo;1.0.0;1.1.0-beta.1 com.azure.resourcemanager:azure-resourcemanager-selfhelp;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-networkcloud;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 com.azure.tools:azure-sdk-archetype;1.0.0;1.2.0-beta.1 com.azure.tools:azure-sdk-build-tool;1.0.0-beta.1;1.0.0-beta.2 diff --git a/pom.xml b/pom.xml index b839c84e1c62f..59ab186723e68 100644 --- a/pom.xml +++ b/pom.xml @@ -23,6 +23,7 @@ sdk/appcontainers sdk/applicationinsights sdk/attestation + sdk/authorization sdk/automanage sdk/automation sdk/avs 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..34a96421c8dae --- /dev/null +++ b/sdk/authorization/azure-resourcemanager-authorization-generated/CHANGELOG.md @@ -0,0 +1,5 @@ +# Release History + +## 1.0.0-beta.1 (2023-11-09) + +- 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-2023-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..e7375ed8ce836 --- /dev/null +++ b/sdk/authorization/azure-resourcemanager-authorization-generated/README.md @@ -0,0 +1,105 @@ +# 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-2023-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] and [Azure Core Netty HTTP][azure_core_http_netty] packages provide the default implementation. + +### Authentication + +By default, Azure Active Directory token authentication depends on correct configuration of the 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 `AZURE_SUBSCRIPTION_ID` environment variable. + +With above configuration, `azure` client can be authenticated using the 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 + +[Code snippets and samples](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/authorization/azure-resourcemanager-authorization-generated/SAMPLE.md) + + +## Troubleshooting + +## Next steps + +## Contributing + +For details on contributing to this repository, see the [contributing guide][cg]. + +This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit . + +When you submit a pull request, a CLA-bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repositories using our CLA. + +This project has adopted the [Microsoft Open Source Code of Conduct][coc]. For more information see the [Code of Conduct FAQ][coc_faq] or contact with any additional questions or comments. + + +[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/main/sdk/identity/azure-identity +[azure_core_http_netty]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/core/azure-core-http-netty +[authenticate]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/resourcemanager/docs/AUTH.md +[design]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/resourcemanager/docs/DESIGN.md +[cg]: https://github.com/Azure/azure-sdk-for-java/blob/main/CONTRIBUTING.md +[coc]: https://opensource.microsoft.com/codeofconduct/ +[coc_faq]: https://opensource.microsoft.com/codeofconduct/faq/ diff --git a/sdk/authorization/azure-resourcemanager-authorization-generated/SAMPLE.md b/sdk/authorization/azure-resourcemanager-authorization-generated/SAMPLE.md new file mode 100644 index 0000000000000..a08e3d1266ea4 --- /dev/null +++ b/sdk/authorization/azure-resourcemanager-authorization-generated/SAMPLE.md @@ -0,0 +1,180 @@ +# Code snippets and samples + + +## RoleAssignmentScheduleRequests + +- [Cancel](#roleassignmentschedulerequests_cancel) +- [Create](#roleassignmentschedulerequests_create) +- [Get](#roleassignmentschedulerequests_get) +- [ListForScope](#roleassignmentschedulerequests_listforscope) +- [Validate](#roleassignmentschedulerequests_validate) +### RoleAssignmentScheduleRequests_Cancel + +```java +/** Samples for RoleAssignmentScheduleRequests Cancel. */ +public final class RoleAssignmentScheduleRequestsCancelSamples { + /* + * x-ms-original-file: specification/authorization/resource-manager/Microsoft.Authorization/preview/2023-04-01-preview/examples/CancelRoleAssignmentScheduleRequestByName.json + */ + /** + * Sample code: CancelRoleAssignmentScheduleRequestByName. + * + * @param manager Entry point to AuthorizationManager. + */ + public static void cancelRoleAssignmentScheduleRequestByName( + com.azure.resourcemanager.authorization.generated.AuthorizationManager manager) { + manager + .roleAssignmentScheduleRequests() + .cancelWithResponse( + "providers/Microsoft.Subscription/subscriptions/dfa2a084-766f-4003-8ae1-c4aeb893a99f", + "fea7a502-9a96-4806-a26f-eee560e52045", + com.azure.core.util.Context.NONE); + } +} +``` + +### RoleAssignmentScheduleRequests_Create + +```java +import com.azure.resourcemanager.authorization.generated.models.RequestType; +import com.azure.resourcemanager.authorization.generated.models.RoleAssignmentScheduleRequestPropertiesScheduleInfo; +import com.azure.resourcemanager.authorization.generated.models.RoleAssignmentScheduleRequestPropertiesScheduleInfoExpiration; +import com.azure.resourcemanager.authorization.generated.models.Type; +import java.time.OffsetDateTime; + +/** Samples for RoleAssignmentScheduleRequests Create. */ +public final class RoleAssignmentScheduleRequestsCreateSamples { + /* + * x-ms-original-file: specification/authorization/resource-manager/Microsoft.Authorization/preview/2023-04-01-preview/examples/PutRoleAssignmentScheduleRequest.json + */ + /** + * Sample code: PutRoleAssignmentScheduleRequest. + * + * @param manager Entry point to AuthorizationManager. + */ + public static void putRoleAssignmentScheduleRequest( + com.azure.resourcemanager.authorization.generated.AuthorizationManager manager) { + manager + .roleAssignmentScheduleRequests() + .define("fea7a502-9a96-4806-a26f-eee560e52045") + .withExistingScope("providers/Microsoft.Subscription/subscriptions/dfa2a084-766f-4003-8ae1-c4aeb893a99f") + .withRoleDefinitionId( + "/subscriptions/dfa2a084-766f-4003-8ae1-c4aeb893a99f/providers/Microsoft.Authorization/roleDefinitions/c8d4ff99-41c3-41a8-9f60-21dfdad59608") + .withPrincipalId("a3bb8764-cb92-4276-9d2a-ca1e895e55ea") + .withRequestType(RequestType.SELF_ACTIVATE) + .withScheduleInfo( + new RoleAssignmentScheduleRequestPropertiesScheduleInfo() + .withStartDateTime(OffsetDateTime.parse("2020-09-09T21:35:27.91Z")) + .withExpiration( + new RoleAssignmentScheduleRequestPropertiesScheduleInfoExpiration() + .withType(Type.AFTER_DURATION) + .withDuration("PT8H"))) + .withLinkedRoleEligibilityScheduleId("b1477448-2cc6-4ceb-93b4-54a202a89413") + .withCondition( + "@Resource[Microsoft.Storage/storageAccounts/blobServices/containers:ContainerName]" + + " StringEqualsIgnoreCase 'foo_storage_container'") + .withConditionVersion("1.0") + .create(); + } +} +``` + +### RoleAssignmentScheduleRequests_Get + +```java +/** Samples for RoleAssignmentScheduleRequests Get. */ +public final class RoleAssignmentScheduleRequestsGetSamples { + /* + * x-ms-original-file: specification/authorization/resource-manager/Microsoft.Authorization/preview/2023-04-01-preview/examples/GetRoleAssignmentScheduleRequestByName.json + */ + /** + * Sample code: GetRoleAssignmentScheduleRequestByName. + * + * @param manager Entry point to AuthorizationManager. + */ + public static void getRoleAssignmentScheduleRequestByName( + com.azure.resourcemanager.authorization.generated.AuthorizationManager manager) { + manager + .roleAssignmentScheduleRequests() + .getWithResponse( + "providers/Microsoft.Subscription/subscriptions/dfa2a084-766f-4003-8ae1-c4aeb893a99f", + "fea7a502-9a96-4806-a26f-eee560e52045", + com.azure.core.util.Context.NONE); + } +} +``` + +### RoleAssignmentScheduleRequests_ListForScope + +```java +/** Samples for RoleAssignmentScheduleRequests ListForScope. */ +public final class RoleAssignmentScheduleRequestsListForScopeSamples { + /* + * x-ms-original-file: specification/authorization/resource-manager/Microsoft.Authorization/preview/2023-04-01-preview/examples/GetRoleAssignmentScheduleRequestByScope.json + */ + /** + * Sample code: GetRoleAssignmentScheduleRequestByScope. + * + * @param manager Entry point to AuthorizationManager. + */ + public static void getRoleAssignmentScheduleRequestByScope( + com.azure.resourcemanager.authorization.generated.AuthorizationManager manager) { + manager + .roleAssignmentScheduleRequests() + .listForScope( + "providers/Microsoft.Subscription/subscriptions/dfa2a084-766f-4003-8ae1-c4aeb893a99f", + "assignedTo('A3BB8764-CB92-4276-9D2A-CA1E895E55EA')", + com.azure.core.util.Context.NONE); + } +} +``` + +### RoleAssignmentScheduleRequests_Validate + +```java +import com.azure.resourcemanager.authorization.generated.fluent.models.RoleAssignmentScheduleRequestInner; +import com.azure.resourcemanager.authorization.generated.models.RequestType; +import com.azure.resourcemanager.authorization.generated.models.RoleAssignmentScheduleRequestPropertiesScheduleInfo; +import com.azure.resourcemanager.authorization.generated.models.RoleAssignmentScheduleRequestPropertiesScheduleInfoExpiration; +import com.azure.resourcemanager.authorization.generated.models.Type; +import java.time.OffsetDateTime; + +/** Samples for RoleAssignmentScheduleRequests Validate. */ +public final class RoleAssignmentScheduleRequestsValidateSamples { + /* + * x-ms-original-file: specification/authorization/resource-manager/Microsoft.Authorization/preview/2023-04-01-preview/examples/ValidateRoleAssignmentScheduleRequestByName.json + */ + /** + * Sample code: ValidateRoleAssignmentScheduleRequestByName. + * + * @param manager Entry point to AuthorizationManager. + */ + public static void validateRoleAssignmentScheduleRequestByName( + com.azure.resourcemanager.authorization.generated.AuthorizationManager manager) { + manager + .roleAssignmentScheduleRequests() + .validateWithResponse( + "subscriptions/dfa2a084-766f-4003-8ae1-c4aeb893a99f", + "fea7a502-9a96-4806-a26f-eee560e52045", + new RoleAssignmentScheduleRequestInner() + .withRoleDefinitionId( + "/subscriptions/dfa2a084-766f-4003-8ae1-c4aeb893a99f/providers/Microsoft.Authorization/roleDefinitions/c8d4ff99-41c3-41a8-9f60-21dfdad59608") + .withPrincipalId("a3bb8764-cb92-4276-9d2a-ca1e895e55ea") + .withRequestType(RequestType.SELF_ACTIVATE) + .withScheduleInfo( + new RoleAssignmentScheduleRequestPropertiesScheduleInfo() + .withStartDateTime(OffsetDateTime.parse("2020-09-09T21:35:27.91Z")) + .withExpiration( + new RoleAssignmentScheduleRequestPropertiesScheduleInfoExpiration() + .withType(Type.AFTER_DURATION) + .withDuration("PT8H"))) + .withLinkedRoleEligibilityScheduleId("b1477448-2cc6-4ceb-93b4-54a202a89413") + .withCondition( + "@Resource[Microsoft.Storage/storageAccounts/blobServices/containers:ContainerName]" + + " StringEqualsIgnoreCase 'foo_storage_container'") + .withConditionVersion("1.0"), + com.azure.core.util.Context.NONE); + } +} +``` + 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..5037627f1658a --- /dev/null +++ b/sdk/authorization/azure-resourcemanager-authorization-generated/pom.xml @@ -0,0 +1,61 @@ + + + 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-2023-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 + 0 + 0 + + + + com.azure + azure-core + 1.40.0 + + + com.azure + azure-core-management + 1.11.2 + + + 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..2f5c1e186e2a3 --- /dev/null +++ b/sdk/authorization/azure-resourcemanager-authorization-generated/src/main/java/com/azure/resourcemanager/authorization/generated/AuthorizationManager.java @@ -0,0 +1,286 @@ +// 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.HttpPipelinePosition; +import com.azure.core.http.policy.AddDatePolicy; +import com.azure.core.http.policy.AddHeadersFromContextPolicy; +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.RetryOptions; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.management.http.policy.ArmChallengeAuthenticationPolicy; +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.RoleAssignmentScheduleRequestsImpl; +import com.azure.resourcemanager.authorization.generated.models.RoleAssignmentScheduleRequests; +import java.time.Duration; +import java.time.temporal.ChronoUnit; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import java.util.stream.Collectors; + +/** + * 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 RoleAssignmentScheduleRequests roleAssignmentScheduleRequests; + + 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()) + .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); + } + + /** + * Creates an instance of Authorization service API entry point. + * + * @param httpPipeline the {@link HttpPipeline} configured with Azure authentication credential. + * @param profile the Azure profile for client. + * @return the Authorization service API instance. + */ + public static AuthorizationManager authenticate(HttpPipeline httpPipeline, AzureProfile profile) { + Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + return new AuthorizationManager(httpPipeline, profile, null); + } + + /** + * 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 static final ClientLogger LOGGER = new ClientLogger(Configurable.class); + + private HttpClient httpClient; + private HttpLogOptions httpLogOptions; + private final List policies = new ArrayList<>(); + private final List scopes = new ArrayList<>(); + private RetryPolicy retryPolicy; + private RetryOptions retryOptions; + 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; + } + + /** + * Adds the scope to permission sets. + * + * @param scope the scope. + * @return the configurable object itself. + */ + public Configurable withScope(String scope) { + this.scopes.add(Objects.requireNonNull(scope, "'scope' 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 retry options for the HTTP pipeline retry policy. + * + *

This setting has no effect, if retry policy is set via {@link #withRetryPolicy(RetryPolicy)}. + * + * @param retryOptions the retry options for the HTTP pipeline retry policy. + * @return the configurable object itself. + */ + public Configurable withRetryOptions(RetryOptions retryOptions) { + this.retryOptions = Objects.requireNonNull(retryOptions, "'retryOptions' 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, "'defaultPollInterval' cannot be null."); + if (this.defaultPollInterval.isNegative()) { + throw LOGGER + .logExceptionAsError(new IllegalArgumentException("'defaultPollInterval' 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 (scopes.isEmpty()) { + scopes.add(profile.getEnvironment().getManagementEndpoint() + "/.default"); + } + if (retryPolicy == null) { + if (retryOptions != null) { + retryPolicy = new RetryPolicy(retryOptions); + } else { + retryPolicy = new RetryPolicy("Retry-After", ChronoUnit.SECONDS); + } + } + List policies = new ArrayList<>(); + policies.add(new UserAgentPolicy(userAgentBuilder.toString())); + policies.add(new AddHeadersFromContextPolicy()); + policies.add(new RequestIdPolicy()); + policies + .addAll( + this + .policies + .stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) + .collect(Collectors.toList())); + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(retryPolicy); + policies.add(new AddDatePolicy()); + policies.add(new ArmChallengeAuthenticationPolicy(credential, scopes.toArray(new String[0]))); + policies + .addAll( + this + .policies + .stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) + .collect(Collectors.toList())); + 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); + } + } + + /** + * Gets the resource collection API of RoleAssignmentScheduleRequests. It manages RoleAssignmentScheduleRequest. + * + * @return Resource collection API of RoleAssignmentScheduleRequests. + */ + public RoleAssignmentScheduleRequests roleAssignmentScheduleRequests() { + if (this.roleAssignmentScheduleRequests == null) { + this.roleAssignmentScheduleRequests = + new RoleAssignmentScheduleRequestsImpl(clientObject.getRoleAssignmentScheduleRequests(), this); + } + return roleAssignmentScheduleRequests; + } + + /** + * @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..b53b0de6a0d9f --- /dev/null +++ b/sdk/authorization/azure-resourcemanager-authorization-generated/src/main/java/com/azure/resourcemanager/authorization/generated/fluent/AuthorizationManagementClient.java @@ -0,0 +1,46 @@ +// 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 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 RoleAssignmentScheduleRequestsClient object to access its operations. + * + * @return the RoleAssignmentScheduleRequestsClient object. + */ + RoleAssignmentScheduleRequestsClient getRoleAssignmentScheduleRequests(); +} diff --git a/sdk/authorization/azure-resourcemanager-authorization-generated/src/main/java/com/azure/resourcemanager/authorization/generated/fluent/RoleAssignmentScheduleRequestsClient.java b/sdk/authorization/azure-resourcemanager-authorization-generated/src/main/java/com/azure/resourcemanager/authorization/generated/fluent/RoleAssignmentScheduleRequestsClient.java new file mode 100644 index 0000000000000..e0f50b359d4d7 --- /dev/null +++ b/sdk/authorization/azure-resourcemanager-authorization-generated/src/main/java/com/azure/resourcemanager/authorization/generated/fluent/RoleAssignmentScheduleRequestsClient.java @@ -0,0 +1,182 @@ +// 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.RoleAssignmentScheduleRequestInner; + +/** An instance of this class provides access to all the operations defined in RoleAssignmentScheduleRequestsClient. */ +public interface RoleAssignmentScheduleRequestsClient { + /** + * Creates a role assignment schedule request. + * + * @param scope The scope of the role assignment schedule request to create. The scope can be any REST resource + * instance. For example, use '/providers/Microsoft.Subscription/subscriptions/{subscription-id}/' for a + * subscription, + * '/providers/Microsoft.Subscription/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}' for + * a resource group, and + * '/providers/Microsoft.Subscription/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/providers/{resource-provider}/{resource-type}/{resource-name}' + * for a resource. + * @param roleAssignmentScheduleRequestName A GUID for the role assignment to create. The name must be unique and + * different for each role assignment. + * @param parameters Parameters for the role assignment schedule request. + * @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 schedule request along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createWithResponse( + String scope, + String roleAssignmentScheduleRequestName, + RoleAssignmentScheduleRequestInner parameters, + Context context); + + /** + * Creates a role assignment schedule request. + * + * @param scope The scope of the role assignment schedule request to create. The scope can be any REST resource + * instance. For example, use '/providers/Microsoft.Subscription/subscriptions/{subscription-id}/' for a + * subscription, + * '/providers/Microsoft.Subscription/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}' for + * a resource group, and + * '/providers/Microsoft.Subscription/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/providers/{resource-provider}/{resource-type}/{resource-name}' + * for a resource. + * @param roleAssignmentScheduleRequestName A GUID for the role assignment to create. The name must be unique and + * different for each role assignment. + * @param parameters Parameters for the role assignment schedule request. + * @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 schedule request. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + RoleAssignmentScheduleRequestInner create( + String scope, String roleAssignmentScheduleRequestName, RoleAssignmentScheduleRequestInner parameters); + + /** + * Get the specified role assignment schedule request. + * + * @param scope The scope of the role assignment schedule request. + * @param roleAssignmentScheduleRequestName The name (guid) of the role assignment schedule request 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 schedule request along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String scope, String roleAssignmentScheduleRequestName, Context context); + + /** + * Get the specified role assignment schedule request. + * + * @param scope The scope of the role assignment schedule request. + * @param roleAssignmentScheduleRequestName The name (guid) of the role assignment schedule request 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 schedule request. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + RoleAssignmentScheduleRequestInner get(String scope, String roleAssignmentScheduleRequestName); + + /** + * Gets role assignment schedule requests for a scope. + * + * @param scope The scope of the role assignments schedule requests. + * @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 schedule requests for a scope as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listForScope(String scope); + + /** + * Gets role assignment schedule requests for a scope. + * + * @param scope The scope of the role assignments schedule requests. + * @param filter The filter to apply on the operation. Use $filter=atScope() to return all role assignment schedule + * requests at or above the scope. Use $filter=principalId eq {id} to return all role assignment schedule + * requests at, above or below the scope for the specified principal. Use $filter=asRequestor() to return all + * role assignment schedule requests requested by the current user. Use $filter=asTarget() to return all role + * assignment schedule requests created for the current user. Use $filter=asApprover() to return all role + * assignment schedule requests where the current user is an approver. + * @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 schedule requests for a scope as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listForScope(String scope, String filter, Context context); + + /** + * Cancels a pending role assignment schedule request. + * + * @param scope The scope of the role assignment request to cancel. + * @param roleAssignmentScheduleRequestName The name of the role assignment request to cancel. + * @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 {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response cancelWithResponse(String scope, String roleAssignmentScheduleRequestName, Context context); + + /** + * Cancels a pending role assignment schedule request. + * + * @param scope The scope of the role assignment request to cancel. + * @param roleAssignmentScheduleRequestName The name of the role assignment request to cancel. + * @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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void cancel(String scope, String roleAssignmentScheduleRequestName); + + /** + * Validates a new role assignment schedule request. + * + * @param scope The scope of the role assignment request to validate. + * @param roleAssignmentScheduleRequestName The name of the role assignment request to validate. + * @param parameters Parameters for the role assignment schedule request. + * @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 schedule request along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response validateWithResponse( + String scope, + String roleAssignmentScheduleRequestName, + RoleAssignmentScheduleRequestInner parameters, + Context context); + + /** + * Validates a new role assignment schedule request. + * + * @param scope The scope of the role assignment request to validate. + * @param roleAssignmentScheduleRequestName The name of the role assignment request to validate. + * @param parameters Parameters for the role assignment schedule request. + * @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 schedule request. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + RoleAssignmentScheduleRequestInner validate( + String scope, String roleAssignmentScheduleRequestName, RoleAssignmentScheduleRequestInner parameters); +} diff --git a/sdk/authorization/azure-resourcemanager-authorization-generated/src/main/java/com/azure/resourcemanager/authorization/generated/fluent/models/RoleAssignmentScheduleRequestInner.java b/sdk/authorization/azure-resourcemanager-authorization-generated/src/main/java/com/azure/resourcemanager/authorization/generated/fluent/models/RoleAssignmentScheduleRequestInner.java new file mode 100644 index 0000000000000..fbc7e9300dfab --- /dev/null +++ b/sdk/authorization/azure-resourcemanager-authorization-generated/src/main/java/com/azure/resourcemanager/authorization/generated/fluent/models/RoleAssignmentScheduleRequestInner.java @@ -0,0 +1,425 @@ +// 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.resourcemanager.authorization.generated.models.ExpandedProperties; +import com.azure.resourcemanager.authorization.generated.models.PrincipalType; +import com.azure.resourcemanager.authorization.generated.models.RequestType; +import com.azure.resourcemanager.authorization.generated.models.RoleAssignmentScheduleRequestPropertiesScheduleInfo; +import com.azure.resourcemanager.authorization.generated.models.RoleAssignmentScheduleRequestPropertiesTicketInfo; +import com.azure.resourcemanager.authorization.generated.models.Status; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** Role Assignment schedule request. */ +@Fluent +public final class RoleAssignmentScheduleRequestInner { + /* + * The role assignment schedule request ID. + */ + @JsonProperty(value = "id", access = JsonProperty.Access.WRITE_ONLY) + private String id; + + /* + * The role assignment schedule request name. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /* + * The role assignment schedule request type. + */ + @JsonProperty(value = "type", access = JsonProperty.Access.WRITE_ONLY) + private String type; + + /* + * Role assignment schedule request properties. + */ + @JsonProperty(value = "properties") + private RoleAssignmentScheduleRequestProperties innerProperties; + + /** Creates an instance of RoleAssignmentScheduleRequestInner class. */ + public RoleAssignmentScheduleRequestInner() { + } + + /** + * Get the id property: The role assignment schedule request ID. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Get the name property: The role assignment schedule request name. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Get the type property: The role assignment schedule request type. + * + * @return the type value. + */ + public String type() { + return this.type; + } + + /** + * Get the innerProperties property: Role assignment schedule request properties. + * + * @return the innerProperties value. + */ + private RoleAssignmentScheduleRequestProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the scope property: The role assignment schedule request scope. + * + * @return the scope value. + */ + public String scope() { + return this.innerProperties() == null ? null : this.innerProperties().scope(); + } + + /** + * Get the roleDefinitionId property: The role definition ID. + * + * @return the roleDefinitionId value. + */ + public String roleDefinitionId() { + return this.innerProperties() == null ? null : this.innerProperties().roleDefinitionId(); + } + + /** + * Set the roleDefinitionId property: The role definition ID. + * + * @param roleDefinitionId the roleDefinitionId value to set. + * @return the RoleAssignmentScheduleRequestInner object itself. + */ + public RoleAssignmentScheduleRequestInner withRoleDefinitionId(String roleDefinitionId) { + if (this.innerProperties() == null) { + this.innerProperties = new RoleAssignmentScheduleRequestProperties(); + } + this.innerProperties().withRoleDefinitionId(roleDefinitionId); + return this; + } + + /** + * Get the principalId property: The principal ID. + * + * @return the principalId value. + */ + public String principalId() { + return this.innerProperties() == null ? null : this.innerProperties().principalId(); + } + + /** + * Set the principalId property: The principal ID. + * + * @param principalId the principalId value to set. + * @return the RoleAssignmentScheduleRequestInner object itself. + */ + public RoleAssignmentScheduleRequestInner withPrincipalId(String principalId) { + if (this.innerProperties() == null) { + this.innerProperties = new RoleAssignmentScheduleRequestProperties(); + } + this.innerProperties().withPrincipalId(principalId); + return this; + } + + /** + * Get the principalType property: The principal type of the assigned principal ID. + * + * @return the principalType value. + */ + public PrincipalType principalType() { + return this.innerProperties() == null ? null : this.innerProperties().principalType(); + } + + /** + * Get the requestType property: The type of the role assignment schedule request. Eg: SelfActivate, AdminAssign + * etc. + * + * @return the requestType value. + */ + public RequestType requestType() { + return this.innerProperties() == null ? null : this.innerProperties().requestType(); + } + + /** + * Set the requestType property: The type of the role assignment schedule request. Eg: SelfActivate, AdminAssign + * etc. + * + * @param requestType the requestType value to set. + * @return the RoleAssignmentScheduleRequestInner object itself. + */ + public RoleAssignmentScheduleRequestInner withRequestType(RequestType requestType) { + if (this.innerProperties() == null) { + this.innerProperties = new RoleAssignmentScheduleRequestProperties(); + } + this.innerProperties().withRequestType(requestType); + return this; + } + + /** + * Get the status property: The status of the role assignment schedule request. + * + * @return the status value. + */ + public Status status() { + return this.innerProperties() == null ? null : this.innerProperties().status(); + } + + /** + * Get the approvalId property: The approvalId of the role assignment schedule request. + * + * @return the approvalId value. + */ + public String approvalId() { + return this.innerProperties() == null ? null : this.innerProperties().approvalId(); + } + + /** + * Get the targetRoleAssignmentScheduleId property: The resultant role assignment schedule id or the role assignment + * schedule id being updated. + * + * @return the targetRoleAssignmentScheduleId value. + */ + public String targetRoleAssignmentScheduleId() { + return this.innerProperties() == null ? null : this.innerProperties().targetRoleAssignmentScheduleId(); + } + + /** + * Set the targetRoleAssignmentScheduleId property: The resultant role assignment schedule id or the role assignment + * schedule id being updated. + * + * @param targetRoleAssignmentScheduleId the targetRoleAssignmentScheduleId value to set. + * @return the RoleAssignmentScheduleRequestInner object itself. + */ + public RoleAssignmentScheduleRequestInner withTargetRoleAssignmentScheduleId( + String targetRoleAssignmentScheduleId) { + if (this.innerProperties() == null) { + this.innerProperties = new RoleAssignmentScheduleRequestProperties(); + } + this.innerProperties().withTargetRoleAssignmentScheduleId(targetRoleAssignmentScheduleId); + return this; + } + + /** + * Get the targetRoleAssignmentScheduleInstanceId property: The role assignment schedule instance id being updated. + * + * @return the targetRoleAssignmentScheduleInstanceId value. + */ + public String targetRoleAssignmentScheduleInstanceId() { + return this.innerProperties() == null ? null : this.innerProperties().targetRoleAssignmentScheduleInstanceId(); + } + + /** + * Set the targetRoleAssignmentScheduleInstanceId property: The role assignment schedule instance id being updated. + * + * @param targetRoleAssignmentScheduleInstanceId the targetRoleAssignmentScheduleInstanceId value to set. + * @return the RoleAssignmentScheduleRequestInner object itself. + */ + public RoleAssignmentScheduleRequestInner withTargetRoleAssignmentScheduleInstanceId( + String targetRoleAssignmentScheduleInstanceId) { + if (this.innerProperties() == null) { + this.innerProperties = new RoleAssignmentScheduleRequestProperties(); + } + this.innerProperties().withTargetRoleAssignmentScheduleInstanceId(targetRoleAssignmentScheduleInstanceId); + return this; + } + + /** + * Get the scheduleInfo property: Schedule info of the role assignment schedule. + * + * @return the scheduleInfo value. + */ + public RoleAssignmentScheduleRequestPropertiesScheduleInfo scheduleInfo() { + return this.innerProperties() == null ? null : this.innerProperties().scheduleInfo(); + } + + /** + * Set the scheduleInfo property: Schedule info of the role assignment schedule. + * + * @param scheduleInfo the scheduleInfo value to set. + * @return the RoleAssignmentScheduleRequestInner object itself. + */ + public RoleAssignmentScheduleRequestInner withScheduleInfo( + RoleAssignmentScheduleRequestPropertiesScheduleInfo scheduleInfo) { + if (this.innerProperties() == null) { + this.innerProperties = new RoleAssignmentScheduleRequestProperties(); + } + this.innerProperties().withScheduleInfo(scheduleInfo); + return this; + } + + /** + * Get the linkedRoleEligibilityScheduleId property: The linked role eligibility schedule id - to activate an + * eligibility. + * + * @return the linkedRoleEligibilityScheduleId value. + */ + public String linkedRoleEligibilityScheduleId() { + return this.innerProperties() == null ? null : this.innerProperties().linkedRoleEligibilityScheduleId(); + } + + /** + * Set the linkedRoleEligibilityScheduleId property: The linked role eligibility schedule id - to activate an + * eligibility. + * + * @param linkedRoleEligibilityScheduleId the linkedRoleEligibilityScheduleId value to set. + * @return the RoleAssignmentScheduleRequestInner object itself. + */ + public RoleAssignmentScheduleRequestInner withLinkedRoleEligibilityScheduleId( + String linkedRoleEligibilityScheduleId) { + if (this.innerProperties() == null) { + this.innerProperties = new RoleAssignmentScheduleRequestProperties(); + } + this.innerProperties().withLinkedRoleEligibilityScheduleId(linkedRoleEligibilityScheduleId); + return this; + } + + /** + * Get the justification property: Justification for the role assignment. + * + * @return the justification value. + */ + public String justification() { + return this.innerProperties() == null ? null : this.innerProperties().justification(); + } + + /** + * Set the justification property: Justification for the role assignment. + * + * @param justification the justification value to set. + * @return the RoleAssignmentScheduleRequestInner object itself. + */ + public RoleAssignmentScheduleRequestInner withJustification(String justification) { + if (this.innerProperties() == null) { + this.innerProperties = new RoleAssignmentScheduleRequestProperties(); + } + this.innerProperties().withJustification(justification); + return this; + } + + /** + * Get the ticketInfo property: Ticket Info of the role assignment. + * + * @return the ticketInfo value. + */ + public RoleAssignmentScheduleRequestPropertiesTicketInfo ticketInfo() { + return this.innerProperties() == null ? null : this.innerProperties().ticketInfo(); + } + + /** + * Set the ticketInfo property: Ticket Info of the role assignment. + * + * @param ticketInfo the ticketInfo value to set. + * @return the RoleAssignmentScheduleRequestInner object itself. + */ + public RoleAssignmentScheduleRequestInner withTicketInfo( + RoleAssignmentScheduleRequestPropertiesTicketInfo ticketInfo) { + if (this.innerProperties() == null) { + this.innerProperties = new RoleAssignmentScheduleRequestProperties(); + } + this.innerProperties().withTicketInfo(ticketInfo); + 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.innerProperties() == null ? null : this.innerProperties().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 RoleAssignmentScheduleRequestInner object itself. + */ + public RoleAssignmentScheduleRequestInner withCondition(String condition) { + if (this.innerProperties() == null) { + this.innerProperties = new RoleAssignmentScheduleRequestProperties(); + } + this.innerProperties().withCondition(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.innerProperties() == null ? null : this.innerProperties().conditionVersion(); + } + + /** + * Set the conditionVersion property: Version of the condition. Currently accepted value is '2.0'. + * + * @param conditionVersion the conditionVersion value to set. + * @return the RoleAssignmentScheduleRequestInner object itself. + */ + public RoleAssignmentScheduleRequestInner withConditionVersion(String conditionVersion) { + if (this.innerProperties() == null) { + this.innerProperties = new RoleAssignmentScheduleRequestProperties(); + } + this.innerProperties().withConditionVersion(conditionVersion); + return this; + } + + /** + * Get the createdOn property: DateTime when role assignment schedule request was created. + * + * @return the createdOn value. + */ + public OffsetDateTime createdOn() { + return this.innerProperties() == null ? null : this.innerProperties().createdOn(); + } + + /** + * Get the requestorId property: Id of the user who created this request. + * + * @return the requestorId value. + */ + public String requestorId() { + return this.innerProperties() == null ? null : this.innerProperties().requestorId(); + } + + /** + * Get the expandedProperties property: Additional properties of principal, scope and role definition. + * + * @return the expandedProperties value. + */ + public ExpandedProperties expandedProperties() { + return this.innerProperties() == null ? null : this.innerProperties().expandedProperties(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/authorization/azure-resourcemanager-authorization-generated/src/main/java/com/azure/resourcemanager/authorization/generated/fluent/models/RoleAssignmentScheduleRequestProperties.java b/sdk/authorization/azure-resourcemanager-authorization-generated/src/main/java/com/azure/resourcemanager/authorization/generated/fluent/models/RoleAssignmentScheduleRequestProperties.java new file mode 100644 index 0000000000000..5f2102d7d2a8d --- /dev/null +++ b/sdk/authorization/azure-resourcemanager-authorization-generated/src/main/java/com/azure/resourcemanager/authorization/generated/fluent/models/RoleAssignmentScheduleRequestProperties.java @@ -0,0 +1,469 @@ +// 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.util.logging.ClientLogger; +import com.azure.resourcemanager.authorization.generated.models.ExpandedProperties; +import com.azure.resourcemanager.authorization.generated.models.PrincipalType; +import com.azure.resourcemanager.authorization.generated.models.RequestType; +import com.azure.resourcemanager.authorization.generated.models.RoleAssignmentScheduleRequestPropertiesScheduleInfo; +import com.azure.resourcemanager.authorization.generated.models.RoleAssignmentScheduleRequestPropertiesTicketInfo; +import com.azure.resourcemanager.authorization.generated.models.Status; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** Role assignment schedule request properties with scope. */ +@Fluent +public final class RoleAssignmentScheduleRequestProperties { + /* + * The role assignment schedule request scope. + */ + @JsonProperty(value = "scope", access = JsonProperty.Access.WRITE_ONLY) + private String scope; + + /* + * The role definition ID. + */ + @JsonProperty(value = "roleDefinitionId", required = true) + private String roleDefinitionId; + + /* + * The principal ID. + */ + @JsonProperty(value = "principalId", required = true) + private String principalId; + + /* + * The principal type of the assigned principal ID. + */ + @JsonProperty(value = "principalType", access = JsonProperty.Access.WRITE_ONLY) + private PrincipalType principalType; + + /* + * The type of the role assignment schedule request. Eg: SelfActivate, AdminAssign etc + */ + @JsonProperty(value = "requestType", required = true) + private RequestType requestType; + + /* + * The status of the role assignment schedule request. + */ + @JsonProperty(value = "status", access = JsonProperty.Access.WRITE_ONLY) + private Status status; + + /* + * The approvalId of the role assignment schedule request. + */ + @JsonProperty(value = "approvalId", access = JsonProperty.Access.WRITE_ONLY) + private String approvalId; + + /* + * The resultant role assignment schedule id or the role assignment schedule id being updated + */ + @JsonProperty(value = "targetRoleAssignmentScheduleId") + private String targetRoleAssignmentScheduleId; + + /* + * The role assignment schedule instance id being updated + */ + @JsonProperty(value = "targetRoleAssignmentScheduleInstanceId") + private String targetRoleAssignmentScheduleInstanceId; + + /* + * Schedule info of the role assignment schedule + */ + @JsonProperty(value = "scheduleInfo") + private RoleAssignmentScheduleRequestPropertiesScheduleInfo scheduleInfo; + + /* + * The linked role eligibility schedule id - to activate an eligibility. + */ + @JsonProperty(value = "linkedRoleEligibilityScheduleId") + private String linkedRoleEligibilityScheduleId; + + /* + * Justification for the role assignment + */ + @JsonProperty(value = "justification") + private String justification; + + /* + * Ticket Info of the role assignment + */ + @JsonProperty(value = "ticketInfo") + private RoleAssignmentScheduleRequestPropertiesTicketInfo ticketInfo; + + /* + * 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 = "condition") + private String condition; + + /* + * Version of the condition. Currently accepted value is '2.0' + */ + @JsonProperty(value = "conditionVersion") + private String conditionVersion; + + /* + * DateTime when role assignment schedule request was created + */ + @JsonProperty(value = "createdOn", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime createdOn; + + /* + * Id of the user who created this request + */ + @JsonProperty(value = "requestorId", access = JsonProperty.Access.WRITE_ONLY) + private String requestorId; + + /* + * Additional properties of principal, scope and role definition + */ + @JsonProperty(value = "expandedProperties", access = JsonProperty.Access.WRITE_ONLY) + private ExpandedProperties expandedProperties; + + /** Creates an instance of RoleAssignmentScheduleRequestProperties class. */ + public RoleAssignmentScheduleRequestProperties() { + } + + /** + * Get the scope property: The role assignment schedule request scope. + * + * @return the scope value. + */ + public String scope() { + return this.scope; + } + + /** + * 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 RoleAssignmentScheduleRequestProperties object itself. + */ + public RoleAssignmentScheduleRequestProperties 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 RoleAssignmentScheduleRequestProperties object itself. + */ + public RoleAssignmentScheduleRequestProperties 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; + } + + /** + * Get the requestType property: The type of the role assignment schedule request. Eg: SelfActivate, AdminAssign + * etc. + * + * @return the requestType value. + */ + public RequestType requestType() { + return this.requestType; + } + + /** + * Set the requestType property: The type of the role assignment schedule request. Eg: SelfActivate, AdminAssign + * etc. + * + * @param requestType the requestType value to set. + * @return the RoleAssignmentScheduleRequestProperties object itself. + */ + public RoleAssignmentScheduleRequestProperties withRequestType(RequestType requestType) { + this.requestType = requestType; + return this; + } + + /** + * Get the status property: The status of the role assignment schedule request. + * + * @return the status value. + */ + public Status status() { + return this.status; + } + + /** + * Get the approvalId property: The approvalId of the role assignment schedule request. + * + * @return the approvalId value. + */ + public String approvalId() { + return this.approvalId; + } + + /** + * Get the targetRoleAssignmentScheduleId property: The resultant role assignment schedule id or the role assignment + * schedule id being updated. + * + * @return the targetRoleAssignmentScheduleId value. + */ + public String targetRoleAssignmentScheduleId() { + return this.targetRoleAssignmentScheduleId; + } + + /** + * Set the targetRoleAssignmentScheduleId property: The resultant role assignment schedule id or the role assignment + * schedule id being updated. + * + * @param targetRoleAssignmentScheduleId the targetRoleAssignmentScheduleId value to set. + * @return the RoleAssignmentScheduleRequestProperties object itself. + */ + public RoleAssignmentScheduleRequestProperties withTargetRoleAssignmentScheduleId( + String targetRoleAssignmentScheduleId) { + this.targetRoleAssignmentScheduleId = targetRoleAssignmentScheduleId; + return this; + } + + /** + * Get the targetRoleAssignmentScheduleInstanceId property: The role assignment schedule instance id being updated. + * + * @return the targetRoleAssignmentScheduleInstanceId value. + */ + public String targetRoleAssignmentScheduleInstanceId() { + return this.targetRoleAssignmentScheduleInstanceId; + } + + /** + * Set the targetRoleAssignmentScheduleInstanceId property: The role assignment schedule instance id being updated. + * + * @param targetRoleAssignmentScheduleInstanceId the targetRoleAssignmentScheduleInstanceId value to set. + * @return the RoleAssignmentScheduleRequestProperties object itself. + */ + public RoleAssignmentScheduleRequestProperties withTargetRoleAssignmentScheduleInstanceId( + String targetRoleAssignmentScheduleInstanceId) { + this.targetRoleAssignmentScheduleInstanceId = targetRoleAssignmentScheduleInstanceId; + return this; + } + + /** + * Get the scheduleInfo property: Schedule info of the role assignment schedule. + * + * @return the scheduleInfo value. + */ + public RoleAssignmentScheduleRequestPropertiesScheduleInfo scheduleInfo() { + return this.scheduleInfo; + } + + /** + * Set the scheduleInfo property: Schedule info of the role assignment schedule. + * + * @param scheduleInfo the scheduleInfo value to set. + * @return the RoleAssignmentScheduleRequestProperties object itself. + */ + public RoleAssignmentScheduleRequestProperties withScheduleInfo( + RoleAssignmentScheduleRequestPropertiesScheduleInfo scheduleInfo) { + this.scheduleInfo = scheduleInfo; + return this; + } + + /** + * Get the linkedRoleEligibilityScheduleId property: The linked role eligibility schedule id - to activate an + * eligibility. + * + * @return the linkedRoleEligibilityScheduleId value. + */ + public String linkedRoleEligibilityScheduleId() { + return this.linkedRoleEligibilityScheduleId; + } + + /** + * Set the linkedRoleEligibilityScheduleId property: The linked role eligibility schedule id - to activate an + * eligibility. + * + * @param linkedRoleEligibilityScheduleId the linkedRoleEligibilityScheduleId value to set. + * @return the RoleAssignmentScheduleRequestProperties object itself. + */ + public RoleAssignmentScheduleRequestProperties withLinkedRoleEligibilityScheduleId( + String linkedRoleEligibilityScheduleId) { + this.linkedRoleEligibilityScheduleId = linkedRoleEligibilityScheduleId; + return this; + } + + /** + * Get the justification property: Justification for the role assignment. + * + * @return the justification value. + */ + public String justification() { + return this.justification; + } + + /** + * Set the justification property: Justification for the role assignment. + * + * @param justification the justification value to set. + * @return the RoleAssignmentScheduleRequestProperties object itself. + */ + public RoleAssignmentScheduleRequestProperties withJustification(String justification) { + this.justification = justification; + return this; + } + + /** + * Get the ticketInfo property: Ticket Info of the role assignment. + * + * @return the ticketInfo value. + */ + public RoleAssignmentScheduleRequestPropertiesTicketInfo ticketInfo() { + return this.ticketInfo; + } + + /** + * Set the ticketInfo property: Ticket Info of the role assignment. + * + * @param ticketInfo the ticketInfo value to set. + * @return the RoleAssignmentScheduleRequestProperties object itself. + */ + public RoleAssignmentScheduleRequestProperties withTicketInfo( + RoleAssignmentScheduleRequestPropertiesTicketInfo ticketInfo) { + this.ticketInfo = ticketInfo; + 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 RoleAssignmentScheduleRequestProperties object itself. + */ + public RoleAssignmentScheduleRequestProperties 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 RoleAssignmentScheduleRequestProperties object itself. + */ + public RoleAssignmentScheduleRequestProperties withConditionVersion(String conditionVersion) { + this.conditionVersion = conditionVersion; + return this; + } + + /** + * Get the createdOn property: DateTime when role assignment schedule request was created. + * + * @return the createdOn value. + */ + public OffsetDateTime createdOn() { + return this.createdOn; + } + + /** + * Get the requestorId property: Id of the user who created this request. + * + * @return the requestorId value. + */ + public String requestorId() { + return this.requestorId; + } + + /** + * Get the expandedProperties property: Additional properties of principal, scope and role definition. + * + * @return the expandedProperties value. + */ + public ExpandedProperties expandedProperties() { + return this.expandedProperties; + } + + /** + * 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 RoleAssignmentScheduleRequestProperties")); + } + if (principalId() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property principalId in model RoleAssignmentScheduleRequestProperties")); + } + if (requestType() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property requestType in model RoleAssignmentScheduleRequestProperties")); + } + if (scheduleInfo() != null) { + scheduleInfo().validate(); + } + if (ticketInfo() != null) { + ticketInfo().validate(); + } + if (expandedProperties() != null) { + expandedProperties().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(RoleAssignmentScheduleRequestProperties.class); +} 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..703cec373f453 --- /dev/null +++ b/sdk/authorization/azure-resourcemanager-authorization-generated/src/main/java/com/azure/resourcemanager/authorization/generated/implementation/AuthorizationManagementClientBuilder.java @@ -0,0 +1,123 @@ +// 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.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 { + /* + * 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 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 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 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() { + String localEndpoint = (endpoint != null) ? endpoint : "https://management.azure.com"; + AzureEnvironment localEnvironment = (environment != null) ? environment : AzureEnvironment.AZURE; + HttpPipeline localPipeline = + (pipeline != null) + ? pipeline + : new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(); + Duration localDefaultPollInterval = + (defaultPollInterval != null) ? defaultPollInterval : Duration.ofSeconds(30); + SerializerAdapter localSerializerAdapter = + (serializerAdapter != null) + ? serializerAdapter + : SerializerFactory.createDefaultManagementSerializerAdapter(); + AuthorizationManagementClientImpl client = + new AuthorizationManagementClientImpl( + localPipeline, localSerializerAdapter, localDefaultPollInterval, localEnvironment, localEndpoint); + 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..93ca9a6bc5ddd --- /dev/null +++ b/sdk/authorization/azure-resourcemanager-authorization-generated/src/main/java/com/azure/resourcemanager/authorization/generated/implementation/AuthorizationManagementClientImpl.java @@ -0,0 +1,275 @@ +// 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.CoreUtils; +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.RoleAssignmentScheduleRequestsClient; +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 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 { + /** 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 RoleAssignmentScheduleRequestsClient object to access its operations. */ + private final RoleAssignmentScheduleRequestsClient roleAssignmentScheduleRequests; + + /** + * Gets the RoleAssignmentScheduleRequestsClient object to access its operations. + * + * @return the RoleAssignmentScheduleRequestsClient object. + */ + public RoleAssignmentScheduleRequestsClient getRoleAssignmentScheduleRequests() { + return this.roleAssignmentScheduleRequests; + } + + /** + * 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 endpoint server parameter. + */ + AuthorizationManagementClientImpl( + HttpPipeline httpPipeline, + SerializerAdapter serializerAdapter, + Duration defaultPollInterval, + AzureEnvironment environment, + String endpoint) { + this.httpPipeline = httpPipeline; + this.serializerAdapter = serializerAdapter; + this.defaultPollInterval = defaultPollInterval; + this.endpoint = endpoint; + this.apiVersion = "2023-04-01-preview"; + this.roleAssignmentScheduleRequests = new RoleAssignmentScheduleRequestsClientImpl(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) { + return CoreUtils.mergeContexts(this.getContext(), 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)); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(AuthorizationManagementClientImpl.class); +} diff --git a/sdk/authorization/azure-resourcemanager-authorization-generated/src/main/java/com/azure/resourcemanager/authorization/generated/implementation/RoleAssignmentScheduleRequestImpl.java b/sdk/authorization/azure-resourcemanager-authorization-generated/src/main/java/com/azure/resourcemanager/authorization/generated/implementation/RoleAssignmentScheduleRequestImpl.java new file mode 100644 index 0000000000000..90011e9044123 --- /dev/null +++ b/sdk/authorization/azure-resourcemanager-authorization-generated/src/main/java/com/azure/resourcemanager/authorization/generated/implementation/RoleAssignmentScheduleRequestImpl.java @@ -0,0 +1,261 @@ +// 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.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.authorization.generated.fluent.models.RoleAssignmentScheduleRequestInner; +import com.azure.resourcemanager.authorization.generated.models.ExpandedProperties; +import com.azure.resourcemanager.authorization.generated.models.PrincipalType; +import com.azure.resourcemanager.authorization.generated.models.RequestType; +import com.azure.resourcemanager.authorization.generated.models.RoleAssignmentScheduleRequest; +import com.azure.resourcemanager.authorization.generated.models.RoleAssignmentScheduleRequestPropertiesScheduleInfo; +import com.azure.resourcemanager.authorization.generated.models.RoleAssignmentScheduleRequestPropertiesTicketInfo; +import com.azure.resourcemanager.authorization.generated.models.Status; +import java.time.OffsetDateTime; + +public final class RoleAssignmentScheduleRequestImpl + implements RoleAssignmentScheduleRequest, RoleAssignmentScheduleRequest.Definition { + private RoleAssignmentScheduleRequestInner innerObject; + + private final com.azure.resourcemanager.authorization.generated.AuthorizationManager serviceManager; + + RoleAssignmentScheduleRequestImpl( + RoleAssignmentScheduleRequestInner 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 RequestType requestType() { + return this.innerModel().requestType(); + } + + public Status status() { + return this.innerModel().status(); + } + + public String approvalId() { + return this.innerModel().approvalId(); + } + + public String targetRoleAssignmentScheduleId() { + return this.innerModel().targetRoleAssignmentScheduleId(); + } + + public String targetRoleAssignmentScheduleInstanceId() { + return this.innerModel().targetRoleAssignmentScheduleInstanceId(); + } + + public RoleAssignmentScheduleRequestPropertiesScheduleInfo scheduleInfo() { + return this.innerModel().scheduleInfo(); + } + + public String linkedRoleEligibilityScheduleId() { + return this.innerModel().linkedRoleEligibilityScheduleId(); + } + + public String justification() { + return this.innerModel().justification(); + } + + public RoleAssignmentScheduleRequestPropertiesTicketInfo ticketInfo() { + return this.innerModel().ticketInfo(); + } + + public String condition() { + return this.innerModel().condition(); + } + + public String conditionVersion() { + return this.innerModel().conditionVersion(); + } + + public OffsetDateTime createdOn() { + return this.innerModel().createdOn(); + } + + public String requestorId() { + return this.innerModel().requestorId(); + } + + public ExpandedProperties expandedProperties() { + return this.innerModel().expandedProperties(); + } + + public RoleAssignmentScheduleRequestInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.authorization.generated.AuthorizationManager manager() { + return this.serviceManager; + } + + private String scope; + + private String roleAssignmentScheduleRequestName; + + public RoleAssignmentScheduleRequestImpl withExistingScope(String scope) { + this.scope = scope; + return this; + } + + public RoleAssignmentScheduleRequest create() { + this.innerObject = + serviceManager + .serviceClient() + .getRoleAssignmentScheduleRequests() + .createWithResponse(scope, roleAssignmentScheduleRequestName, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public RoleAssignmentScheduleRequest create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getRoleAssignmentScheduleRequests() + .createWithResponse(scope, roleAssignmentScheduleRequestName, this.innerModel(), context) + .getValue(); + return this; + } + + RoleAssignmentScheduleRequestImpl( + String name, com.azure.resourcemanager.authorization.generated.AuthorizationManager serviceManager) { + this.innerObject = new RoleAssignmentScheduleRequestInner(); + this.serviceManager = serviceManager; + this.roleAssignmentScheduleRequestName = name; + } + + public RoleAssignmentScheduleRequest refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getRoleAssignmentScheduleRequests() + .getWithResponse(scope, roleAssignmentScheduleRequestName, Context.NONE) + .getValue(); + return this; + } + + public RoleAssignmentScheduleRequest refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getRoleAssignmentScheduleRequests() + .getWithResponse(scope, roleAssignmentScheduleRequestName, context) + .getValue(); + return this; + } + + public Response cancelWithResponse(Context context) { + return serviceManager + .roleAssignmentScheduleRequests() + .cancelWithResponse(scope, roleAssignmentScheduleRequestName, context); + } + + public void cancel() { + serviceManager.roleAssignmentScheduleRequests().cancel(scope, roleAssignmentScheduleRequestName); + } + + public Response validateWithResponse( + RoleAssignmentScheduleRequestInner parameters, Context context) { + return serviceManager + .roleAssignmentScheduleRequests() + .validateWithResponse(scope, roleAssignmentScheduleRequestName, parameters, context); + } + + public RoleAssignmentScheduleRequest validate(RoleAssignmentScheduleRequestInner parameters) { + return serviceManager + .roleAssignmentScheduleRequests() + .validate(scope, roleAssignmentScheduleRequestName, parameters); + } + + public RoleAssignmentScheduleRequestImpl withRoleDefinitionId(String roleDefinitionId) { + this.innerModel().withRoleDefinitionId(roleDefinitionId); + return this; + } + + public RoleAssignmentScheduleRequestImpl withPrincipalId(String principalId) { + this.innerModel().withPrincipalId(principalId); + return this; + } + + public RoleAssignmentScheduleRequestImpl withRequestType(RequestType requestType) { + this.innerModel().withRequestType(requestType); + return this; + } + + public RoleAssignmentScheduleRequestImpl withTargetRoleAssignmentScheduleId(String targetRoleAssignmentScheduleId) { + this.innerModel().withTargetRoleAssignmentScheduleId(targetRoleAssignmentScheduleId); + return this; + } + + public RoleAssignmentScheduleRequestImpl withTargetRoleAssignmentScheduleInstanceId( + String targetRoleAssignmentScheduleInstanceId) { + this.innerModel().withTargetRoleAssignmentScheduleInstanceId(targetRoleAssignmentScheduleInstanceId); + return this; + } + + public RoleAssignmentScheduleRequestImpl withScheduleInfo( + RoleAssignmentScheduleRequestPropertiesScheduleInfo scheduleInfo) { + this.innerModel().withScheduleInfo(scheduleInfo); + return this; + } + + public RoleAssignmentScheduleRequestImpl withLinkedRoleEligibilityScheduleId( + String linkedRoleEligibilityScheduleId) { + this.innerModel().withLinkedRoleEligibilityScheduleId(linkedRoleEligibilityScheduleId); + return this; + } + + public RoleAssignmentScheduleRequestImpl withJustification(String justification) { + this.innerModel().withJustification(justification); + return this; + } + + public RoleAssignmentScheduleRequestImpl withTicketInfo( + RoleAssignmentScheduleRequestPropertiesTicketInfo ticketInfo) { + this.innerModel().withTicketInfo(ticketInfo); + return this; + } + + public RoleAssignmentScheduleRequestImpl withCondition(String condition) { + this.innerModel().withCondition(condition); + return this; + } + + public RoleAssignmentScheduleRequestImpl withConditionVersion(String conditionVersion) { + this.innerModel().withConditionVersion(conditionVersion); + return this; + } +} diff --git a/sdk/authorization/azure-resourcemanager-authorization-generated/src/main/java/com/azure/resourcemanager/authorization/generated/implementation/RoleAssignmentScheduleRequestsClientImpl.java b/sdk/authorization/azure-resourcemanager-authorization-generated/src/main/java/com/azure/resourcemanager/authorization/generated/implementation/RoleAssignmentScheduleRequestsClientImpl.java new file mode 100644 index 0000000000000..655ca43ded301 --- /dev/null +++ b/sdk/authorization/azure-resourcemanager-authorization-generated/src/main/java/com/azure/resourcemanager/authorization/generated/implementation/RoleAssignmentScheduleRequestsClientImpl.java @@ -0,0 +1,1018 @@ +// 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.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.Post; +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.resourcemanager.authorization.generated.fluent.RoleAssignmentScheduleRequestsClient; +import com.azure.resourcemanager.authorization.generated.fluent.models.RoleAssignmentScheduleRequestInner; +import com.azure.resourcemanager.authorization.generated.models.RoleAssignmentScheduleRequestListResult; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in RoleAssignmentScheduleRequestsClient. */ +public final class RoleAssignmentScheduleRequestsClientImpl implements RoleAssignmentScheduleRequestsClient { + /** The proxy service used to perform REST calls. */ + private final RoleAssignmentScheduleRequestsService service; + + /** The service client containing this operation class. */ + private final AuthorizationManagementClientImpl client; + + /** + * Initializes an instance of RoleAssignmentScheduleRequestsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + RoleAssignmentScheduleRequestsClientImpl(AuthorizationManagementClientImpl client) { + this.service = + RestProxy + .create( + RoleAssignmentScheduleRequestsService.class, + client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for AuthorizationManagementClientRoleAssignmentScheduleRequests to be + * used by the proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "AuthorizationManagem") + public interface RoleAssignmentScheduleRequestsService { + @Headers({"Content-Type: application/json"}) + @Put( + "/{scope}/providers/Microsoft.Authorization/roleAssignmentScheduleRequests/{roleAssignmentScheduleRequestName}") + @ExpectedResponses({201}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> create( + @HostParam("$host") String endpoint, + @PathParam(value = "scope", encoded = true) String scope, + @PathParam("roleAssignmentScheduleRequestName") String roleAssignmentScheduleRequestName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") RoleAssignmentScheduleRequestInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/{scope}/providers/Microsoft.Authorization/roleAssignmentScheduleRequests/{roleAssignmentScheduleRequestName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam(value = "scope", encoded = true) String scope, + @PathParam("roleAssignmentScheduleRequestName") String roleAssignmentScheduleRequestName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("/{scope}/providers/Microsoft.Authorization/roleAssignmentScheduleRequests") + @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"}) + @Post( + "/{scope}/providers/Microsoft.Authorization/roleAssignmentScheduleRequests/{roleAssignmentScheduleRequestName}/cancel") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> cancel( + @HostParam("$host") String endpoint, + @PathParam(value = "scope", encoded = true) String scope, + @PathParam("roleAssignmentScheduleRequestName") String roleAssignmentScheduleRequestName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/{scope}/providers/Microsoft.Authorization/roleAssignmentScheduleRequests/{roleAssignmentScheduleRequestName}/validate") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> validate( + @HostParam("$host") String endpoint, + @PathParam(value = "scope", encoded = true) String scope, + @PathParam("roleAssignmentScheduleRequestName") String roleAssignmentScheduleRequestName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") RoleAssignmentScheduleRequestInner parameters, + @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); + } + + /** + * Creates a role assignment schedule request. + * + * @param scope The scope of the role assignment schedule request to create. The scope can be any REST resource + * instance. For example, use '/providers/Microsoft.Subscription/subscriptions/{subscription-id}/' for a + * subscription, + * '/providers/Microsoft.Subscription/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}' for + * a resource group, and + * '/providers/Microsoft.Subscription/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/providers/{resource-provider}/{resource-type}/{resource-name}' + * for a resource. + * @param roleAssignmentScheduleRequestName A GUID for the role assignment to create. The name must be unique and + * different for each role assignment. + * @param parameters Parameters for the role assignment schedule request. + * @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 schedule request along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createWithResponseAsync( + String scope, String roleAssignmentScheduleRequestName, RoleAssignmentScheduleRequestInner 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 (roleAssignmentScheduleRequestName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter roleAssignmentScheduleRequestName 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, + roleAssignmentScheduleRequestName, + this.client.getApiVersion(), + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates a role assignment schedule request. + * + * @param scope The scope of the role assignment schedule request to create. The scope can be any REST resource + * instance. For example, use '/providers/Microsoft.Subscription/subscriptions/{subscription-id}/' for a + * subscription, + * '/providers/Microsoft.Subscription/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}' for + * a resource group, and + * '/providers/Microsoft.Subscription/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/providers/{resource-provider}/{resource-type}/{resource-name}' + * for a resource. + * @param roleAssignmentScheduleRequestName A GUID for the role assignment to create. The name must be unique and + * different for each role assignment. + * @param parameters Parameters for the role assignment schedule request. + * @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 schedule request along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createWithResponseAsync( + String scope, + String roleAssignmentScheduleRequestName, + RoleAssignmentScheduleRequestInner 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 (roleAssignmentScheduleRequestName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter roleAssignmentScheduleRequestName 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, + roleAssignmentScheduleRequestName, + this.client.getApiVersion(), + parameters, + accept, + context); + } + + /** + * Creates a role assignment schedule request. + * + * @param scope The scope of the role assignment schedule request to create. The scope can be any REST resource + * instance. For example, use '/providers/Microsoft.Subscription/subscriptions/{subscription-id}/' for a + * subscription, + * '/providers/Microsoft.Subscription/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}' for + * a resource group, and + * '/providers/Microsoft.Subscription/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/providers/{resource-provider}/{resource-type}/{resource-name}' + * for a resource. + * @param roleAssignmentScheduleRequestName A GUID for the role assignment to create. The name must be unique and + * different for each role assignment. + * @param parameters Parameters for the role assignment schedule request. + * @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 schedule request on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createAsync( + String scope, String roleAssignmentScheduleRequestName, RoleAssignmentScheduleRequestInner parameters) { + return createWithResponseAsync(scope, roleAssignmentScheduleRequestName, parameters) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Creates a role assignment schedule request. + * + * @param scope The scope of the role assignment schedule request to create. The scope can be any REST resource + * instance. For example, use '/providers/Microsoft.Subscription/subscriptions/{subscription-id}/' for a + * subscription, + * '/providers/Microsoft.Subscription/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}' for + * a resource group, and + * '/providers/Microsoft.Subscription/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/providers/{resource-provider}/{resource-type}/{resource-name}' + * for a resource. + * @param roleAssignmentScheduleRequestName A GUID for the role assignment to create. The name must be unique and + * different for each role assignment. + * @param parameters Parameters for the role assignment schedule request. + * @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 schedule request along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createWithResponse( + String scope, + String roleAssignmentScheduleRequestName, + RoleAssignmentScheduleRequestInner parameters, + Context context) { + return createWithResponseAsync(scope, roleAssignmentScheduleRequestName, parameters, context).block(); + } + + /** + * Creates a role assignment schedule request. + * + * @param scope The scope of the role assignment schedule request to create. The scope can be any REST resource + * instance. For example, use '/providers/Microsoft.Subscription/subscriptions/{subscription-id}/' for a + * subscription, + * '/providers/Microsoft.Subscription/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}' for + * a resource group, and + * '/providers/Microsoft.Subscription/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/providers/{resource-provider}/{resource-type}/{resource-name}' + * for a resource. + * @param roleAssignmentScheduleRequestName A GUID for the role assignment to create. The name must be unique and + * different for each role assignment. + * @param parameters Parameters for the role assignment schedule request. + * @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 schedule request. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public RoleAssignmentScheduleRequestInner create( + String scope, String roleAssignmentScheduleRequestName, RoleAssignmentScheduleRequestInner parameters) { + return createWithResponse(scope, roleAssignmentScheduleRequestName, parameters, Context.NONE).getValue(); + } + + /** + * Get the specified role assignment schedule request. + * + * @param scope The scope of the role assignment schedule request. + * @param roleAssignmentScheduleRequestName The name (guid) of the role assignment schedule request 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 schedule request along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String scope, String roleAssignmentScheduleRequestName) { + 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 (roleAssignmentScheduleRequestName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter roleAssignmentScheduleRequestName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + scope, + roleAssignmentScheduleRequestName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the specified role assignment schedule request. + * + * @param scope The scope of the role assignment schedule request. + * @param roleAssignmentScheduleRequestName The name (guid) of the role assignment schedule request 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 schedule request along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String scope, String roleAssignmentScheduleRequestName, 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 (roleAssignmentScheduleRequestName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter roleAssignmentScheduleRequestName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + scope, + roleAssignmentScheduleRequestName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Get the specified role assignment schedule request. + * + * @param scope The scope of the role assignment schedule request. + * @param roleAssignmentScheduleRequestName The name (guid) of the role assignment schedule request 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 schedule request on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String scope, String roleAssignmentScheduleRequestName) { + return getWithResponseAsync(scope, roleAssignmentScheduleRequestName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Get the specified role assignment schedule request. + * + * @param scope The scope of the role assignment schedule request. + * @param roleAssignmentScheduleRequestName The name (guid) of the role assignment schedule request 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 schedule request along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String scope, String roleAssignmentScheduleRequestName, Context context) { + return getWithResponseAsync(scope, roleAssignmentScheduleRequestName, context).block(); + } + + /** + * Get the specified role assignment schedule request. + * + * @param scope The scope of the role assignment schedule request. + * @param roleAssignmentScheduleRequestName The name (guid) of the role assignment schedule request 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 schedule request. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public RoleAssignmentScheduleRequestInner get(String scope, String roleAssignmentScheduleRequestName) { + return getWithResponse(scope, roleAssignmentScheduleRequestName, Context.NONE).getValue(); + } + + /** + * Gets role assignment schedule requests for a scope. + * + * @param scope The scope of the role assignments schedule requests. + * @param filter The filter to apply on the operation. Use $filter=atScope() to return all role assignment schedule + * requests at or above the scope. Use $filter=principalId eq {id} to return all role assignment schedule + * requests at, above or below the scope for the specified principal. Use $filter=asRequestor() to return all + * role assignment schedule requests requested by the current user. Use $filter=asTarget() to return all role + * assignment schedule requests created for the current user. Use $filter=asApprover() to return all role + * assignment schedule requests where the current user is an approver. + * @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 schedule requests for a scope along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @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 assignment schedule requests for a scope. + * + * @param scope The scope of the role assignments schedule requests. + * @param filter The filter to apply on the operation. Use $filter=atScope() to return all role assignment schedule + * requests at or above the scope. Use $filter=principalId eq {id} to return all role assignment schedule + * requests at, above or below the scope for the specified principal. Use $filter=asRequestor() to return all + * role assignment schedule requests requested by the current user. Use $filter=asTarget() to return all role + * assignment schedule requests created for the current user. Use $filter=asApprover() to return all role + * assignment schedule requests where the current user is an approver. + * @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 schedule requests for a scope along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @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 assignment schedule requests for a scope. + * + * @param scope The scope of the role assignments schedule requests. + * @param filter The filter to apply on the operation. Use $filter=atScope() to return all role assignment schedule + * requests at or above the scope. Use $filter=principalId eq {id} to return all role assignment schedule + * requests at, above or below the scope for the specified principal. Use $filter=asRequestor() to return all + * role assignment schedule requests requested by the current user. Use $filter=asTarget() to return all role + * assignment schedule requests created for the current user. Use $filter=asApprover() to return all role + * assignment schedule requests where the current user is an approver. + * @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 schedule requests for a scope as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listForScopeAsync(String scope, String filter) { + return new PagedFlux<>( + () -> listForScopeSinglePageAsync(scope, filter), nextLink -> listForScopeNextSinglePageAsync(nextLink)); + } + + /** + * Gets role assignment schedule requests for a scope. + * + * @param scope The scope of the role assignments schedule requests. + * @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 schedule requests for a scope as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listForScopeAsync(String scope) { + final String filter = null; + return new PagedFlux<>( + () -> listForScopeSinglePageAsync(scope, filter), nextLink -> listForScopeNextSinglePageAsync(nextLink)); + } + + /** + * Gets role assignment schedule requests for a scope. + * + * @param scope The scope of the role assignments schedule requests. + * @param filter The filter to apply on the operation. Use $filter=atScope() to return all role assignment schedule + * requests at or above the scope. Use $filter=principalId eq {id} to return all role assignment schedule + * requests at, above or below the scope for the specified principal. Use $filter=asRequestor() to return all + * role assignment schedule requests requested by the current user. Use $filter=asTarget() to return all role + * assignment schedule requests created for the current user. Use $filter=asApprover() to return all role + * assignment schedule requests where the current user is an approver. + * @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 schedule requests for a scope as paginated response with {@link PagedFlux}. + */ + @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 assignment schedule requests for a scope. + * + * @param scope The scope of the role assignments schedule requests. + * @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 schedule requests for a scope as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listForScope(String scope) { + final String filter = null; + return new PagedIterable<>(listForScopeAsync(scope, filter)); + } + + /** + * Gets role assignment schedule requests for a scope. + * + * @param scope The scope of the role assignments schedule requests. + * @param filter The filter to apply on the operation. Use $filter=atScope() to return all role assignment schedule + * requests at or above the scope. Use $filter=principalId eq {id} to return all role assignment schedule + * requests at, above or below the scope for the specified principal. Use $filter=asRequestor() to return all + * role assignment schedule requests requested by the current user. Use $filter=asTarget() to return all role + * assignment schedule requests created for the current user. Use $filter=asApprover() to return all role + * assignment schedule requests where the current user is an approver. + * @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 schedule requests for a scope as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listForScope( + String scope, String filter, Context context) { + return new PagedIterable<>(listForScopeAsync(scope, filter, context)); + } + + /** + * Cancels a pending role assignment schedule request. + * + * @param scope The scope of the role assignment request to cancel. + * @param roleAssignmentScheduleRequestName The name of the role assignment request to cancel. + * @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 {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> cancelWithResponseAsync(String scope, String roleAssignmentScheduleRequestName) { + 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 (roleAssignmentScheduleRequestName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter roleAssignmentScheduleRequestName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .cancel( + this.client.getEndpoint(), + scope, + roleAssignmentScheduleRequestName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Cancels a pending role assignment schedule request. + * + * @param scope The scope of the role assignment request to cancel. + * @param roleAssignmentScheduleRequestName The name of the role assignment request to cancel. + * @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 {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> cancelWithResponseAsync( + String scope, String roleAssignmentScheduleRequestName, 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 (roleAssignmentScheduleRequestName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter roleAssignmentScheduleRequestName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .cancel( + this.client.getEndpoint(), + scope, + roleAssignmentScheduleRequestName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Cancels a pending role assignment schedule request. + * + * @param scope The scope of the role assignment request to cancel. + * @param roleAssignmentScheduleRequestName The name of the role assignment request to cancel. + * @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 {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono cancelAsync(String scope, String roleAssignmentScheduleRequestName) { + return cancelWithResponseAsync(scope, roleAssignmentScheduleRequestName).flatMap(ignored -> Mono.empty()); + } + + /** + * Cancels a pending role assignment schedule request. + * + * @param scope The scope of the role assignment request to cancel. + * @param roleAssignmentScheduleRequestName The name of the role assignment request to cancel. + * @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 {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response cancelWithResponse(String scope, String roleAssignmentScheduleRequestName, Context context) { + return cancelWithResponseAsync(scope, roleAssignmentScheduleRequestName, context).block(); + } + + /** + * Cancels a pending role assignment schedule request. + * + * @param scope The scope of the role assignment request to cancel. + * @param roleAssignmentScheduleRequestName The name of the role assignment request to cancel. + * @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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void cancel(String scope, String roleAssignmentScheduleRequestName) { + cancelWithResponse(scope, roleAssignmentScheduleRequestName, Context.NONE); + } + + /** + * Validates a new role assignment schedule request. + * + * @param scope The scope of the role assignment request to validate. + * @param roleAssignmentScheduleRequestName The name of the role assignment request to validate. + * @param parameters Parameters for the role assignment schedule request. + * @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 schedule request along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> validateWithResponseAsync( + String scope, String roleAssignmentScheduleRequestName, RoleAssignmentScheduleRequestInner 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 (roleAssignmentScheduleRequestName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter roleAssignmentScheduleRequestName 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 + .validate( + this.client.getEndpoint(), + scope, + roleAssignmentScheduleRequestName, + this.client.getApiVersion(), + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Validates a new role assignment schedule request. + * + * @param scope The scope of the role assignment request to validate. + * @param roleAssignmentScheduleRequestName The name of the role assignment request to validate. + * @param parameters Parameters for the role assignment schedule request. + * @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 schedule request along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> validateWithResponseAsync( + String scope, + String roleAssignmentScheduleRequestName, + RoleAssignmentScheduleRequestInner 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 (roleAssignmentScheduleRequestName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter roleAssignmentScheduleRequestName 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 + .validate( + this.client.getEndpoint(), + scope, + roleAssignmentScheduleRequestName, + this.client.getApiVersion(), + parameters, + accept, + context); + } + + /** + * Validates a new role assignment schedule request. + * + * @param scope The scope of the role assignment request to validate. + * @param roleAssignmentScheduleRequestName The name of the role assignment request to validate. + * @param parameters Parameters for the role assignment schedule request. + * @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 schedule request on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono validateAsync( + String scope, String roleAssignmentScheduleRequestName, RoleAssignmentScheduleRequestInner parameters) { + return validateWithResponseAsync(scope, roleAssignmentScheduleRequestName, parameters) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Validates a new role assignment schedule request. + * + * @param scope The scope of the role assignment request to validate. + * @param roleAssignmentScheduleRequestName The name of the role assignment request to validate. + * @param parameters Parameters for the role assignment schedule request. + * @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 schedule request along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response validateWithResponse( + String scope, + String roleAssignmentScheduleRequestName, + RoleAssignmentScheduleRequestInner parameters, + Context context) { + return validateWithResponseAsync(scope, roleAssignmentScheduleRequestName, parameters, context).block(); + } + + /** + * Validates a new role assignment schedule request. + * + * @param scope The scope of the role assignment request to validate. + * @param roleAssignmentScheduleRequestName The name of the role assignment request to validate. + * @param parameters Parameters for the role assignment schedule request. + * @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 schedule request. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public RoleAssignmentScheduleRequestInner validate( + String scope, String roleAssignmentScheduleRequestName, RoleAssignmentScheduleRequestInner parameters) { + return validateWithResponse(scope, roleAssignmentScheduleRequestName, parameters, Context.NONE).getValue(); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

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 schedule request list operation result along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @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 URL to get the next list of items + *

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 schedule request list operation result along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @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/RoleAssignmentScheduleRequestsImpl.java b/sdk/authorization/azure-resourcemanager-authorization-generated/src/main/java/com/azure/resourcemanager/authorization/generated/implementation/RoleAssignmentScheduleRequestsImpl.java new file mode 100644 index 0000000000000..0d1df2a790c3f --- /dev/null +++ b/sdk/authorization/azure-resourcemanager-authorization-generated/src/main/java/com/azure/resourcemanager/authorization/generated/implementation/RoleAssignmentScheduleRequestsImpl.java @@ -0,0 +1,178 @@ +// 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.RoleAssignmentScheduleRequestsClient; +import com.azure.resourcemanager.authorization.generated.fluent.models.RoleAssignmentScheduleRequestInner; +import com.azure.resourcemanager.authorization.generated.models.RoleAssignmentScheduleRequest; +import com.azure.resourcemanager.authorization.generated.models.RoleAssignmentScheduleRequests; + +public final class RoleAssignmentScheduleRequestsImpl implements RoleAssignmentScheduleRequests { + private static final ClientLogger LOGGER = new ClientLogger(RoleAssignmentScheduleRequestsImpl.class); + + private final RoleAssignmentScheduleRequestsClient innerClient; + + private final com.azure.resourcemanager.authorization.generated.AuthorizationManager serviceManager; + + public RoleAssignmentScheduleRequestsImpl( + RoleAssignmentScheduleRequestsClient innerClient, + com.azure.resourcemanager.authorization.generated.AuthorizationManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response getWithResponse( + String scope, String roleAssignmentScheduleRequestName, Context context) { + Response inner = + this.serviceClient().getWithResponse(scope, roleAssignmentScheduleRequestName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new RoleAssignmentScheduleRequestImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public RoleAssignmentScheduleRequest get(String scope, String roleAssignmentScheduleRequestName) { + RoleAssignmentScheduleRequestInner inner = this.serviceClient().get(scope, roleAssignmentScheduleRequestName); + if (inner != null) { + return new RoleAssignmentScheduleRequestImpl(inner, this.manager()); + } else { + return null; + } + } + + public PagedIterable listForScope(String scope) { + PagedIterable inner = this.serviceClient().listForScope(scope); + return Utils.mapPage(inner, inner1 -> new RoleAssignmentScheduleRequestImpl(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 RoleAssignmentScheduleRequestImpl(inner1, this.manager())); + } + + public Response cancelWithResponse(String scope, String roleAssignmentScheduleRequestName, Context context) { + return this.serviceClient().cancelWithResponse(scope, roleAssignmentScheduleRequestName, context); + } + + public void cancel(String scope, String roleAssignmentScheduleRequestName) { + this.serviceClient().cancel(scope, roleAssignmentScheduleRequestName); + } + + public Response validateWithResponse( + String scope, + String roleAssignmentScheduleRequestName, + RoleAssignmentScheduleRequestInner parameters, + Context context) { + Response inner = + this.serviceClient().validateWithResponse(scope, roleAssignmentScheduleRequestName, parameters, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new RoleAssignmentScheduleRequestImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public RoleAssignmentScheduleRequest validate( + String scope, String roleAssignmentScheduleRequestName, RoleAssignmentScheduleRequestInner parameters) { + RoleAssignmentScheduleRequestInner inner = + this.serviceClient().validate(scope, roleAssignmentScheduleRequestName, parameters); + if (inner != null) { + return new RoleAssignmentScheduleRequestImpl(inner, this.manager()); + } else { + return null; + } + } + + public RoleAssignmentScheduleRequest getById(String id) { + String scope = + Utils + .getValueFromIdByParameterName( + id, + "/{scope}/providers/Microsoft.Authorization/roleAssignmentScheduleRequests/{roleAssignmentScheduleRequestName}", + "scope"); + if (scope == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'scope'.", id))); + } + String roleAssignmentScheduleRequestName = + Utils + .getValueFromIdByParameterName( + id, + "/{scope}/providers/Microsoft.Authorization/roleAssignmentScheduleRequests/{roleAssignmentScheduleRequestName}", + "roleAssignmentScheduleRequestName"); + if (roleAssignmentScheduleRequestName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment" + + " 'roleAssignmentScheduleRequests'.", + id))); + } + return this.getWithResponse(scope, roleAssignmentScheduleRequestName, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String scope = + Utils + .getValueFromIdByParameterName( + id, + "/{scope}/providers/Microsoft.Authorization/roleAssignmentScheduleRequests/{roleAssignmentScheduleRequestName}", + "scope"); + if (scope == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'scope'.", id))); + } + String roleAssignmentScheduleRequestName = + Utils + .getValueFromIdByParameterName( + id, + "/{scope}/providers/Microsoft.Authorization/roleAssignmentScheduleRequests/{roleAssignmentScheduleRequestName}", + "roleAssignmentScheduleRequestName"); + if (roleAssignmentScheduleRequestName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment" + + " 'roleAssignmentScheduleRequests'.", + id))); + } + return this.getWithResponse(scope, roleAssignmentScheduleRequestName, context); + } + + private RoleAssignmentScheduleRequestsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.authorization.generated.AuthorizationManager manager() { + return this.serviceManager; + } + + public RoleAssignmentScheduleRequestImpl define(String name) { + return new RoleAssignmentScheduleRequestImpl(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/ExpandedProperties.java b/sdk/authorization/azure-resourcemanager-authorization-generated/src/main/java/com/azure/resourcemanager/authorization/generated/models/ExpandedProperties.java new file mode 100644 index 0000000000000..6b24f748178c4 --- /dev/null +++ b/sdk/authorization/azure-resourcemanager-authorization-generated/src/main/java/com/azure/resourcemanager/authorization/generated/models/ExpandedProperties.java @@ -0,0 +1,111 @@ +// 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.fasterxml.jackson.annotation.JsonProperty; + +/** Expanded info of resource, role and principal. */ +@Fluent +public final class ExpandedProperties { + /* + * Details of the resource scope + */ + @JsonProperty(value = "scope") + private ExpandedPropertiesScope scope; + + /* + * Details of role definition + */ + @JsonProperty(value = "roleDefinition") + private ExpandedPropertiesRoleDefinition roleDefinition; + + /* + * Details of the principal + */ + @JsonProperty(value = "principal") + private ExpandedPropertiesPrincipal principal; + + /** Creates an instance of ExpandedProperties class. */ + public ExpandedProperties() { + } + + /** + * Get the scope property: Details of the resource scope. + * + * @return the scope value. + */ + public ExpandedPropertiesScope scope() { + return this.scope; + } + + /** + * Set the scope property: Details of the resource scope. + * + * @param scope the scope value to set. + * @return the ExpandedProperties object itself. + */ + public ExpandedProperties withScope(ExpandedPropertiesScope scope) { + this.scope = scope; + return this; + } + + /** + * Get the roleDefinition property: Details of role definition. + * + * @return the roleDefinition value. + */ + public ExpandedPropertiesRoleDefinition roleDefinition() { + return this.roleDefinition; + } + + /** + * Set the roleDefinition property: Details of role definition. + * + * @param roleDefinition the roleDefinition value to set. + * @return the ExpandedProperties object itself. + */ + public ExpandedProperties withRoleDefinition(ExpandedPropertiesRoleDefinition roleDefinition) { + this.roleDefinition = roleDefinition; + return this; + } + + /** + * Get the principal property: Details of the principal. + * + * @return the principal value. + */ + public ExpandedPropertiesPrincipal principal() { + return this.principal; + } + + /** + * Set the principal property: Details of the principal. + * + * @param principal the principal value to set. + * @return the ExpandedProperties object itself. + */ + public ExpandedProperties withPrincipal(ExpandedPropertiesPrincipal principal) { + this.principal = principal; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (scope() != null) { + scope().validate(); + } + if (roleDefinition() != null) { + roleDefinition().validate(); + } + if (principal() != null) { + principal().validate(); + } + } +} diff --git a/sdk/authorization/azure-resourcemanager-authorization-generated/src/main/java/com/azure/resourcemanager/authorization/generated/models/ExpandedPropertiesPrincipal.java b/sdk/authorization/azure-resourcemanager-authorization-generated/src/main/java/com/azure/resourcemanager/authorization/generated/models/ExpandedPropertiesPrincipal.java new file mode 100644 index 0000000000000..85045ee08f7fb --- /dev/null +++ b/sdk/authorization/azure-resourcemanager-authorization-generated/src/main/java/com/azure/resourcemanager/authorization/generated/models/ExpandedPropertiesPrincipal.java @@ -0,0 +1,128 @@ +// 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.fasterxml.jackson.annotation.JsonProperty; + +/** Details of the principal. */ +@Fluent +public final class ExpandedPropertiesPrincipal { + /* + * Id of the principal + */ + @JsonProperty(value = "id") + private String id; + + /* + * Display name of the principal + */ + @JsonProperty(value = "displayName") + private String displayName; + + /* + * Email id of the principal + */ + @JsonProperty(value = "email") + private String email; + + /* + * Type of the principal + */ + @JsonProperty(value = "type") + private String type; + + /** Creates an instance of ExpandedPropertiesPrincipal class. */ + public ExpandedPropertiesPrincipal() { + } + + /** + * Get the id property: Id of the principal. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Set the id property: Id of the principal. + * + * @param id the id value to set. + * @return the ExpandedPropertiesPrincipal object itself. + */ + public ExpandedPropertiesPrincipal withId(String id) { + this.id = id; + return this; + } + + /** + * Get the displayName property: Display name of the principal. + * + * @return the displayName value. + */ + public String displayName() { + return this.displayName; + } + + /** + * Set the displayName property: Display name of the principal. + * + * @param displayName the displayName value to set. + * @return the ExpandedPropertiesPrincipal object itself. + */ + public ExpandedPropertiesPrincipal withDisplayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Get the email property: Email id of the principal. + * + * @return the email value. + */ + public String email() { + return this.email; + } + + /** + * Set the email property: Email id of the principal. + * + * @param email the email value to set. + * @return the ExpandedPropertiesPrincipal object itself. + */ + public ExpandedPropertiesPrincipal withEmail(String email) { + this.email = email; + return this; + } + + /** + * Get the type property: Type of the principal. + * + * @return the type value. + */ + public String type() { + return this.type; + } + + /** + * Set the type property: Type of the principal. + * + * @param type the type value to set. + * @return the ExpandedPropertiesPrincipal object itself. + */ + public ExpandedPropertiesPrincipal withType(String type) { + this.type = type; + 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/models/ExpandedPropertiesRoleDefinition.java b/sdk/authorization/azure-resourcemanager-authorization-generated/src/main/java/com/azure/resourcemanager/authorization/generated/models/ExpandedPropertiesRoleDefinition.java new file mode 100644 index 0000000000000..0b0d1fa0950ba --- /dev/null +++ b/sdk/authorization/azure-resourcemanager-authorization-generated/src/main/java/com/azure/resourcemanager/authorization/generated/models/ExpandedPropertiesRoleDefinition.java @@ -0,0 +1,102 @@ +// 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.fasterxml.jackson.annotation.JsonProperty; + +/** Details of role definition. */ +@Fluent +public final class ExpandedPropertiesRoleDefinition { + /* + * Id of the role definition + */ + @JsonProperty(value = "id") + private String id; + + /* + * Display name of the role definition + */ + @JsonProperty(value = "displayName") + private String displayName; + + /* + * Type of the role definition + */ + @JsonProperty(value = "type") + private String type; + + /** Creates an instance of ExpandedPropertiesRoleDefinition class. */ + public ExpandedPropertiesRoleDefinition() { + } + + /** + * Get the id property: Id of the role definition. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Set the id property: Id of the role definition. + * + * @param id the id value to set. + * @return the ExpandedPropertiesRoleDefinition object itself. + */ + public ExpandedPropertiesRoleDefinition withId(String id) { + this.id = id; + return this; + } + + /** + * Get the displayName property: Display name of the role definition. + * + * @return the displayName value. + */ + public String displayName() { + return this.displayName; + } + + /** + * Set the displayName property: Display name of the role definition. + * + * @param displayName the displayName value to set. + * @return the ExpandedPropertiesRoleDefinition object itself. + */ + public ExpandedPropertiesRoleDefinition withDisplayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Get the type property: Type of the role definition. + * + * @return the type value. + */ + public String type() { + return this.type; + } + + /** + * Set the type property: Type of the role definition. + * + * @param type the type value to set. + * @return the ExpandedPropertiesRoleDefinition object itself. + */ + public ExpandedPropertiesRoleDefinition withType(String type) { + this.type = type; + 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/models/ExpandedPropertiesScope.java b/sdk/authorization/azure-resourcemanager-authorization-generated/src/main/java/com/azure/resourcemanager/authorization/generated/models/ExpandedPropertiesScope.java new file mode 100644 index 0000000000000..51dfecd063cd1 --- /dev/null +++ b/sdk/authorization/azure-resourcemanager-authorization-generated/src/main/java/com/azure/resourcemanager/authorization/generated/models/ExpandedPropertiesScope.java @@ -0,0 +1,102 @@ +// 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.fasterxml.jackson.annotation.JsonProperty; + +/** Details of the resource scope. */ +@Fluent +public final class ExpandedPropertiesScope { + /* + * Scope id of the resource + */ + @JsonProperty(value = "id") + private String id; + + /* + * Display name of the resource + */ + @JsonProperty(value = "displayName") + private String displayName; + + /* + * Type of the resource + */ + @JsonProperty(value = "type") + private String type; + + /** Creates an instance of ExpandedPropertiesScope class. */ + public ExpandedPropertiesScope() { + } + + /** + * Get the id property: Scope id of the resource. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Set the id property: Scope id of the resource. + * + * @param id the id value to set. + * @return the ExpandedPropertiesScope object itself. + */ + public ExpandedPropertiesScope withId(String id) { + this.id = id; + return this; + } + + /** + * Get the displayName property: Display name of the resource. + * + * @return the displayName value. + */ + public String displayName() { + return this.displayName; + } + + /** + * Set the displayName property: Display name of the resource. + * + * @param displayName the displayName value to set. + * @return the ExpandedPropertiesScope object itself. + */ + public ExpandedPropertiesScope withDisplayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Get the type property: Type of the resource. + * + * @return the type value. + */ + public String type() { + return this.type; + } + + /** + * Set the type property: Type of the resource. + * + * @param type the type value to set. + * @return the ExpandedPropertiesScope object itself. + */ + public ExpandedPropertiesScope withType(String type) { + this.type = type; + 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/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..048fb9ce526b0 --- /dev/null +++ b/sdk/authorization/azure-resourcemanager-authorization-generated/src/main/java/com/azure/resourcemanager/authorization/generated/models/PrincipalType.java @@ -0,0 +1,56 @@ +// 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; + +/** The principal type of the assigned principal ID. */ +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 ForeignGroup for PrincipalType. */ + public static final PrincipalType FOREIGN_GROUP = fromString("ForeignGroup"); + + /** Static value Device for PrincipalType. */ + public static final PrincipalType DEVICE = fromString("Device"); + + /** + * Creates a new instance of PrincipalType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public PrincipalType() { + } + + /** + * 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); + } + + /** + * Gets known PrincipalType values. + * + * @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/RequestType.java b/sdk/authorization/azure-resourcemanager-authorization-generated/src/main/java/com/azure/resourcemanager/authorization/generated/models/RequestType.java new file mode 100644 index 0000000000000..9839666d991b2 --- /dev/null +++ b/sdk/authorization/azure-resourcemanager-authorization-generated/src/main/java/com/azure/resourcemanager/authorization/generated/models/RequestType.java @@ -0,0 +1,68 @@ +// 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; + +/** The type of the role assignment schedule request. Eg: SelfActivate, AdminAssign etc. */ +public final class RequestType extends ExpandableStringEnum { + /** Static value AdminAssign for RequestType. */ + public static final RequestType ADMIN_ASSIGN = fromString("AdminAssign"); + + /** Static value AdminRemove for RequestType. */ + public static final RequestType ADMIN_REMOVE = fromString("AdminRemove"); + + /** Static value AdminUpdate for RequestType. */ + public static final RequestType ADMIN_UPDATE = fromString("AdminUpdate"); + + /** Static value AdminExtend for RequestType. */ + public static final RequestType ADMIN_EXTEND = fromString("AdminExtend"); + + /** Static value AdminRenew for RequestType. */ + public static final RequestType ADMIN_RENEW = fromString("AdminRenew"); + + /** Static value SelfActivate for RequestType. */ + public static final RequestType SELF_ACTIVATE = fromString("SelfActivate"); + + /** Static value SelfDeactivate for RequestType. */ + public static final RequestType SELF_DEACTIVATE = fromString("SelfDeactivate"); + + /** Static value SelfExtend for RequestType. */ + public static final RequestType SELF_EXTEND = fromString("SelfExtend"); + + /** Static value SelfRenew for RequestType. */ + public static final RequestType SELF_RENEW = fromString("SelfRenew"); + + /** + * Creates a new instance of RequestType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public RequestType() { + } + + /** + * Creates or finds a RequestType from its string representation. + * + * @param name a name to look for. + * @return the corresponding RequestType. + */ + @JsonCreator + public static RequestType fromString(String name) { + return fromString(name, RequestType.class); + } + + /** + * Gets known RequestType values. + * + * @return known RequestType values. + */ + public static Collection values() { + return values(RequestType.class); + } +} diff --git a/sdk/authorization/azure-resourcemanager-authorization-generated/src/main/java/com/azure/resourcemanager/authorization/generated/models/RoleAssignmentScheduleRequest.java b/sdk/authorization/azure-resourcemanager-authorization-generated/src/main/java/com/azure/resourcemanager/authorization/generated/models/RoleAssignmentScheduleRequest.java new file mode 100644 index 0000000000000..8692003073370 --- /dev/null +++ b/sdk/authorization/azure-resourcemanager-authorization-generated/src/main/java/com/azure/resourcemanager/authorization/generated/models/RoleAssignmentScheduleRequest.java @@ -0,0 +1,415 @@ +// 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.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.authorization.generated.fluent.models.RoleAssignmentScheduleRequestInner; +import java.time.OffsetDateTime; + +/** An immutable client-side representation of RoleAssignmentScheduleRequest. */ +public interface RoleAssignmentScheduleRequest { + /** + * Gets the id property: The role assignment schedule request ID. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The role assignment schedule request name. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The role assignment schedule request type. + * + * @return the type value. + */ + String type(); + + /** + * Gets the scope property: The role assignment schedule request 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 requestType property: The type of the role assignment schedule request. Eg: SelfActivate, AdminAssign + * etc. + * + * @return the requestType value. + */ + RequestType requestType(); + + /** + * Gets the status property: The status of the role assignment schedule request. + * + * @return the status value. + */ + Status status(); + + /** + * Gets the approvalId property: The approvalId of the role assignment schedule request. + * + * @return the approvalId value. + */ + String approvalId(); + + /** + * Gets the targetRoleAssignmentScheduleId property: The resultant role assignment schedule id or the role + * assignment schedule id being updated. + * + * @return the targetRoleAssignmentScheduleId value. + */ + String targetRoleAssignmentScheduleId(); + + /** + * Gets the targetRoleAssignmentScheduleInstanceId property: The role assignment schedule instance id being updated. + * + * @return the targetRoleAssignmentScheduleInstanceId value. + */ + String targetRoleAssignmentScheduleInstanceId(); + + /** + * Gets the scheduleInfo property: Schedule info of the role assignment schedule. + * + * @return the scheduleInfo value. + */ + RoleAssignmentScheduleRequestPropertiesScheduleInfo scheduleInfo(); + + /** + * Gets the linkedRoleEligibilityScheduleId property: The linked role eligibility schedule id - to activate an + * eligibility. + * + * @return the linkedRoleEligibilityScheduleId value. + */ + String linkedRoleEligibilityScheduleId(); + + /** + * Gets the justification property: Justification for the role assignment. + * + * @return the justification value. + */ + String justification(); + + /** + * Gets the ticketInfo property: Ticket Info of the role assignment. + * + * @return the ticketInfo value. + */ + RoleAssignmentScheduleRequestPropertiesTicketInfo ticketInfo(); + + /** + * 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: DateTime when role assignment schedule request was created. + * + * @return the createdOn value. + */ + OffsetDateTime createdOn(); + + /** + * Gets the requestorId property: Id of the user who created this request. + * + * @return the requestorId value. + */ + String requestorId(); + + /** + * Gets the expandedProperties property: Additional properties of principal, scope and role definition. + * + * @return the expandedProperties value. + */ + ExpandedProperties expandedProperties(); + + /** + * Gets the inner com.azure.resourcemanager.authorization.generated.fluent.models.RoleAssignmentScheduleRequestInner + * object. + * + * @return the inner object. + */ + RoleAssignmentScheduleRequestInner innerModel(); + + /** The entirety of the RoleAssignmentScheduleRequest definition. */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithScope, DefinitionStages.WithCreate { + } + /** The RoleAssignmentScheduleRequest definition stages. */ + interface DefinitionStages { + /** The first stage of the RoleAssignmentScheduleRequest definition. */ + interface Blank extends WithScope { + } + /** The stage of the RoleAssignmentScheduleRequest definition allowing to specify parent resource. */ + interface WithScope { + /** + * Specifies scope. + * + * @param scope The scope of the role assignment schedule request to create. The scope can be any REST + * resource instance. For example, use + * '/providers/Microsoft.Subscription/subscriptions/{subscription-id}/' for a subscription, + * '/providers/Microsoft.Subscription/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}' + * for a resource group, and + * '/providers/Microsoft.Subscription/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/providers/{resource-provider}/{resource-type}/{resource-name}' + * for a resource. + * @return the next definition stage. + */ + WithCreate withExistingScope(String scope); + } + /** + * The stage of the RoleAssignmentScheduleRequest 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.WithRoleDefinitionId, + DefinitionStages.WithPrincipalId, + DefinitionStages.WithRequestType, + DefinitionStages.WithTargetRoleAssignmentScheduleId, + DefinitionStages.WithTargetRoleAssignmentScheduleInstanceId, + DefinitionStages.WithScheduleInfo, + DefinitionStages.WithLinkedRoleEligibilityScheduleId, + DefinitionStages.WithJustification, + DefinitionStages.WithTicketInfo, + DefinitionStages.WithCondition, + DefinitionStages.WithConditionVersion { + /** + * Executes the create request. + * + * @return the created resource. + */ + RoleAssignmentScheduleRequest create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + RoleAssignmentScheduleRequest create(Context context); + } + /** The stage of the RoleAssignmentScheduleRequest definition allowing to specify roleDefinitionId. */ + interface WithRoleDefinitionId { + /** + * Specifies the roleDefinitionId property: The role definition ID.. + * + * @param roleDefinitionId The role definition ID. + * @return the next definition stage. + */ + WithCreate withRoleDefinitionId(String roleDefinitionId); + } + /** The stage of the RoleAssignmentScheduleRequest definition allowing to specify principalId. */ + interface WithPrincipalId { + /** + * Specifies the principalId property: The principal ID.. + * + * @param principalId The principal ID. + * @return the next definition stage. + */ + WithCreate withPrincipalId(String principalId); + } + /** The stage of the RoleAssignmentScheduleRequest definition allowing to specify requestType. */ + interface WithRequestType { + /** + * Specifies the requestType property: The type of the role assignment schedule request. Eg: SelfActivate, + * AdminAssign etc. + * + * @param requestType The type of the role assignment schedule request. Eg: SelfActivate, AdminAssign etc. + * @return the next definition stage. + */ + WithCreate withRequestType(RequestType requestType); + } + /** + * The stage of the RoleAssignmentScheduleRequest definition allowing to specify targetRoleAssignmentScheduleId. + */ + interface WithTargetRoleAssignmentScheduleId { + /** + * Specifies the targetRoleAssignmentScheduleId property: The resultant role assignment schedule id or the + * role assignment schedule id being updated. + * + * @param targetRoleAssignmentScheduleId The resultant role assignment schedule id or the role assignment + * schedule id being updated. + * @return the next definition stage. + */ + WithCreate withTargetRoleAssignmentScheduleId(String targetRoleAssignmentScheduleId); + } + /** + * The stage of the RoleAssignmentScheduleRequest definition allowing to specify + * targetRoleAssignmentScheduleInstanceId. + */ + interface WithTargetRoleAssignmentScheduleInstanceId { + /** + * Specifies the targetRoleAssignmentScheduleInstanceId property: The role assignment schedule instance id + * being updated. + * + * @param targetRoleAssignmentScheduleInstanceId The role assignment schedule instance id being updated. + * @return the next definition stage. + */ + WithCreate withTargetRoleAssignmentScheduleInstanceId(String targetRoleAssignmentScheduleInstanceId); + } + /** The stage of the RoleAssignmentScheduleRequest definition allowing to specify scheduleInfo. */ + interface WithScheduleInfo { + /** + * Specifies the scheduleInfo property: Schedule info of the role assignment schedule. + * + * @param scheduleInfo Schedule info of the role assignment schedule. + * @return the next definition stage. + */ + WithCreate withScheduleInfo(RoleAssignmentScheduleRequestPropertiesScheduleInfo scheduleInfo); + } + /** + * The stage of the RoleAssignmentScheduleRequest definition allowing to specify + * linkedRoleEligibilityScheduleId. + */ + interface WithLinkedRoleEligibilityScheduleId { + /** + * Specifies the linkedRoleEligibilityScheduleId property: The linked role eligibility schedule id - to + * activate an eligibility.. + * + * @param linkedRoleEligibilityScheduleId The linked role eligibility schedule id - to activate an + * eligibility. + * @return the next definition stage. + */ + WithCreate withLinkedRoleEligibilityScheduleId(String linkedRoleEligibilityScheduleId); + } + /** The stage of the RoleAssignmentScheduleRequest definition allowing to specify justification. */ + interface WithJustification { + /** + * Specifies the justification property: Justification for the role assignment. + * + * @param justification Justification for the role assignment. + * @return the next definition stage. + */ + WithCreate withJustification(String justification); + } + /** The stage of the RoleAssignmentScheduleRequest definition allowing to specify ticketInfo. */ + interface WithTicketInfo { + /** + * Specifies the ticketInfo property: Ticket Info of the role assignment. + * + * @param ticketInfo Ticket Info of the role assignment. + * @return the next definition stage. + */ + WithCreate withTicketInfo(RoleAssignmentScheduleRequestPropertiesTicketInfo ticketInfo); + } + /** The stage of the RoleAssignmentScheduleRequest 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 RoleAssignmentScheduleRequest 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); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + RoleAssignmentScheduleRequest refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + RoleAssignmentScheduleRequest refresh(Context context); + + /** + * Cancels a pending role assignment schedule request. + * + * @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 {@link Response}. + */ + Response cancelWithResponse(Context context); + + /** + * Cancels a pending role assignment schedule request. + * + * @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. + */ + void cancel(); + + /** + * Validates a new role assignment schedule request. + * + * @param parameters Parameters for the role assignment schedule request. + * @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 schedule request along with {@link Response}. + */ + Response validateWithResponse( + RoleAssignmentScheduleRequestInner parameters, Context context); + + /** + * Validates a new role assignment schedule request. + * + * @param parameters Parameters for the role assignment schedule request. + * @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 schedule request. + */ + RoleAssignmentScheduleRequest validate(RoleAssignmentScheduleRequestInner parameters); +} diff --git a/sdk/authorization/azure-resourcemanager-authorization-generated/src/main/java/com/azure/resourcemanager/authorization/generated/models/RoleAssignmentScheduleRequestListResult.java b/sdk/authorization/azure-resourcemanager-authorization-generated/src/main/java/com/azure/resourcemanager/authorization/generated/models/RoleAssignmentScheduleRequestListResult.java new file mode 100644 index 0000000000000..62e19cc094f41 --- /dev/null +++ b/sdk/authorization/azure-resourcemanager-authorization-generated/src/main/java/com/azure/resourcemanager/authorization/generated/models/RoleAssignmentScheduleRequestListResult.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.resourcemanager.authorization.generated.fluent.models.RoleAssignmentScheduleRequestInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Role assignment schedule request list operation result. */ +@Fluent +public final class RoleAssignmentScheduleRequestListResult { + /* + * Role assignment schedule request list. + */ + @JsonProperty(value = "value") + private List value; + + /* + * The URL to use for getting the next set of results. + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** Creates an instance of RoleAssignmentScheduleRequestListResult class. */ + public RoleAssignmentScheduleRequestListResult() { + } + + /** + * Get the value property: Role assignment schedule request list. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: Role assignment schedule request list. + * + * @param value the value value to set. + * @return the RoleAssignmentScheduleRequestListResult object itself. + */ + public RoleAssignmentScheduleRequestListResult 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 RoleAssignmentScheduleRequestListResult object itself. + */ + public RoleAssignmentScheduleRequestListResult 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/RoleAssignmentScheduleRequestPropertiesScheduleInfo.java b/sdk/authorization/azure-resourcemanager-authorization-generated/src/main/java/com/azure/resourcemanager/authorization/generated/models/RoleAssignmentScheduleRequestPropertiesScheduleInfo.java new file mode 100644 index 0000000000000..d692cd6534ba6 --- /dev/null +++ b/sdk/authorization/azure-resourcemanager-authorization-generated/src/main/java/com/azure/resourcemanager/authorization/generated/models/RoleAssignmentScheduleRequestPropertiesScheduleInfo.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.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** Schedule info of the role assignment schedule. */ +@Fluent +public final class RoleAssignmentScheduleRequestPropertiesScheduleInfo { + /* + * Start DateTime of the role assignment schedule. + */ + @JsonProperty(value = "startDateTime") + private OffsetDateTime startDateTime; + + /* + * Expiration of the role assignment schedule + */ + @JsonProperty(value = "expiration") + private RoleAssignmentScheduleRequestPropertiesScheduleInfoExpiration expiration; + + /** Creates an instance of RoleAssignmentScheduleRequestPropertiesScheduleInfo class. */ + public RoleAssignmentScheduleRequestPropertiesScheduleInfo() { + } + + /** + * Get the startDateTime property: Start DateTime of the role assignment schedule. + * + * @return the startDateTime value. + */ + public OffsetDateTime startDateTime() { + return this.startDateTime; + } + + /** + * Set the startDateTime property: Start DateTime of the role assignment schedule. + * + * @param startDateTime the startDateTime value to set. + * @return the RoleAssignmentScheduleRequestPropertiesScheduleInfo object itself. + */ + public RoleAssignmentScheduleRequestPropertiesScheduleInfo withStartDateTime(OffsetDateTime startDateTime) { + this.startDateTime = startDateTime; + return this; + } + + /** + * Get the expiration property: Expiration of the role assignment schedule. + * + * @return the expiration value. + */ + public RoleAssignmentScheduleRequestPropertiesScheduleInfoExpiration expiration() { + return this.expiration; + } + + /** + * Set the expiration property: Expiration of the role assignment schedule. + * + * @param expiration the expiration value to set. + * @return the RoleAssignmentScheduleRequestPropertiesScheduleInfo object itself. + */ + public RoleAssignmentScheduleRequestPropertiesScheduleInfo withExpiration( + RoleAssignmentScheduleRequestPropertiesScheduleInfoExpiration expiration) { + this.expiration = expiration; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (expiration() != null) { + expiration().validate(); + } + } +} diff --git a/sdk/authorization/azure-resourcemanager-authorization-generated/src/main/java/com/azure/resourcemanager/authorization/generated/models/RoleAssignmentScheduleRequestPropertiesScheduleInfoExpiration.java b/sdk/authorization/azure-resourcemanager-authorization-generated/src/main/java/com/azure/resourcemanager/authorization/generated/models/RoleAssignmentScheduleRequestPropertiesScheduleInfoExpiration.java new file mode 100644 index 0000000000000..6fb59fe421657 --- /dev/null +++ b/sdk/authorization/azure-resourcemanager-authorization-generated/src/main/java/com/azure/resourcemanager/authorization/generated/models/RoleAssignmentScheduleRequestPropertiesScheduleInfoExpiration.java @@ -0,0 +1,103 @@ +// 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.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** Expiration of the role assignment schedule. */ +@Fluent +public final class RoleAssignmentScheduleRequestPropertiesScheduleInfoExpiration { + /* + * Type of the role assignment schedule expiration + */ + @JsonProperty(value = "type") + private Type type; + + /* + * End DateTime of the role assignment schedule. + */ + @JsonProperty(value = "endDateTime") + private OffsetDateTime endDateTime; + + /* + * Duration of the role assignment schedule in TimeSpan. + */ + @JsonProperty(value = "duration") + private String duration; + + /** Creates an instance of RoleAssignmentScheduleRequestPropertiesScheduleInfoExpiration class. */ + public RoleAssignmentScheduleRequestPropertiesScheduleInfoExpiration() { + } + + /** + * Get the type property: Type of the role assignment schedule expiration. + * + * @return the type value. + */ + public Type type() { + return this.type; + } + + /** + * Set the type property: Type of the role assignment schedule expiration. + * + * @param type the type value to set. + * @return the RoleAssignmentScheduleRequestPropertiesScheduleInfoExpiration object itself. + */ + public RoleAssignmentScheduleRequestPropertiesScheduleInfoExpiration withType(Type type) { + this.type = type; + return this; + } + + /** + * Get the endDateTime property: End DateTime of the role assignment schedule. + * + * @return the endDateTime value. + */ + public OffsetDateTime endDateTime() { + return this.endDateTime; + } + + /** + * Set the endDateTime property: End DateTime of the role assignment schedule. + * + * @param endDateTime the endDateTime value to set. + * @return the RoleAssignmentScheduleRequestPropertiesScheduleInfoExpiration object itself. + */ + public RoleAssignmentScheduleRequestPropertiesScheduleInfoExpiration withEndDateTime(OffsetDateTime endDateTime) { + this.endDateTime = endDateTime; + return this; + } + + /** + * Get the duration property: Duration of the role assignment schedule in TimeSpan. + * + * @return the duration value. + */ + public String duration() { + return this.duration; + } + + /** + * Set the duration property: Duration of the role assignment schedule in TimeSpan. + * + * @param duration the duration value to set. + * @return the RoleAssignmentScheduleRequestPropertiesScheduleInfoExpiration object itself. + */ + public RoleAssignmentScheduleRequestPropertiesScheduleInfoExpiration withDuration(String duration) { + this.duration = duration; + 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/models/RoleAssignmentScheduleRequestPropertiesTicketInfo.java b/sdk/authorization/azure-resourcemanager-authorization-generated/src/main/java/com/azure/resourcemanager/authorization/generated/models/RoleAssignmentScheduleRequestPropertiesTicketInfo.java new file mode 100644 index 0000000000000..4a351d1c9b4a6 --- /dev/null +++ b/sdk/authorization/azure-resourcemanager-authorization-generated/src/main/java/com/azure/resourcemanager/authorization/generated/models/RoleAssignmentScheduleRequestPropertiesTicketInfo.java @@ -0,0 +1,76 @@ +// 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.fasterxml.jackson.annotation.JsonProperty; + +/** Ticket Info of the role assignment. */ +@Fluent +public final class RoleAssignmentScheduleRequestPropertiesTicketInfo { + /* + * Ticket number for the role assignment + */ + @JsonProperty(value = "ticketNumber") + private String ticketNumber; + + /* + * Ticket system name for the role assignment + */ + @JsonProperty(value = "ticketSystem") + private String ticketSystem; + + /** Creates an instance of RoleAssignmentScheduleRequestPropertiesTicketInfo class. */ + public RoleAssignmentScheduleRequestPropertiesTicketInfo() { + } + + /** + * Get the ticketNumber property: Ticket number for the role assignment. + * + * @return the ticketNumber value. + */ + public String ticketNumber() { + return this.ticketNumber; + } + + /** + * Set the ticketNumber property: Ticket number for the role assignment. + * + * @param ticketNumber the ticketNumber value to set. + * @return the RoleAssignmentScheduleRequestPropertiesTicketInfo object itself. + */ + public RoleAssignmentScheduleRequestPropertiesTicketInfo withTicketNumber(String ticketNumber) { + this.ticketNumber = ticketNumber; + return this; + } + + /** + * Get the ticketSystem property: Ticket system name for the role assignment. + * + * @return the ticketSystem value. + */ + public String ticketSystem() { + return this.ticketSystem; + } + + /** + * Set the ticketSystem property: Ticket system name for the role assignment. + * + * @param ticketSystem the ticketSystem value to set. + * @return the RoleAssignmentScheduleRequestPropertiesTicketInfo object itself. + */ + public RoleAssignmentScheduleRequestPropertiesTicketInfo withTicketSystem(String ticketSystem) { + this.ticketSystem = ticketSystem; + 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/models/RoleAssignmentScheduleRequests.java b/sdk/authorization/azure-resourcemanager-authorization-generated/src/main/java/com/azure/resourcemanager/authorization/generated/models/RoleAssignmentScheduleRequests.java new file mode 100644 index 0000000000000..af396e94abc6e --- /dev/null +++ b/sdk/authorization/azure-resourcemanager-authorization-generated/src/main/java/com/azure/resourcemanager/authorization/generated/models/RoleAssignmentScheduleRequests.java @@ -0,0 +1,155 @@ +// 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; +import com.azure.resourcemanager.authorization.generated.fluent.models.RoleAssignmentScheduleRequestInner; + +/** Resource collection API of RoleAssignmentScheduleRequests. */ +public interface RoleAssignmentScheduleRequests { + /** + * Get the specified role assignment schedule request. + * + * @param scope The scope of the role assignment schedule request. + * @param roleAssignmentScheduleRequestName The name (guid) of the role assignment schedule request 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 schedule request along with {@link Response}. + */ + Response getWithResponse( + String scope, String roleAssignmentScheduleRequestName, Context context); + + /** + * Get the specified role assignment schedule request. + * + * @param scope The scope of the role assignment schedule request. + * @param roleAssignmentScheduleRequestName The name (guid) of the role assignment schedule request 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 schedule request. + */ + RoleAssignmentScheduleRequest get(String scope, String roleAssignmentScheduleRequestName); + + /** + * Gets role assignment schedule requests for a scope. + * + * @param scope The scope of the role assignments schedule requests. + * @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 schedule requests for a scope as paginated response with {@link PagedIterable}. + */ + PagedIterable listForScope(String scope); + + /** + * Gets role assignment schedule requests for a scope. + * + * @param scope The scope of the role assignments schedule requests. + * @param filter The filter to apply on the operation. Use $filter=atScope() to return all role assignment schedule + * requests at or above the scope. Use $filter=principalId eq {id} to return all role assignment schedule + * requests at, above or below the scope for the specified principal. Use $filter=asRequestor() to return all + * role assignment schedule requests requested by the current user. Use $filter=asTarget() to return all role + * assignment schedule requests created for the current user. Use $filter=asApprover() to return all role + * assignment schedule requests where the current user is an approver. + * @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 schedule requests for a scope as paginated response with {@link PagedIterable}. + */ + PagedIterable listForScope(String scope, String filter, Context context); + + /** + * Cancels a pending role assignment schedule request. + * + * @param scope The scope of the role assignment request to cancel. + * @param roleAssignmentScheduleRequestName The name of the role assignment request to cancel. + * @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 {@link Response}. + */ + Response cancelWithResponse(String scope, String roleAssignmentScheduleRequestName, Context context); + + /** + * Cancels a pending role assignment schedule request. + * + * @param scope The scope of the role assignment request to cancel. + * @param roleAssignmentScheduleRequestName The name of the role assignment request to cancel. + * @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. + */ + void cancel(String scope, String roleAssignmentScheduleRequestName); + + /** + * Validates a new role assignment schedule request. + * + * @param scope The scope of the role assignment request to validate. + * @param roleAssignmentScheduleRequestName The name of the role assignment request to validate. + * @param parameters Parameters for the role assignment schedule request. + * @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 schedule request along with {@link Response}. + */ + Response validateWithResponse( + String scope, + String roleAssignmentScheduleRequestName, + RoleAssignmentScheduleRequestInner parameters, + Context context); + + /** + * Validates a new role assignment schedule request. + * + * @param scope The scope of the role assignment request to validate. + * @param roleAssignmentScheduleRequestName The name of the role assignment request to validate. + * @param parameters Parameters for the role assignment schedule request. + * @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 schedule request. + */ + RoleAssignmentScheduleRequest validate( + String scope, String roleAssignmentScheduleRequestName, RoleAssignmentScheduleRequestInner parameters); + + /** + * Get the specified role assignment schedule request. + * + * @param id the resource ID. + * @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 schedule request along with {@link Response}. + */ + RoleAssignmentScheduleRequest getById(String id); + + /** + * Get the specified role assignment schedule request. + * + * @param id the resource ID. + * @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 schedule request along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new RoleAssignmentScheduleRequest resource. + * + * @param name resource name. + * @return the first stage of the new RoleAssignmentScheduleRequest definition. + */ + RoleAssignmentScheduleRequest.DefinitionStages.Blank define(String name); +} diff --git a/sdk/authorization/azure-resourcemanager-authorization-generated/src/main/java/com/azure/resourcemanager/authorization/generated/models/Status.java b/sdk/authorization/azure-resourcemanager-authorization-generated/src/main/java/com/azure/resourcemanager/authorization/generated/models/Status.java new file mode 100644 index 0000000000000..63c5c740bd7e1 --- /dev/null +++ b/sdk/authorization/azure-resourcemanager-authorization-generated/src/main/java/com/azure/resourcemanager/authorization/generated/models/Status.java @@ -0,0 +1,107 @@ +// 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; + +/** The status of the role assignment schedule request. */ +public final class Status extends ExpandableStringEnum { + /** Static value Accepted for Status. */ + public static final Status ACCEPTED = fromString("Accepted"); + + /** Static value PendingEvaluation for Status. */ + public static final Status PENDING_EVALUATION = fromString("PendingEvaluation"); + + /** Static value Granted for Status. */ + public static final Status GRANTED = fromString("Granted"); + + /** Static value Denied for Status. */ + public static final Status DENIED = fromString("Denied"); + + /** Static value PendingProvisioning for Status. */ + public static final Status PENDING_PROVISIONING = fromString("PendingProvisioning"); + + /** Static value Provisioned for Status. */ + public static final Status PROVISIONED = fromString("Provisioned"); + + /** Static value PendingRevocation for Status. */ + public static final Status PENDING_REVOCATION = fromString("PendingRevocation"); + + /** Static value Revoked for Status. */ + public static final Status REVOKED = fromString("Revoked"); + + /** Static value Canceled for Status. */ + public static final Status CANCELED = fromString("Canceled"); + + /** Static value Failed for Status. */ + public static final Status FAILED = fromString("Failed"); + + /** Static value PendingApprovalProvisioning for Status. */ + public static final Status PENDING_APPROVAL_PROVISIONING = fromString("PendingApprovalProvisioning"); + + /** Static value PendingApproval for Status. */ + public static final Status PENDING_APPROVAL = fromString("PendingApproval"); + + /** Static value FailedAsResourceIsLocked for Status. */ + public static final Status FAILED_AS_RESOURCE_IS_LOCKED = fromString("FailedAsResourceIsLocked"); + + /** Static value PendingAdminDecision for Status. */ + public static final Status PENDING_ADMIN_DECISION = fromString("PendingAdminDecision"); + + /** Static value AdminApproved for Status. */ + public static final Status ADMIN_APPROVED = fromString("AdminApproved"); + + /** Static value AdminDenied for Status. */ + public static final Status ADMIN_DENIED = fromString("AdminDenied"); + + /** Static value TimedOut for Status. */ + public static final Status TIMED_OUT = fromString("TimedOut"); + + /** Static value ProvisioningStarted for Status. */ + public static final Status PROVISIONING_STARTED = fromString("ProvisioningStarted"); + + /** Static value Invalid for Status. */ + public static final Status INVALID = fromString("Invalid"); + + /** Static value PendingScheduleCreation for Status. */ + public static final Status PENDING_SCHEDULE_CREATION = fromString("PendingScheduleCreation"); + + /** Static value ScheduleCreated for Status. */ + public static final Status SCHEDULE_CREATED = fromString("ScheduleCreated"); + + /** Static value PendingExternalProvisioning for Status. */ + public static final Status PENDING_EXTERNAL_PROVISIONING = fromString("PendingExternalProvisioning"); + + /** + * Creates a new instance of Status value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public Status() { + } + + /** + * Creates or finds a Status from its string representation. + * + * @param name a name to look for. + * @return the corresponding Status. + */ + @JsonCreator + public static Status fromString(String name) { + return fromString(name, Status.class); + } + + /** + * Gets known Status values. + * + * @return known Status values. + */ + public static Collection values() { + return values(Status.class); + } +} diff --git a/sdk/authorization/azure-resourcemanager-authorization-generated/src/main/java/com/azure/resourcemanager/authorization/generated/models/Type.java b/sdk/authorization/azure-resourcemanager-authorization-generated/src/main/java/com/azure/resourcemanager/authorization/generated/models/Type.java new file mode 100644 index 0000000000000..98e309c1e1535 --- /dev/null +++ b/sdk/authorization/azure-resourcemanager-authorization-generated/src/main/java/com/azure/resourcemanager/authorization/generated/models/Type.java @@ -0,0 +1,50 @@ +// 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; + +/** Type of the role assignment schedule expiration. */ +public final class Type extends ExpandableStringEnum { + /** Static value AfterDuration for Type. */ + public static final Type AFTER_DURATION = fromString("AfterDuration"); + + /** Static value AfterDateTime for Type. */ + public static final Type AFTER_DATE_TIME = fromString("AfterDateTime"); + + /** Static value NoExpiration for Type. */ + public static final Type NO_EXPIRATION = fromString("NoExpiration"); + + /** + * Creates a new instance of Type value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public Type() { + } + + /** + * Creates or finds a Type from its string representation. + * + * @param name a name to look for. + * @return the corresponding Type. + */ + @JsonCreator + public static Type fromString(String name) { + return fromString(name, Type.class); + } + + /** + * Gets known Type values. + * + * @return known Type values. + */ + public static Collection values() { + return values(Type.class); + } +} 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/azure-resourcemanager-authorization-generated/src/samples/java/com/azure/resourcemanager/authorization/generated/generated/RoleAssignmentScheduleRequestsCancelSamples.java b/sdk/authorization/azure-resourcemanager-authorization-generated/src/samples/java/com/azure/resourcemanager/authorization/generated/generated/RoleAssignmentScheduleRequestsCancelSamples.java new file mode 100644 index 0000000000000..fa0eb721bb95f --- /dev/null +++ b/sdk/authorization/azure-resourcemanager-authorization-generated/src/samples/java/com/azure/resourcemanager/authorization/generated/generated/RoleAssignmentScheduleRequestsCancelSamples.java @@ -0,0 +1,26 @@ +// 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.generated; + +/** Samples for RoleAssignmentScheduleRequests Cancel. */ +public final class RoleAssignmentScheduleRequestsCancelSamples { + /* + * x-ms-original-file: specification/authorization/resource-manager/Microsoft.Authorization/preview/2023-04-01-preview/examples/CancelRoleAssignmentScheduleRequestByName.json + */ + /** + * Sample code: CancelRoleAssignmentScheduleRequestByName. + * + * @param manager Entry point to AuthorizationManager. + */ + public static void cancelRoleAssignmentScheduleRequestByName( + com.azure.resourcemanager.authorization.generated.AuthorizationManager manager) { + manager + .roleAssignmentScheduleRequests() + .cancelWithResponse( + "providers/Microsoft.Subscription/subscriptions/dfa2a084-766f-4003-8ae1-c4aeb893a99f", + "fea7a502-9a96-4806-a26f-eee560e52045", + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/authorization/azure-resourcemanager-authorization-generated/src/samples/java/com/azure/resourcemanager/authorization/generated/generated/RoleAssignmentScheduleRequestsCreateSamples.java b/sdk/authorization/azure-resourcemanager-authorization-generated/src/samples/java/com/azure/resourcemanager/authorization/generated/generated/RoleAssignmentScheduleRequestsCreateSamples.java new file mode 100644 index 0000000000000..0489fbc99a403 --- /dev/null +++ b/sdk/authorization/azure-resourcemanager-authorization-generated/src/samples/java/com/azure/resourcemanager/authorization/generated/generated/RoleAssignmentScheduleRequestsCreateSamples.java @@ -0,0 +1,47 @@ +// 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.generated; + +import com.azure.resourcemanager.authorization.generated.models.RequestType; +import com.azure.resourcemanager.authorization.generated.models.RoleAssignmentScheduleRequestPropertiesScheduleInfo; +import com.azure.resourcemanager.authorization.generated.models.RoleAssignmentScheduleRequestPropertiesScheduleInfoExpiration; +import com.azure.resourcemanager.authorization.generated.models.Type; +import java.time.OffsetDateTime; + +/** Samples for RoleAssignmentScheduleRequests Create. */ +public final class RoleAssignmentScheduleRequestsCreateSamples { + /* + * x-ms-original-file: specification/authorization/resource-manager/Microsoft.Authorization/preview/2023-04-01-preview/examples/PutRoleAssignmentScheduleRequest.json + */ + /** + * Sample code: PutRoleAssignmentScheduleRequest. + * + * @param manager Entry point to AuthorizationManager. + */ + public static void putRoleAssignmentScheduleRequest( + com.azure.resourcemanager.authorization.generated.AuthorizationManager manager) { + manager + .roleAssignmentScheduleRequests() + .define("fea7a502-9a96-4806-a26f-eee560e52045") + .withExistingScope("providers/Microsoft.Subscription/subscriptions/dfa2a084-766f-4003-8ae1-c4aeb893a99f") + .withRoleDefinitionId( + "/subscriptions/dfa2a084-766f-4003-8ae1-c4aeb893a99f/providers/Microsoft.Authorization/roleDefinitions/c8d4ff99-41c3-41a8-9f60-21dfdad59608") + .withPrincipalId("a3bb8764-cb92-4276-9d2a-ca1e895e55ea") + .withRequestType(RequestType.SELF_ACTIVATE) + .withScheduleInfo( + new RoleAssignmentScheduleRequestPropertiesScheduleInfo() + .withStartDateTime(OffsetDateTime.parse("2020-09-09T21:35:27.91Z")) + .withExpiration( + new RoleAssignmentScheduleRequestPropertiesScheduleInfoExpiration() + .withType(Type.AFTER_DURATION) + .withDuration("PT8H"))) + .withLinkedRoleEligibilityScheduleId("b1477448-2cc6-4ceb-93b4-54a202a89413") + .withCondition( + "@Resource[Microsoft.Storage/storageAccounts/blobServices/containers:ContainerName]" + + " StringEqualsIgnoreCase 'foo_storage_container'") + .withConditionVersion("1.0") + .create(); + } +} diff --git a/sdk/authorization/azure-resourcemanager-authorization-generated/src/samples/java/com/azure/resourcemanager/authorization/generated/generated/RoleAssignmentScheduleRequestsGetSamples.java b/sdk/authorization/azure-resourcemanager-authorization-generated/src/samples/java/com/azure/resourcemanager/authorization/generated/generated/RoleAssignmentScheduleRequestsGetSamples.java new file mode 100644 index 0000000000000..c9e7bdb5dcbb8 --- /dev/null +++ b/sdk/authorization/azure-resourcemanager-authorization-generated/src/samples/java/com/azure/resourcemanager/authorization/generated/generated/RoleAssignmentScheduleRequestsGetSamples.java @@ -0,0 +1,26 @@ +// 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.generated; + +/** Samples for RoleAssignmentScheduleRequests Get. */ +public final class RoleAssignmentScheduleRequestsGetSamples { + /* + * x-ms-original-file: specification/authorization/resource-manager/Microsoft.Authorization/preview/2023-04-01-preview/examples/GetRoleAssignmentScheduleRequestByName.json + */ + /** + * Sample code: GetRoleAssignmentScheduleRequestByName. + * + * @param manager Entry point to AuthorizationManager. + */ + public static void getRoleAssignmentScheduleRequestByName( + com.azure.resourcemanager.authorization.generated.AuthorizationManager manager) { + manager + .roleAssignmentScheduleRequests() + .getWithResponse( + "providers/Microsoft.Subscription/subscriptions/dfa2a084-766f-4003-8ae1-c4aeb893a99f", + "fea7a502-9a96-4806-a26f-eee560e52045", + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/authorization/azure-resourcemanager-authorization-generated/src/samples/java/com/azure/resourcemanager/authorization/generated/generated/RoleAssignmentScheduleRequestsListForScopeSamples.java b/sdk/authorization/azure-resourcemanager-authorization-generated/src/samples/java/com/azure/resourcemanager/authorization/generated/generated/RoleAssignmentScheduleRequestsListForScopeSamples.java new file mode 100644 index 0000000000000..ddc0436d47d26 --- /dev/null +++ b/sdk/authorization/azure-resourcemanager-authorization-generated/src/samples/java/com/azure/resourcemanager/authorization/generated/generated/RoleAssignmentScheduleRequestsListForScopeSamples.java @@ -0,0 +1,26 @@ +// 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.generated; + +/** Samples for RoleAssignmentScheduleRequests ListForScope. */ +public final class RoleAssignmentScheduleRequestsListForScopeSamples { + /* + * x-ms-original-file: specification/authorization/resource-manager/Microsoft.Authorization/preview/2023-04-01-preview/examples/GetRoleAssignmentScheduleRequestByScope.json + */ + /** + * Sample code: GetRoleAssignmentScheduleRequestByScope. + * + * @param manager Entry point to AuthorizationManager. + */ + public static void getRoleAssignmentScheduleRequestByScope( + com.azure.resourcemanager.authorization.generated.AuthorizationManager manager) { + manager + .roleAssignmentScheduleRequests() + .listForScope( + "providers/Microsoft.Subscription/subscriptions/dfa2a084-766f-4003-8ae1-c4aeb893a99f", + "assignedTo('A3BB8764-CB92-4276-9D2A-CA1E895E55EA')", + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/authorization/azure-resourcemanager-authorization-generated/src/samples/java/com/azure/resourcemanager/authorization/generated/generated/RoleAssignmentScheduleRequestsValidateSamples.java b/sdk/authorization/azure-resourcemanager-authorization-generated/src/samples/java/com/azure/resourcemanager/authorization/generated/generated/RoleAssignmentScheduleRequestsValidateSamples.java new file mode 100644 index 0000000000000..a8d6d975b8e33 --- /dev/null +++ b/sdk/authorization/azure-resourcemanager-authorization-generated/src/samples/java/com/azure/resourcemanager/authorization/generated/generated/RoleAssignmentScheduleRequestsValidateSamples.java @@ -0,0 +1,50 @@ +// 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.generated; + +import com.azure.resourcemanager.authorization.generated.fluent.models.RoleAssignmentScheduleRequestInner; +import com.azure.resourcemanager.authorization.generated.models.RequestType; +import com.azure.resourcemanager.authorization.generated.models.RoleAssignmentScheduleRequestPropertiesScheduleInfo; +import com.azure.resourcemanager.authorization.generated.models.RoleAssignmentScheduleRequestPropertiesScheduleInfoExpiration; +import com.azure.resourcemanager.authorization.generated.models.Type; +import java.time.OffsetDateTime; + +/** Samples for RoleAssignmentScheduleRequests Validate. */ +public final class RoleAssignmentScheduleRequestsValidateSamples { + /* + * x-ms-original-file: specification/authorization/resource-manager/Microsoft.Authorization/preview/2023-04-01-preview/examples/ValidateRoleAssignmentScheduleRequestByName.json + */ + /** + * Sample code: ValidateRoleAssignmentScheduleRequestByName. + * + * @param manager Entry point to AuthorizationManager. + */ + public static void validateRoleAssignmentScheduleRequestByName( + com.azure.resourcemanager.authorization.generated.AuthorizationManager manager) { + manager + .roleAssignmentScheduleRequests() + .validateWithResponse( + "subscriptions/dfa2a084-766f-4003-8ae1-c4aeb893a99f", + "fea7a502-9a96-4806-a26f-eee560e52045", + new RoleAssignmentScheduleRequestInner() + .withRoleDefinitionId( + "/subscriptions/dfa2a084-766f-4003-8ae1-c4aeb893a99f/providers/Microsoft.Authorization/roleDefinitions/c8d4ff99-41c3-41a8-9f60-21dfdad59608") + .withPrincipalId("a3bb8764-cb92-4276-9d2a-ca1e895e55ea") + .withRequestType(RequestType.SELF_ACTIVATE) + .withScheduleInfo( + new RoleAssignmentScheduleRequestPropertiesScheduleInfo() + .withStartDateTime(OffsetDateTime.parse("2020-09-09T21:35:27.91Z")) + .withExpiration( + new RoleAssignmentScheduleRequestPropertiesScheduleInfoExpiration() + .withType(Type.AFTER_DURATION) + .withDuration("PT8H"))) + .withLinkedRoleEligibilityScheduleId("b1477448-2cc6-4ceb-93b4-54a202a89413") + .withCondition( + "@Resource[Microsoft.Storage/storageAccounts/blobServices/containers:ContainerName]" + + " StringEqualsIgnoreCase 'foo_storage_container'") + .withConditionVersion("1.0"), + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/authorization/ci.yml b/sdk/authorization/ci.yml new file mode 100644 index 0000000000000..eb62b2724b500 --- /dev/null +++ b/sdk/authorization/ci.yml @@ -0,0 +1,47 @@ +# NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. + +trigger: + branches: + include: + - main + - hotfix/* + - release/* + paths: + include: + - sdk/authorization/ci.yml + - sdk/authorization/azure-resourcemanager-authorization-generated/ + exclude: + - sdk/authorization/pom.xml + - sdk/authorization/azure-resourcemanager-authorization-generated/pom.xml + +pr: + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/authorization/ci.yml + - sdk/authorization/azure-resourcemanager-authorization-generated/ + exclude: + - sdk/authorization/pom.xml + - sdk/authorization/azure-resourcemanager-authorization-generated/pom.xml + +parameters: + - name: release_azureresourcemanagerauthorizationgenerated + displayName: azure-resourcemanager-authorization-generated + type: boolean + default: false + +extends: + template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml + parameters: + ServiceDirectory: authorization + EnableBatchRelease: true + Artifacts: + - name: azure-resourcemanager-authorization-generated + groupId: com.azure.resourcemanager + safeName: azureresourcemanagerauthorizationgenerated + releaseInBatch: ${{ parameters.release_azureresourcemanagerauthorizationgenerated }} diff --git a/sdk/authorization/pom.xml b/sdk/authorization/pom.xml new file mode 100644 index 0000000000000..ac027b696debd --- /dev/null +++ b/sdk/authorization/pom.xml @@ -0,0 +1,15 @@ + + + 4.0.0 + com.azure + azure-authorization-service + pom + 1.0.0 + + + azure-resourcemanager-authorization-generated + +